Skip to content

Commit

Permalink
Merge branch 'master' into jdk-8268916-cacerts-test
Browse files Browse the repository at this point in the history
  • Loading branch information
jerboaa committed Feb 27, 2024
2 parents 309219f + 1fad52d commit 33e3f86
Show file tree
Hide file tree
Showing 461 changed files with 2,181 additions and 1,140 deletions.
2 changes: 1 addition & 1 deletion .jcheck/conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[general]
project=jdk8u
jbs=JDK
version=openjdk8u412
version=openjdk8u422

[checks]
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace
Expand Down
4 changes: 2 additions & 2 deletions common/autoconf/version-numbers
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand All @@ -26,7 +26,7 @@
JDK_MAJOR_VERSION=1
JDK_MINOR_VERSION=8
JDK_MICRO_VERSION=0
JDK_UPDATE_VERSION=412
JDK_UPDATE_VERSION=422
LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK
PRODUCT_SUFFIX="Runtime Environment"
Expand Down
13 changes: 1 addition & 12 deletions hotspot/src/cpu/x86/vm/vm_version_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,6 @@ class VM_Version_StubGenerator: public StubCodeGenerator {
};
};


void VM_Version::get_cpu_info_wrapper() {
get_cpu_info_stub(&_cpuid_info);
}

#ifndef CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED
#define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f()
#endif

void VM_Version::get_processor_features() {

_cpu = 4; // 486 by default
Expand All @@ -412,9 +403,7 @@ void VM_Version::get_processor_features() {
if (!Use486InstrsOnly) {
// Get raw processor info

// Some platforms (like Win*) need a wrapper around here
// in order to properly handle SEGV for YMM registers test.
CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(get_cpu_info_wrapper);
get_cpu_info_stub(&_cpuid_info);

assert_is_initialized();
_cpu = extended_cpu_family();
Expand Down
16 changes: 5 additions & 11 deletions hotspot/src/os/windows/vm/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,11 @@ void os::set_native_thread_name(const char *name) {
// is already attached to a debugger; debugger must observe
// the exception below to show the correct name.

// If there is no debugger attached skip raising the exception
if (!IsDebuggerPresent()) {
return;
}

const DWORD MS_VC_EXCEPTION = 0x406D1388;
struct {
DWORD dwType; // must be 0x1000
Expand Down Expand Up @@ -2865,17 +2870,6 @@ address os::win32::fast_jni_accessor_wrapper(BasicType type) {
}
#endif

void os::win32::call_test_func_with_wrapper(void (*funcPtr)(void)) {
// Install a win32 structured exception handler around the test
// function call so the VM can generate an error dump if needed.
__try {
(*funcPtr)();
} __except(topLevelExceptionFilter(
(_EXCEPTION_POINTERS*)_exception_info())) {
// Nothing to do.
}
}

// Virtual Memory

int os::vm_page_size() { return os::win32::vm_page_size(); }
Expand Down
2 changes: 0 additions & 2 deletions hotspot/src/os/windows/vm/os_windows.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ class win32 {
static address fast_jni_accessor_wrapper(BasicType);
#endif

static void call_test_func_with_wrapper(void (*funcPtr)(void));

// filter function to ignore faults on serializations page
static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
};
Expand Down
5 changes: 1 addition & 4 deletions hotspot/src/os/windows/vm/os_windows.inline.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -96,7 +96,4 @@ inline int os::close(int fd) {
return ::close(fd);
}

#define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) \
os::win32::call_test_func_with_wrapper(f)

#endif // OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
2 changes: 1 addition & 1 deletion hotspot/src/share/vm/ci/ciMethodBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ static const char *flagnames[] = {

void ciBlock::dump() {
tty->print(" [%d .. %d), {", _start_bci, _limit_bci);
for (int i = 0; i < 8; i++) {
for (int i = 0; i < 7; i++) {
if ((_flags & (1 << i)) != 0) {
tty->print(" %s", flagnames[i]);
}
Expand Down
51 changes: 39 additions & 12 deletions hotspot/src/share/vm/prims/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@

static jint CurrentVersion = JNI_VERSION_1_8;

#ifdef _WIN32
extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
#endif

// The DT_RETURN_MARK macros create a scoped object to fire the dtrace
// '-return' probe regardless of the return path is taken out of the function.
Expand Down Expand Up @@ -5186,12 +5189,11 @@ DT_RETURN_MARK_DECL(CreateJavaVM, jint
, HOTSPOT_JNI_CREATEJAVAVM_RETURN(_ret_ref));
#endif /* USDT2 */
_JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, void *args) {
static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) {
#ifndef USDT2
HS_DTRACE_PROBE3(hotspot_jni, CreateJavaVM__entry, vm, penv, args);
#else /* USDT2 */
HOTSPOT_JNI_CREATEJAVAVM_ENTRY(
(void **) vm, penv, args);
HOTSPOT_JNI_CREATEJAVAVM_ENTRY((void **) vm, penv, args);
#endif /* USDT2 */
jint result = JNI_ERR;
Expand Down Expand Up @@ -5263,18 +5265,14 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, v
post_thread_start_event(thread);
#ifndef PRODUCT
#ifndef CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED
#define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f()
#endif
// Check if we should compile all classes on bootclasspath
if (CompileTheWorld) ClassLoader::compile_the_world();
if (ReplayCompiles) ciReplay::replay(thread);
// Some platforms (like Win*) need a wrapper around these test
// functions in order to properly handle error conditions.
CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(test_error_handler);
CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(execute_internal_vm_tests);
test_error_handler();
execute_internal_vm_tests();
#endif
// Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
Expand All @@ -5294,6 +5292,22 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, v
}
return result;
}
_JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, void *args) {
jint result = JNI_ERR;
// On Windows, let CreateJavaVM run with SEH protection
#ifdef _WIN32
__try {
#endif
result = JNI_CreateJavaVM_inner(vm, penv, args);
#ifdef _WIN32
} __except(topLevelExceptionFilter((_EXCEPTION_POINTERS*)_exception_info())) {
// Nothing to do.
}
#endif
return result;
}
#ifndef USDT2
Expand Down Expand Up @@ -5336,12 +5350,11 @@ DT_RETURN_MARK_DECL(DestroyJavaVM, jint
, HOTSPOT_JNI_DESTROYJAVAVM_RETURN(_ret_ref));
#endif /* USDT2 */
jint JNICALL jni_DestroyJavaVM(JavaVM *vm) {
static jint JNICALL jni_DestroyJavaVM_inner(JavaVM *vm) {
#ifndef USDT2
DTRACE_PROBE1(hotspot_jni, DestroyJavaVM__entry, vm);
#else /* USDT2 */
HOTSPOT_JNI_DESTROYJAVAVM_ENTRY(
vm);
HOTSPOT_JNI_DESTROYJAVAVM_ENTRY(vm);
#endif /* USDT2 */
jint res = JNI_ERR;
DT_RETURN_MARK(DestroyJavaVM, jint, (const jint&)res);
Expand Down Expand Up @@ -5377,6 +5390,20 @@ jint JNICALL jni_DestroyJavaVM(JavaVM *vm) {
}
}
jint JNICALL jni_DestroyJavaVM(JavaVM *vm) {
jint result = JNI_ERR;
// On Windows, we need SEH protection
#ifdef _WIN32
__try {
#endif
result = jni_DestroyJavaVM_inner(vm);
#ifdef _WIN32
} __except(topLevelExceptionFilter((_EXCEPTION_POINTERS*)_exception_info())) {
// Nothing to do.
}
#endif
return result;
}
static jint attach_current_thread(JavaVM *vm, void **penv, void *_args, bool daemon) {
JavaVMAttachArgs *args = (JavaVMAttachArgs *) _args;
Expand Down
3 changes: 3 additions & 0 deletions hotspot/src/share/vm/runtime/mutexLocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Mutex* Shared_SATB_Q_lock = NULL;
Mutex* DirtyCardQ_FL_lock = NULL;
Monitor* DirtyCardQ_CBL_mon = NULL;
Mutex* Shared_DirtyCardQ_lock = NULL;
Mutex* MonitoringSupport_lock = NULL;
Mutex* ParGCRareEvent_lock = NULL;
Mutex* EvacFailureStack_lock = NULL;
Mutex* DerivedPointerTableGC_lock = NULL;
Expand Down Expand Up @@ -208,6 +209,8 @@ void mutex_init() {

def(StringDedupQueue_lock , Monitor, leaf, true );
def(StringDedupTable_lock , Mutex , leaf, true );

def(MonitoringSupport_lock , Mutex , leaf, true ); // used for serviceability monitoring support
}
def(ParGCRareEvent_lock , Mutex , leaf , true );
def(DerivedPointerTableGC_lock , Mutex, leaf, true );
Expand Down
3 changes: 2 additions & 1 deletion hotspot/src/share/vm/runtime/mutexLocker.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -101,6 +101,7 @@ extern Mutex* Shared_DirtyCardQ_lock; // Lock protecting dirty card
// queue shared by
// non-Java threads.
// (see option ExplicitGCInvokesConcurrent)
extern Mutex* MonitoringSupport_lock; // Protects updates to the serviceability memory pools and allocated memory high water mark.
extern Mutex* ParGCRareEvent_lock; // Synchronizes various (rare) parallel GC ops.
extern Mutex* EvacFailureStack_lock; // guards the evac failure scan stack
extern Mutex* Compile_lock; // a lock held when Compilation is updating code (used to block CodeCache traversal, CHA updates, etc)
Expand Down
5 changes: 3 additions & 2 deletions hotspot/src/share/vm/services/jmm.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -218,7 +218,8 @@ typedef struct {
} dcmdArgInfo;

typedef struct jmmInterface_1_ {
void* reserved1;
jlong (JNICALL *GetTotalThreadAllocatedMemory)
(JNIEnv *env);
jlong (JNICALL *GetOneThreadAllocatedMemory)
(JNIEnv *env,
jlong thread_id);
Expand Down
44 changes: 35 additions & 9 deletions hotspot/src/share/vm/services/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "runtime/interfaceSupport.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jniHandles.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/os.hpp"
#include "runtime/serviceThread.hpp"
#include "runtime/thread.inline.hpp"
Expand Down Expand Up @@ -428,8 +429,6 @@ static MemoryPool* get_memory_pool_from_jobject(jobject obj, TRAPS) {
return MemoryService::get_memory_pool(ph);
}

#endif // INCLUDE_MANAGEMENT

static void validate_thread_id_array(typeArrayHandle ids_ah, TRAPS) {
int num_threads = ids_ah->length();

Expand All @@ -445,8 +444,6 @@ static void validate_thread_id_array(typeArrayHandle ids_ah, TRAPS) {
}
}

#if INCLUDE_MANAGEMENT

static void validate_thread_info_array(objArrayHandle infoArray_h, TRAPS) {
// check if the element of infoArray is of type ThreadInfo class
Klass* threadinfo_klass = Management::java_lang_management_ThreadInfo_klass(CHECK);
Expand Down Expand Up @@ -2230,7 +2227,39 @@ jlong Management::ticks_to_ms(jlong ticks) {
return (jlong)(((double)ticks / (double)os::elapsed_frequency())
* (double)1000.0);
}
#endif // INCLUDE_MANAGEMENT

// Gets the amount of memory allocated on the Java heap since JVM launch.
JVM_ENTRY(jlong, jmm_GetTotalThreadAllocatedMemory(JNIEnv *env))
// We keep a high water mark to ensure monotonicity
static jlong high_water_result = 0;
static jlong prev_result = 0;

jlong result;
if (Threads_lock->try_lock()) {
result = ThreadService::exited_allocated_bytes();
for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) {
jlong size = thread->cooked_allocated_bytes();
result += size;
}
Threads_lock->unlock();
} else {
// Return the previous result if Threads_lock is locked
result = prev_result;
}

{
MutexLockerEx ml(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
if (result < high_water_result) {
// Result wrapped to a negative value, in which case it's
// pegged at the last positive value.
result = high_water_result;
} else {
high_water_result = result;
}
prev_result = result;
}
return result;
JVM_END

// Gets the amount of memory allocated on the Java heap for a single thread.
// Returns -1 if the thread does not exist or has terminated.
Expand Down Expand Up @@ -2368,11 +2397,8 @@ JVM_ENTRY(void, jmm_GetThreadCpuTimesWithKind(JNIEnv *env, jlongArray ids,
}
JVM_END



#if INCLUDE_MANAGEMENT
const struct jmmInterface_1_ jmm_interface = {
NULL,
jmm_GetTotalThreadAllocatedMemory,
jmm_GetOneThreadAllocatedMemory,
jmm_GetVersion,
jmm_GetOptionalSupport,
Expand Down
5 changes: 5 additions & 0 deletions hotspot/src/share/vm/services/threadService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ PerfVariable* ThreadService::_daemon_threads_count = NULL;
volatile int ThreadService::_exiting_threads_count = 0;
volatile int ThreadService::_exiting_daemon_threads_count = 0;

volatile jlong ThreadService::_exited_allocated_bytes = 0;

ThreadDumpResult* ThreadService::_threaddump_list = NULL;

static const int INITIAL_ARRAY_SIZE = 10;
Expand Down Expand Up @@ -119,6 +121,9 @@ void ThreadService::add_thread(JavaThread* thread, bool daemon) {
}

void ThreadService::remove_thread(JavaThread* thread, bool daemon) {
// Include hidden thread allcations in exited_allocated_bytes
ThreadService::incr_exited_allocated_bytes(thread->cooked_allocated_bytes());

Atomic::dec((jint*) &_exiting_threads_count);

if (thread->is_hidden_from_external_view() ||
Expand Down
10 changes: 10 additions & 0 deletions hotspot/src/share/vm/services/threadService.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class ThreadService : public AllStatic {
static PerfVariable* _peak_threads_count;
static PerfVariable* _daemon_threads_count;

static volatile jlong _exited_allocated_bytes;

// These 2 counters are atomically incremented once the thread is exiting.
// They will be atomically decremented when ThreadService::remove_thread is called.
static volatile int _exiting_threads_count;
Expand Down Expand Up @@ -95,6 +97,14 @@ class ThreadService : public AllStatic {
static int exiting_threads_count() { return _exiting_threads_count; }
static int exiting_daemon_threads_count() { return _exiting_daemon_threads_count; }

static jlong exited_allocated_bytes() { return Atomic::load(&_exited_allocated_bytes); }
static void incr_exited_allocated_bytes(jlong size) {
// No need for an atomic add because called under the Threads_lock,
// but because _exited_allocated_bytes is read concurrently, need
// atomic store to avoid readers seeing a partial update.
Atomic::store(_exited_allocated_bytes + size, &_exited_allocated_bytes);
}

// Support for thread dump
static void add_thread_dump(ThreadDumpResult* dump);
static void remove_thread_dump(ThreadDumpResult* dump);
Expand Down
2 changes: 1 addition & 1 deletion jdk/make/data/tzdata/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
tzdata2023d
tzdata2024a
Loading

0 comments on commit 33e3f86

Please sign in to comment.