mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
6988353: refactor contended sync subsystem
Reduce complexity by factoring synchronizer.cpp Reviewed-by: dholmes, never, coleenp
This commit is contained in:
parent
daa052114f
commit
22929fb78f
29 changed files with 4556 additions and 4792 deletions
|
@ -25,26 +25,6 @@
|
|||
# include "incls/_precompiled.incl"
|
||||
# include "incls/_jvmtiImpl.cpp.incl"
|
||||
|
||||
GrowableArray<JvmtiRawMonitor*> *JvmtiPendingMonitors::_monitors = new (ResourceObj::C_HEAP) GrowableArray<JvmtiRawMonitor*>(1,true);
|
||||
|
||||
void JvmtiPendingMonitors::transition_raw_monitors() {
|
||||
assert((Threads::number_of_threads()==1),
|
||||
"Java thread has not created yet or more than one java thread \
|
||||
is running. Raw monitor transition will not work");
|
||||
JavaThread *current_java_thread = JavaThread::current();
|
||||
assert(current_java_thread->thread_state() == _thread_in_vm, "Must be in vm");
|
||||
{
|
||||
ThreadBlockInVM __tbivm(current_java_thread);
|
||||
for(int i=0; i< count(); i++) {
|
||||
JvmtiRawMonitor *rmonitor = monitors()->at(i);
|
||||
int r = rmonitor->raw_enter(current_java_thread);
|
||||
assert(r == ObjectMonitor::OM_OK, "raw_enter should have worked");
|
||||
}
|
||||
}
|
||||
// pending monitors are converted to real monitor so delete them all.
|
||||
dispose();
|
||||
}
|
||||
|
||||
//
|
||||
// class JvmtiAgentThread
|
||||
//
|
||||
|
@ -216,57 +196,6 @@ void GrowableCache::gc_epilogue() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// class JvmtiRawMonitor
|
||||
//
|
||||
|
||||
JvmtiRawMonitor::JvmtiRawMonitor(const char *name) {
|
||||
#ifdef ASSERT
|
||||
_name = strcpy(NEW_C_HEAP_ARRAY(char, strlen(name) + 1), name);
|
||||
#else
|
||||
_name = NULL;
|
||||
#endif
|
||||
_magic = JVMTI_RM_MAGIC;
|
||||
}
|
||||
|
||||
JvmtiRawMonitor::~JvmtiRawMonitor() {
|
||||
#ifdef ASSERT
|
||||
FreeHeap(_name);
|
||||
#endif
|
||||
_magic = 0;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
JvmtiRawMonitor::is_valid() {
|
||||
int value = 0;
|
||||
|
||||
// This object might not be a JvmtiRawMonitor so we can't assume
|
||||
// the _magic field is properly aligned. Get the value in a safe
|
||||
// way and then check against JVMTI_RM_MAGIC.
|
||||
|
||||
switch (sizeof(_magic)) {
|
||||
case 2:
|
||||
value = Bytes::get_native_u2((address)&_magic);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
value = Bytes::get_native_u4((address)&_magic);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
value = Bytes::get_native_u8((address)&_magic);
|
||||
break;
|
||||
|
||||
default:
|
||||
guarantee(false, "_magic field is an unexpected size");
|
||||
}
|
||||
|
||||
return value == JVMTI_RM_MAGIC;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// class JvmtiBreakpoint
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue