8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists

Reviewed-by: kbarrett, dholmes
This commit is contained in:
Daniel D. Daugherty 2019-08-28 10:56:50 -04:00
parent a2c067f6e8
commit 9b992ead1e
12 changed files with 490 additions and 474 deletions

View file

@ -34,12 +34,14 @@
class ObjectMonitor;
class ThreadsList;
typedef PaddedEnd<ObjectMonitor, DEFAULT_CACHE_LINE_SIZE> PaddedObjectMonitor;
struct DeflateMonitorCounters {
int nInuse; // currently associated with objects
int nInCirculation; // extant
int nScavenged; // reclaimed (global and per-thread)
int perThreadScavenged; // per-thread scavenge total
double perThreadTimes; // per-thread scavenge times
int n_in_use; // currently associated with objects
int n_in_circulation; // extant
int n_scavenged; // reclaimed (global and per-thread)
int per_thread_scavenged; // per-thread scavenge total
double per_thread_times; // per-thread scavenge times
};
class ObjectSynchronizer : AllStatic {
@ -79,13 +81,13 @@ class ObjectSynchronizer : AllStatic {
static void notify(Handle obj, TRAPS);
static void notifyall(Handle obj, TRAPS);
static bool quick_notify(oopDesc* obj, Thread* Self, bool All);
static bool quick_enter(oop obj, Thread* Self, BasicLock* Lock);
static bool quick_notify(oopDesc* obj, Thread* self, bool All);
static bool quick_enter(oop obj, Thread* self, BasicLock* Lock);
// Special internal-use-only method for use by JVM infrastructure
// that needs to wait() on a java-level object but that can't risk
// throwing unexpected InterruptedExecutionExceptions.
static void waitUninterruptibly(Handle obj, jlong Millis, Thread * THREAD);
static void wait_uninterruptibly(Handle obj, jlong Millis, Thread* THREAD);
// used by classloading to free classloader object lock,
// wait on an internal lock, and reclaim original lock
@ -93,14 +95,14 @@ class ObjectSynchronizer : AllStatic {
static intptr_t complete_exit(Handle obj, TRAPS);
static void reenter (Handle obj, intptr_t recursion, TRAPS);
// thread-specific and global objectMonitor free list accessors
static ObjectMonitor * omAlloc(Thread * Self);
static void omRelease(Thread * Self, ObjectMonitor * m,
bool FromPerThreadAlloc);
static void omFlush(Thread * Self);
// thread-specific and global ObjectMonitor free list accessors
static ObjectMonitor* om_alloc(Thread* self);
static void om_release(Thread* self, ObjectMonitor* m,
bool FromPerThreadAlloc);
static void om_flush(Thread* self);
// Inflate light weight monitor to heavy weight monitor
static ObjectMonitor* inflate(Thread * Self, oop obj, const InflateCause cause);
static ObjectMonitor* inflate(Thread* self, oop obj, const InflateCause cause);
// This version is only for internal use
static void inflate_helper(oop obj);
static const char* inflate_cause_name(const InflateCause cause);
@ -108,11 +110,11 @@ class ObjectSynchronizer : AllStatic {
// Returns the identity hash value for an oop
// NOTE: It may cause monitor inflation
static intptr_t identity_hash_value_for(Handle obj);
static intptr_t FastHashCode(Thread * Self, oop obj);
static intptr_t FastHashCode(Thread* self, oop obj);
// java.lang.Thread support
static bool current_thread_holds_lock(JavaThread* thread, Handle h_obj);
static LockOwnership query_lock_ownership(JavaThread * self, Handle h_obj);
static LockOwnership query_lock_ownership(JavaThread* self, Handle h_obj);
static JavaThread* get_lock_owner(ThreadsList * t_list, Handle h_obj);
@ -129,12 +131,12 @@ class ObjectSynchronizer : AllStatic {
static void finish_deflate_idle_monitors(DeflateMonitorCounters* counters);
// For a given monitor list: global or per-thread, deflate idle monitors
static int deflate_monitor_list(ObjectMonitor** listheadp,
ObjectMonitor** freeHeadp,
ObjectMonitor** freeTailp);
static int deflate_monitor_list(ObjectMonitor** list_p,
ObjectMonitor** free_head_p,
ObjectMonitor** free_tail_p);
static bool deflate_monitor(ObjectMonitor* mid, oop obj,
ObjectMonitor** freeHeadp,
ObjectMonitor** freeTailp);
ObjectMonitor** free_head_p,
ObjectMonitor** free_tail_p);
static bool is_cleanup_needed();
static void oops_do(OopClosure* f);
// Process oops in thread local used monitors
@ -142,13 +144,13 @@ class ObjectSynchronizer : AllStatic {
// debugging
static void audit_and_print_stats(bool on_exit);
static void chk_free_entry(JavaThread * jt, ObjectMonitor * n,
static void chk_free_entry(JavaThread* jt, ObjectMonitor* n,
outputStream * out, int *error_cnt_p);
static void chk_global_free_list_and_count(outputStream * out,
int *error_cnt_p);
static void chk_global_in_use_list_and_count(outputStream * out,
int *error_cnt_p);
static void chk_in_use_entry(JavaThread * jt, ObjectMonitor * n,
static void chk_in_use_entry(JavaThread* jt, ObjectMonitor* n,
outputStream * out, int *error_cnt_p);
static void chk_per_thread_in_use_list_and_count(JavaThread *jt,
outputStream * out,
@ -165,14 +167,14 @@ class ObjectSynchronizer : AllStatic {
enum { _BLOCKSIZE = 128 };
// global list of blocks of monitors
static PaddedEnd<ObjectMonitor> * volatile gBlockList;
static PaddedObjectMonitor* volatile g_block_list;
// global monitor free list
static ObjectMonitor * volatile gFreeList;
static ObjectMonitor* volatile g_free_list;
// global monitor in-use list, for moribund threads,
// monitors they inflated need to be scanned for deflation
static ObjectMonitor * volatile gOmInUseList;
// count of entries in gOmInUseList
static int gOmInUseCount;
static ObjectMonitor* volatile g_om_in_use_list;
// count of entries in g_om_in_use_list
static int g_om_in_use_count;
// Process oops in all global used monitors (i.e. moribund thread's monitors)
static void global_used_oops_do(OopClosure* f);
@ -181,9 +183,9 @@ class ObjectSynchronizer : AllStatic {
// Support for SynchronizerTest access to GVars fields:
static u_char* get_gvars_addr();
static u_char* get_gvars_hcSequence_addr();
static u_char* get_gvars_hc_sequence_addr();
static size_t get_gvars_size();
static u_char* get_gvars_stwRandom_addr();
static u_char* get_gvars_stw_random_addr();
};
// ObjectLocker enforces balanced locking and can never throw an
@ -198,13 +200,13 @@ class ObjectLocker : public StackObj {
BasicLock _lock;
bool _dolock; // default true
public:
ObjectLocker(Handle obj, Thread* thread, bool doLock = true);
ObjectLocker(Handle obj, Thread* thread, bool do_lock = true);
~ObjectLocker();
// Monitor behavior
void wait(TRAPS) { ObjectSynchronizer::wait(_obj, 0, CHECK); } // wait forever
void notify_all(TRAPS) { ObjectSynchronizer::notifyall(_obj, CHECK); }
void waitUninterruptibly(TRAPS) { ObjectSynchronizer::waitUninterruptibly(_obj, 0, CHECK); }
void wait_uninterruptibly(TRAPS) { ObjectSynchronizer::wait_uninterruptibly(_obj, 0, CHECK); }
// complete_exit gives up lock completely, returning recursion count
// reenter reclaims lock with original recursion count
intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, THREAD); }