< prev index next >

src/hotspot/share/runtime/synchronizer.hpp

Print this page
rev 47287 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10


  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_SYNCHRONIZER_HPP
  26 #define SHARE_VM_RUNTIME_SYNCHRONIZER_HPP
  27 
  28 #include "oops/markOop.hpp"
  29 #include "runtime/basicLock.hpp"
  30 #include "runtime/handles.hpp"
  31 #include "runtime/perfData.hpp"
  32 
  33 class ObjectMonitor;

  34 
  35 struct DeflateMonitorCounters {
  36   int nInuse;          // currently associated with objects
  37   int nInCirculation;  // extant
  38   int nScavenged;      // reclaimed
  39 };
  40 
  41 class ObjectSynchronizer : AllStatic {
  42   friend class VMStructs;
  43  public:
  44   typedef enum {
  45     owner_self,
  46     owner_none,
  47     owner_other
  48   } LockOwnership;
  49 
  50   typedef enum {
  51     inflate_cause_vm_internal = 0,
  52     inflate_cause_monitor_enter = 1,
  53     inflate_cause_wait = 2,


 107   static ObjectMonitor * omAlloc(Thread * Self);
 108   static void omRelease(Thread * Self, ObjectMonitor * m,
 109                         bool FromPerThreadAlloc);
 110   static void omFlush(Thread * Self);
 111 
 112   // Inflate light weight monitor to heavy weight monitor
 113   static ObjectMonitor* inflate(Thread * Self, oop obj, const InflateCause cause);
 114   // This version is only for internal use
 115   static ObjectMonitor* inflate_helper(oop obj);
 116   static const char* inflate_cause_name(const InflateCause cause);
 117 
 118   // Returns the identity hash value for an oop
 119   // NOTE: It may cause monitor inflation
 120   static intptr_t identity_hash_value_for(Handle obj);
 121   static intptr_t FastHashCode(Thread * Self, oop obj);
 122 
 123   // java.lang.Thread support
 124   static bool current_thread_holds_lock(JavaThread* thread, Handle h_obj);
 125   static LockOwnership query_lock_ownership(JavaThread * self, Handle h_obj);
 126 
 127   static JavaThread* get_lock_owner(Handle h_obj, bool doLock);
 128 
 129   // JNI detach support
 130   static void release_monitors_owned_by_thread(TRAPS);
 131   static void monitors_iterate(MonitorClosure* m);
 132 
 133   // GC: we current use aggressive monitor deflation policy
 134   // Basically we deflate all monitors that are not busy.
 135   // An adaptive profile-based deflation policy could be used if needed
 136   static void deflate_idle_monitors(DeflateMonitorCounters* counters);
 137   static void deflate_thread_local_monitors(Thread* thread, DeflateMonitorCounters* counters);
 138   static void prepare_deflate_idle_monitors(DeflateMonitorCounters* counters);
 139   static void finish_deflate_idle_monitors(DeflateMonitorCounters* counters);
 140 
 141   // For a given monitor list: global or per-thread, deflate idle monitors
 142   static int deflate_monitor_list(ObjectMonitor** listheadp,
 143                                   ObjectMonitor** freeHeadp,
 144                                   ObjectMonitor** freeTailp);
 145   static bool deflate_monitor(ObjectMonitor* mid, oop obj,
 146                               ObjectMonitor** freeHeadp,
 147                               ObjectMonitor** freeTailp);




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_SYNCHRONIZER_HPP
  26 #define SHARE_VM_RUNTIME_SYNCHRONIZER_HPP
  27 
  28 #include "oops/markOop.hpp"
  29 #include "runtime/basicLock.hpp"
  30 #include "runtime/handles.hpp"
  31 #include "runtime/perfData.hpp"
  32 
  33 class ObjectMonitor;
  34 class ThreadsList;
  35 
  36 struct DeflateMonitorCounters {
  37   int nInuse;          // currently associated with objects
  38   int nInCirculation;  // extant
  39   int nScavenged;      // reclaimed
  40 };
  41 
  42 class ObjectSynchronizer : AllStatic {
  43   friend class VMStructs;
  44  public:
  45   typedef enum {
  46     owner_self,
  47     owner_none,
  48     owner_other
  49   } LockOwnership;
  50 
  51   typedef enum {
  52     inflate_cause_vm_internal = 0,
  53     inflate_cause_monitor_enter = 1,
  54     inflate_cause_wait = 2,


 108   static ObjectMonitor * omAlloc(Thread * Self);
 109   static void omRelease(Thread * Self, ObjectMonitor * m,
 110                         bool FromPerThreadAlloc);
 111   static void omFlush(Thread * Self);
 112 
 113   // Inflate light weight monitor to heavy weight monitor
 114   static ObjectMonitor* inflate(Thread * Self, oop obj, const InflateCause cause);
 115   // This version is only for internal use
 116   static ObjectMonitor* inflate_helper(oop obj);
 117   static const char* inflate_cause_name(const InflateCause cause);
 118 
 119   // Returns the identity hash value for an oop
 120   // NOTE: It may cause monitor inflation
 121   static intptr_t identity_hash_value_for(Handle obj);
 122   static intptr_t FastHashCode(Thread * Self, oop obj);
 123 
 124   // java.lang.Thread support
 125   static bool current_thread_holds_lock(JavaThread* thread, Handle h_obj);
 126   static LockOwnership query_lock_ownership(JavaThread * self, Handle h_obj);
 127 
 128   static JavaThread* get_lock_owner(ThreadsList * t_list, Handle h_obj);
 129 
 130   // JNI detach support
 131   static void release_monitors_owned_by_thread(TRAPS);
 132   static void monitors_iterate(MonitorClosure* m);
 133 
 134   // GC: we current use aggressive monitor deflation policy
 135   // Basically we deflate all monitors that are not busy.
 136   // An adaptive profile-based deflation policy could be used if needed
 137   static void deflate_idle_monitors(DeflateMonitorCounters* counters);
 138   static void deflate_thread_local_monitors(Thread* thread, DeflateMonitorCounters* counters);
 139   static void prepare_deflate_idle_monitors(DeflateMonitorCounters* counters);
 140   static void finish_deflate_idle_monitors(DeflateMonitorCounters* counters);
 141 
 142   // For a given monitor list: global or per-thread, deflate idle monitors
 143   static int deflate_monitor_list(ObjectMonitor** listheadp,
 144                                   ObjectMonitor** freeHeadp,
 145                                   ObjectMonitor** freeTailp);
 146   static bool deflate_monitor(ObjectMonitor* mid, oop obj,
 147                               ObjectMonitor** freeHeadp,
 148                               ObjectMonitor** freeTailp);


< prev index next >