Mercurial > hg > graal-compiler
diff src/share/vm/runtime/synchronizer.hpp @ 1930:2d26b0046e0d
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Tue, 30 Nov 2010 14:53:30 +0100 |
parents | fa83ab460c54 |
children | f95d63e2154a |
line wrap: on
line diff
--- a/src/share/vm/runtime/synchronizer.hpp Mon Nov 29 18:32:30 2010 +0100 +++ b/src/share/vm/runtime/synchronizer.hpp Tue Nov 30 14:53:30 2010 +0100 @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 1998, 2007, 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 @@ -16,59 +16,12 @@ * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. * */ -class BasicLock VALUE_OBJ_CLASS_SPEC { - friend class VMStructs; - private: - volatile markOop _displaced_header; - public: - markOop displaced_header() const { return _displaced_header; } - void set_displaced_header(markOop header) { _displaced_header = header; } - - void print_on(outputStream* st) const; - - // move a basic lock (used during deoptimization - void move_to(oop obj, BasicLock* dest); - - static int displaced_header_offset_in_bytes() { return offset_of(BasicLock, _displaced_header); } -}; - -// A BasicObjectLock associates a specific Java object with a BasicLock. -// It is currently embedded in an interpreter frame. - -// Because some machines have alignment restrictions on the control stack, -// the actual space allocated by the interpreter may include padding words -// after the end of the BasicObjectLock. Also, in order to guarantee -// alignment of the embedded BasicLock objects on such machines, we -// put the embedded BasicLock at the beginning of the struct. - -class BasicObjectLock VALUE_OBJ_CLASS_SPEC { - friend class VMStructs; - private: - BasicLock _lock; // the lock, must be double word aligned - oop _obj; // object holds the lock; - - public: - // Manipulation - oop obj() const { return _obj; } - void set_obj(oop obj) { _obj = obj; } - BasicLock* lock() { return &_lock; } - - // Note: Use frame::interpreter_frame_monitor_size() for the size of BasicObjectLocks - // in interpreter activation frames since it includes machine-specific padding. - static int size() { return sizeof(BasicObjectLock)/wordSize; } - - // GC support - void oops_do(OopClosure* f) { f->do_oop(&_obj); } - - static int obj_offset_in_bytes() { return offset_of(BasicObjectLock, _obj); } - static int lock_offset_in_bytes() { return offset_of(BasicObjectLock, _lock); } -}; class ObjectMonitor; @@ -122,8 +75,9 @@ static void reenter (Handle obj, intptr_t recursion, TRAPS); // thread-specific and global objectMonitor free list accessors +// static void verifyInUse (Thread * Self) ; too slow for general assert/debug static ObjectMonitor * omAlloc (Thread * Self) ; - static void omRelease (Thread * Self, ObjectMonitor * m) ; + static void omRelease (Thread * Self, ObjectMonitor * m, bool FromPerThreadAlloc) ; static void omFlush (Thread * Self) ; // Inflate light weight monitor to heavy weight monitor @@ -150,6 +104,11 @@ // Basically we deflate all monitors that are not busy. // An adaptive profile-based deflation policy could be used if needed static void deflate_idle_monitors(); + static int walk_monitor_list(ObjectMonitor** listheadp, + ObjectMonitor** FreeHeadp, + ObjectMonitor** FreeTailp); + static bool deflate_monitor(ObjectMonitor* mid, oop obj, ObjectMonitor** FreeHeadp, + ObjectMonitor** FreeTailp); static void oops_do(OopClosure* f); // debugging @@ -157,34 +116,14 @@ static void verify() PRODUCT_RETURN; static int verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0; + static void RegisterSpinCallback (int (*)(intptr_t, int), intptr_t) ; + private: enum { _BLOCKSIZE = 128 }; static ObjectMonitor* gBlockList; static ObjectMonitor * volatile gFreeList; - - public: - static void Initialize () ; - static PerfCounter * _sync_ContendedLockAttempts ; - static PerfCounter * _sync_FutileWakeups ; - static PerfCounter * _sync_Parks ; - static PerfCounter * _sync_EmptyNotifications ; - static PerfCounter * _sync_Notifications ; - static PerfCounter * _sync_SlowEnter ; - static PerfCounter * _sync_SlowExit ; - static PerfCounter * _sync_SlowNotify ; - static PerfCounter * _sync_SlowNotifyAll ; - static PerfCounter * _sync_FailedSpins ; - static PerfCounter * _sync_SuccessfulSpins ; - static PerfCounter * _sync_PrivateA ; - static PerfCounter * _sync_PrivateB ; - static PerfCounter * _sync_MonInCirculation ; - static PerfCounter * _sync_MonScavenged ; - static PerfCounter * _sync_Inflations ; - static PerfCounter * _sync_Deflations ; - static PerfLongVariable * _sync_MonExtant ; - - public: - static void RegisterSpinCallback (int (*)(intptr_t, int), intptr_t) ; + static ObjectMonitor * volatile gOmInUseList; // for moribund thread, so monitors they inflated still get scanned + static int gOmInUseCount; };