28 #include "oops/klass.inline.hpp" 29 #include "oops/markOop.hpp" 30 #include "oops/oop.inline.hpp" 31 #include "runtime/atomic.hpp" 32 #include "runtime/basicLock.hpp" 33 #include "runtime/biasedLocking.hpp" 34 #include "runtime/task.hpp" 35 #include "runtime/threadSMR.hpp" 36 #include "runtime/vframe.hpp" 37 #include "runtime/vmThread.hpp" 38 #include "runtime/vm_operations.hpp" 39 #include "trace/tracing.hpp" 40 41 static bool _biased_locking_enabled = false; 42 BiasedLockingCounters BiasedLocking::_counters; 43 44 static GrowableArray<Handle>* _preserved_oop_stack = NULL; 45 static GrowableArray<markOop>* _preserved_mark_stack = NULL; 46 47 static void enable_biased_locking(InstanceKlass* k) { 48 k->set_prototype_header(markOopDesc::biased_locking_prototype()); 49 } 50 51 class VM_EnableBiasedLocking: public VM_Operation { 52 private: 53 bool _is_cheap_allocated; 54 public: 55 VM_EnableBiasedLocking(bool is_cheap_allocated) { _is_cheap_allocated = is_cheap_allocated; } 56 VMOp_Type type() const { return VMOp_EnableBiasedLocking; } 57 Mode evaluation_mode() const { return _is_cheap_allocated ? _async_safepoint : _safepoint; } 58 bool is_cheap_allocated() const { return _is_cheap_allocated; } 59 60 void doit() { 61 // Iterate the class loader data dictionaries enabling biased locking for all 62 // currently loaded classes. 63 ClassLoaderDataGraph::dictionary_classes_do(enable_biased_locking); 64 // Indicate that future instances should enable it as well 65 _biased_locking_enabled = true; 66 67 log_info(biasedlocking)("Biased locking enabled"); 68 } | 28 #include "oops/klass.inline.hpp" 29 #include "oops/markOop.hpp" 30 #include "oops/oop.inline.hpp" 31 #include "runtime/atomic.hpp" 32 #include "runtime/basicLock.hpp" 33 #include "runtime/biasedLocking.hpp" 34 #include "runtime/task.hpp" 35 #include "runtime/threadSMR.hpp" 36 #include "runtime/vframe.hpp" 37 #include "runtime/vmThread.hpp" 38 #include "runtime/vm_operations.hpp" 39 #include "trace/tracing.hpp" 40 41 static bool _biased_locking_enabled = false; 42 BiasedLockingCounters BiasedLocking::_counters; 43 44 static GrowableArray<Handle>* _preserved_oop_stack = NULL; 45 static GrowableArray<markOop>* _preserved_mark_stack = NULL; 46 47 static void enable_biased_locking(InstanceKlass* k) { 48 if (!k->is_value()) { 49 k->set_prototype_header(markOopDesc::biased_locking_prototype()); 50 } 51 } 52 53 class VM_EnableBiasedLocking: public VM_Operation { 54 private: 55 bool _is_cheap_allocated; 56 public: 57 VM_EnableBiasedLocking(bool is_cheap_allocated) { _is_cheap_allocated = is_cheap_allocated; } 58 VMOp_Type type() const { return VMOp_EnableBiasedLocking; } 59 Mode evaluation_mode() const { return _is_cheap_allocated ? _async_safepoint : _safepoint; } 60 bool is_cheap_allocated() const { return _is_cheap_allocated; } 61 62 void doit() { 63 // Iterate the class loader data dictionaries enabling biased locking for all 64 // currently loaded classes. 65 ClassLoaderDataGraph::dictionary_classes_do(enable_biased_locking); 66 // Indicate that future instances should enable it as well 67 _biased_locking_enabled = true; 68 69 log_info(biasedlocking)("Biased locking enabled"); 70 } |