mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 20:44:41 +02:00
Merge
This commit is contained in:
commit
3b29cc06ea
14 changed files with 235 additions and 190 deletions
|
@ -642,13 +642,14 @@ objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction = NU
|
|||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
static uint64_t locate_unique_thread_id() {
|
||||
static uint64_t locate_unique_thread_id(mach_port_t mach_thread_port) {
|
||||
// Additional thread_id used to correlate threads in SA
|
||||
thread_identifier_info_data_t m_ident_info;
|
||||
mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
|
||||
|
||||
thread_info(::mach_thread_self(), THREAD_IDENTIFIER_INFO,
|
||||
thread_info(mach_thread_port, THREAD_IDENTIFIER_INFO,
|
||||
(thread_info_t) &m_ident_info, &count);
|
||||
|
||||
return m_ident_info.thread_id;
|
||||
}
|
||||
#endif
|
||||
|
@ -679,9 +680,14 @@ static void *java_start(Thread *thread) {
|
|||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// thread_id is mach thread on macos
|
||||
osthread->set_thread_id(::mach_thread_self());
|
||||
osthread->set_unique_thread_id(locate_unique_thread_id());
|
||||
// thread_id is mach thread on macos, which pthreads graciously caches and provides for us
|
||||
mach_port_t thread_id = ::pthread_mach_thread_np(::pthread_self());
|
||||
guarantee(thread_id != 0, "thread id missing from pthreads");
|
||||
osthread->set_thread_id(thread_id);
|
||||
|
||||
uint64_t unique_thread_id = locate_unique_thread_id(thread_id);
|
||||
guarantee(unique_thread_id != 0, "unique thread id was not found");
|
||||
osthread->set_unique_thread_id(unique_thread_id);
|
||||
#else
|
||||
// thread_id is pthread_id on BSD
|
||||
osthread->set_thread_id(::pthread_self());
|
||||
|
@ -843,8 +849,14 @@ bool os::create_attached_thread(JavaThread* thread) {
|
|||
|
||||
// Store pthread info into the OSThread
|
||||
#ifdef __APPLE__
|
||||
osthread->set_thread_id(::mach_thread_self());
|
||||
osthread->set_unique_thread_id(locate_unique_thread_id());
|
||||
// thread_id is mach thread on macos, which pthreads graciously caches and provides for us
|
||||
mach_port_t thread_id = ::pthread_mach_thread_np(::pthread_self());
|
||||
guarantee(thread_id != 0, "just checking");
|
||||
osthread->set_thread_id(thread_id);
|
||||
|
||||
uint64_t unique_thread_id = locate_unique_thread_id(thread_id);
|
||||
guarantee(unique_thread_id != 0, "just checking");
|
||||
osthread->set_unique_thread_id(unique_thread_id);
|
||||
#else
|
||||
osthread->set_thread_id(::pthread_self());
|
||||
#endif
|
||||
|
@ -1115,7 +1127,7 @@ size_t os::lasterror(char *buf, size_t len) {
|
|||
|
||||
intx os::current_thread_id() {
|
||||
#ifdef __APPLE__
|
||||
return (intx)::mach_thread_self();
|
||||
return (intx)::pthread_mach_thread_np(::pthread_self());
|
||||
#else
|
||||
return (intx)::pthread_self();
|
||||
#endif
|
||||
|
@ -3275,11 +3287,15 @@ void os::Bsd::install_signal_handlers() {
|
|||
// and if UserSignalHandler is installed all bets are off
|
||||
if (CheckJNICalls) {
|
||||
if (libjsig_is_loaded) {
|
||||
tty->print_cr("Info: libjsig is activated, all active signal checking is disabled");
|
||||
if (PrintJNIResolving) {
|
||||
tty->print_cr("Info: libjsig is activated, all active signal checking is disabled");
|
||||
}
|
||||
check_signals = false;
|
||||
}
|
||||
if (AllowUserSignalHandlers) {
|
||||
tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
|
||||
if (PrintJNIResolving) {
|
||||
tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
|
||||
}
|
||||
check_signals = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1554,18 +1554,22 @@ bool VM_RedefineClasses::rewrite_cp_refs(instanceKlassHandle scratch_class,
|
|||
return false;
|
||||
}
|
||||
|
||||
// rewrite sourc file name index:
|
||||
// rewrite source file name index:
|
||||
u2 source_file_name_idx = scratch_class->source_file_name_index();
|
||||
if (source_file_name_idx != 0) {
|
||||
u2 new_source_file_name_idx = find_new_index(source_file_name_idx);
|
||||
scratch_class->set_source_file_name_index(new_source_file_name_idx);
|
||||
if (new_source_file_name_idx != 0) {
|
||||
scratch_class->set_source_file_name_index(new_source_file_name_idx);
|
||||
}
|
||||
}
|
||||
|
||||
// rewrite class generic signature index:
|
||||
u2 generic_signature_index = scratch_class->generic_signature_index();
|
||||
if (generic_signature_index != 0) {
|
||||
u2 new_generic_signature_index = find_new_index(generic_signature_index);
|
||||
scratch_class->set_generic_signature_index(new_generic_signature_index);
|
||||
if (new_generic_signature_index != 0) {
|
||||
scratch_class->set_generic_signature_index(new_generic_signature_index);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1737,7 +1741,10 @@ void VM_RedefineClasses::rewrite_cp_refs_in_method(methodHandle method,
|
|||
|
||||
for (int i = 0; i < len; i++) {
|
||||
const u2 cp_index = elem[i].name_cp_index;
|
||||
elem[i].name_cp_index = find_new_index(cp_index);
|
||||
const u2 new_cp_index = find_new_index(cp_index);
|
||||
if (new_cp_index != 0) {
|
||||
elem[i].name_cp_index = new_cp_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end rewrite_cp_refs_in_method()
|
||||
|
|
|
@ -124,13 +124,15 @@ Monitor* GCTaskManager_lock = NULL;
|
|||
|
||||
Mutex* Management_lock = NULL;
|
||||
Monitor* Service_lock = NULL;
|
||||
Mutex* Stacktrace_lock = NULL;
|
||||
Monitor* PeriodicTask_lock = NULL;
|
||||
|
||||
Monitor* JfrQuery_lock = NULL;
|
||||
#ifdef INCLUDE_TRACE
|
||||
Mutex* JfrStacktrace_lock = NULL;
|
||||
Monitor* JfrMsg_lock = NULL;
|
||||
Mutex* JfrBuffer_lock = NULL;
|
||||
Mutex* JfrStream_lock = NULL;
|
||||
Monitor* PeriodicTask_lock = NULL;
|
||||
Mutex* JfrThreadGroups_lock = NULL;
|
||||
#endif
|
||||
|
||||
#define MAX_NUM_MUTEX 128
|
||||
static Monitor * _mutex_array[MAX_NUM_MUTEX];
|
||||
|
@ -206,7 +208,6 @@ void mutex_init() {
|
|||
def(Patching_lock , Mutex , special, true ); // used for safepointing and code patching.
|
||||
def(ObjAllocPost_lock , Monitor, special, false);
|
||||
def(Service_lock , Monitor, special, true ); // used for service thread operations
|
||||
def(Stacktrace_lock , Mutex, special, true ); // used for JFR stacktrace database
|
||||
def(JmethodIdCreation_lock , Mutex , leaf, true ); // used for creating jmethodIDs.
|
||||
|
||||
def(SystemDictionary_lock , Monitor, leaf, true ); // lookups done by VM thread
|
||||
|
@ -272,11 +273,16 @@ void mutex_init() {
|
|||
def(Debug3_lock , Mutex , nonleaf+4, true );
|
||||
def(ProfileVM_lock , Monitor, special, false); // used for profiling of the VMThread
|
||||
def(CompileThread_lock , Monitor, nonleaf+5, false );
|
||||
def(PeriodicTask_lock , Monitor, nonleaf+5, true);
|
||||
|
||||
#ifdef INCLUDE_TRACE
|
||||
def(JfrMsg_lock , Monitor, leaf, true);
|
||||
def(JfrBuffer_lock , Mutex, nonleaf+1, true);
|
||||
def(JfrThreadGroups_lock , Mutex, nonleaf+1, true);
|
||||
def(JfrStream_lock , Mutex, nonleaf+2, true);
|
||||
def(PeriodicTask_lock , Monitor, nonleaf+5, true);
|
||||
def(JfrStacktrace_lock , Mutex, special, true );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
GCMutexLocker::GCMutexLocker(Monitor * mutex) {
|
||||
|
|
|
@ -137,13 +137,15 @@ extern Mutex* HotCardCache_lock; // protects the hot card cache
|
|||
|
||||
extern Mutex* Management_lock; // a lock used to serialize JVM management
|
||||
extern Monitor* Service_lock; // a lock used for service thread operation
|
||||
extern Mutex* Stacktrace_lock; // used to guard access to the stacktrace table
|
||||
extern Monitor* PeriodicTask_lock; // protects the periodic task structure
|
||||
|
||||
extern Monitor* JfrQuery_lock; // protects JFR use
|
||||
#ifdef INCLUDE_TRACE
|
||||
extern Mutex* JfrStacktrace_lock; // used to guard access to the JFR stacktrace table
|
||||
extern Monitor* JfrMsg_lock; // protects JFR messaging
|
||||
extern Mutex* JfrBuffer_lock; // protects JFR buffer operations
|
||||
extern Mutex* JfrStream_lock; // protects JFR stream access
|
||||
extern Monitor* PeriodicTask_lock; // protects the periodic task structure
|
||||
extern Mutex* JfrThreadGroups_lock; // protects JFR access to Thread Groups
|
||||
#endif
|
||||
|
||||
// A MutexLocker provides mutual exclusion with respect to a given mutex
|
||||
// for the scope which contains the locker. The lock is an OS lock, not
|
||||
|
|
|
@ -876,8 +876,6 @@ JVM_ENTRY(jobject, jmm_GetMemoryUsage(JNIEnv* env, jboolean heap))
|
|||
total_used += u.used();
|
||||
total_committed += u.committed();
|
||||
|
||||
// if any one of the memory pool has undefined init_size or max_size,
|
||||
// set it to -1
|
||||
if (u.init_size() == (size_t)-1) {
|
||||
has_undefined_init_size = true;
|
||||
}
|
||||
|
@ -894,6 +892,15 @@ JVM_ENTRY(jobject, jmm_GetMemoryUsage(JNIEnv* env, jboolean heap))
|
|||
}
|
||||
}
|
||||
|
||||
// if any one of the memory pool has undefined init_size or max_size,
|
||||
// set it to -1
|
||||
if (has_undefined_init_size) {
|
||||
total_init = (size_t)-1;
|
||||
}
|
||||
if (has_undefined_max_size) {
|
||||
total_max = (size_t)-1;
|
||||
}
|
||||
|
||||
MemoryUsage usage((heap ? InitialHeapSize : total_init),
|
||||
total_used,
|
||||
total_committed,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue