6988353: refactor contended sync subsystem

Reduce complexity by factoring synchronizer.cpp

Reviewed-by: dholmes, never, coleenp
This commit is contained in:
Karen Kinnear 2010-10-22 15:59:34 -04:00
parent daa052114f
commit 22929fb78f
29 changed files with 4556 additions and 4792 deletions

View file

@ -26,7 +26,6 @@
// Forward Declarations
//
class JvmtiRawMonitor;
class JvmtiBreakpoint;
class JvmtiBreakpoints;
@ -327,76 +326,6 @@ bool JvmtiCurrentBreakpoints::is_breakpoint(address bcp) {
return false;
}
///////////////////////////////////////////////////////////////
//
// class JvmtiRawMonitor
//
// Used by JVMTI methods: All RawMonitor methods (CreateRawMonitor, EnterRawMonitor, etc.)
//
// Wrapper for ObjectMonitor class that saves the Monitor's name
//
class JvmtiRawMonitor : public ObjectMonitor {
private:
int _magic;
char * _name;
// JVMTI_RM_MAGIC is set in contructor and unset in destructor.
enum { JVMTI_RM_MAGIC = (int)(('T' << 24) | ('I' << 16) | ('R' << 8) | 'M') };
public:
JvmtiRawMonitor(const char *name);
~JvmtiRawMonitor();
int magic() { return _magic; }
const char *get_name() { return _name; }
bool is_valid();
};
// Onload pending raw monitors
// Class is used to cache onload or onstart monitor enter
// which will transition into real monitor when
// VM is fully initialized.
class JvmtiPendingMonitors : public AllStatic {
private:
static GrowableArray<JvmtiRawMonitor*> *_monitors; // Cache raw monitor enter
inline static GrowableArray<JvmtiRawMonitor*>* monitors() { return _monitors; }
static void dispose() {
delete monitors();
}
public:
static void enter(JvmtiRawMonitor *monitor) {
monitors()->append(monitor);
}
static int count() {
return monitors()->length();
}
static void destroy(JvmtiRawMonitor *monitor) {
while (monitors()->contains(monitor)) {
monitors()->remove(monitor);
}
}
// Return false if monitor is not found in the list.
static bool exit(JvmtiRawMonitor *monitor) {
if (monitors()->contains(monitor)) {
monitors()->remove(monitor);
return true;
} else {
return false;
}
}
static void transition_raw_monitors();
};
///////////////////////////////////////////////////////////////
// The get/set local operations must only be done by the VM thread
// because the interpreter version needs to access oop maps, which can