< prev index next >

src/hotspot/share/runtime/biasedLocking.hpp

Print this page




 151 class BiasedLocking : AllStatic {
 152 friend class VM_BulkRevokeBias;
 153 friend class RevokeOneBias;
 154 
 155 private:
 156   static BiasedLockingCounters _counters;
 157 
 158 public:
 159   static int* total_entry_count_addr();
 160   static int* biased_lock_entry_count_addr();
 161   static int* anonymously_biased_lock_entry_count_addr();
 162   static int* rebiased_lock_entry_count_addr();
 163   static int* revoked_lock_entry_count_addr();
 164   static int* handshakes_count_addr();
 165   static int* fast_path_entry_count_addr();
 166   static int* slow_path_entry_count_addr();
 167 
 168   enum Condition {
 169     NOT_BIASED = 1,
 170     BIAS_REVOKED = 2,
 171     BIAS_REVOKED_AND_REBIASED = 3,
 172     NOT_REVOKED = 4
 173   };
 174 
 175 private:
 176   static Condition single_revoke_at_safepoint(oop obj, bool allow_rebias, bool is_bulk, JavaThread* requester, JavaThread** biaser);
 177   static Condition bulk_revoke_or_rebias_at_safepoint(oop o, bool bulk_rebias, bool attempt_rebias, JavaThread* requester);
 178   static Condition single_revoke_with_handshake(Handle obj, JavaThread *requester, JavaThread *biaser);
 179   static void walk_stack_and_revoke(oop obj, JavaThread* biased_locker);
 180 
 181 public:
 182   // This initialization routine should only be called once and
 183   // schedules a PeriodicTask to turn on biased locking a few seconds
 184   // into the VM run to avoid startup time regressions
 185   static void init();
 186 
 187   // This provides a global switch for leaving biased locking disabled
 188   // for the first part of a run and enabling it later
 189   static bool enabled();
 190 
 191   // This should be called by JavaThreads to revoke the bias of an object
 192   static Condition revoke_and_rebias(Handle obj, bool attempt_rebias, TRAPS);
 193 
 194   // These do not allow rebiasing; they are used by deoptimization to
 195   // ensure that monitors on the stack can be migrated
 196   static void revoke(GrowableArray<Handle>* objs, JavaThread *biaser);
 197   static void revoke_at_safepoint(Handle obj);




 198   static void revoke_at_safepoint(GrowableArray<Handle>* objs);
 199 
 200   static void print_counters() { _counters.print(); }
 201   static BiasedLockingCounters* counters() { return &_counters; }
 202 
 203   // These routines are GC-related and should not be called by end
 204   // users. GCs which do not do preservation of mark words do not need
 205   // to call these routines.
 206   static void preserve_marks();
 207   static void restore_marks();
 208 };
 209 
 210 #endif // SHARE_RUNTIME_BIASEDLOCKING_HPP


 151 class BiasedLocking : AllStatic {
 152 friend class VM_BulkRevokeBias;
 153 friend class RevokeOneBias;
 154 
 155 private:
 156   static BiasedLockingCounters _counters;
 157 
 158 public:
 159   static int* total_entry_count_addr();
 160   static int* biased_lock_entry_count_addr();
 161   static int* anonymously_biased_lock_entry_count_addr();
 162   static int* rebiased_lock_entry_count_addr();
 163   static int* revoked_lock_entry_count_addr();
 164   static int* handshakes_count_addr();
 165   static int* fast_path_entry_count_addr();
 166   static int* slow_path_entry_count_addr();
 167 
 168   enum Condition {
 169     NOT_BIASED = 1,
 170     BIAS_REVOKED = 2,
 171     NOT_REVOKED = 3

 172   };
 173 
 174 private:
 175   static void single_revoke_at_safepoint(oop obj, bool is_bulk, JavaThread* requester, JavaThread** biaser);
 176   static void bulk_revoke_at_safepoint(oop o, bool bulk_rebias, JavaThread* requester);
 177   static Condition single_revoke_with_handshake(Handle obj, JavaThread *requester, JavaThread *biaser);
 178   static void walk_stack_and_revoke(oop obj, JavaThread* biased_locker);
 179 
 180 public:
 181   // This initialization routine should only be called once and
 182   // schedules a PeriodicTask to turn on biased locking a few seconds
 183   // into the VM run to avoid startup time regressions
 184   static void init();
 185 
 186   // This provides a global switch for leaving biased locking disabled
 187   // for the first part of a run and enabling it later
 188   static bool enabled();
 189 
 190   // This should be called by JavaThreads to revoke the bias of an object
 191   static void revoke(Handle obj, TRAPS);
 192 



 193   static void revoke_at_safepoint(Handle obj);
 194 
 195   // These are used by deoptimization to ensure that monitors on the stack
 196   // can be migrated
 197   static void revoke(GrowableArray<Handle>* objs, JavaThread *biaser);
 198   static void revoke_at_safepoint(GrowableArray<Handle>* objs);
 199 
 200   static void print_counters() { _counters.print(); }
 201   static BiasedLockingCounters* counters() { return &_counters; }
 202 
 203   // These routines are GC-related and should not be called by end
 204   // users. GCs which do not do preservation of mark words do not need
 205   // to call these routines.
 206   static void preserve_marks();
 207   static void restore_marks();
 208 };
 209 
 210 #endif // SHARE_RUNTIME_BIASEDLOCKING_HPP
< prev index next >