< prev index next >

src/hotspot/share/runtime/biasedLocking.cpp

Print this page




  32 #include "oops/markOop.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "runtime/atomic.hpp"
  35 #include "runtime/basicLock.hpp"
  36 #include "runtime/biasedLocking.hpp"
  37 #include "runtime/handles.inline.hpp"
  38 #include "runtime/task.hpp"
  39 #include "runtime/threadSMR.hpp"
  40 #include "runtime/vframe.hpp"
  41 #include "runtime/vmThread.hpp"
  42 #include "runtime/vmOperations.hpp"
  43 
  44 
  45 static bool _biased_locking_enabled = false;
  46 BiasedLockingCounters BiasedLocking::_counters;
  47 
  48 static GrowableArray<Handle>*  _preserved_oop_stack  = NULL;
  49 static GrowableArray<markOop>* _preserved_mark_stack = NULL;
  50 
  51 static void enable_biased_locking(InstanceKlass* k) {
  52   k->set_prototype_header(markOopDesc::biased_locking_prototype());


  53 }
  54 
  55 class VM_EnableBiasedLocking: public VM_Operation {
  56  private:
  57   bool _is_cheap_allocated;
  58  public:
  59   VM_EnableBiasedLocking(bool is_cheap_allocated) { _is_cheap_allocated = is_cheap_allocated; }
  60   VMOp_Type type() const          { return VMOp_EnableBiasedLocking; }
  61   Mode evaluation_mode() const    { return _is_cheap_allocated ? _async_safepoint : _safepoint; }
  62   bool is_cheap_allocated() const { return _is_cheap_allocated; }
  63 
  64   void doit() {
  65     // Iterate the class loader data dictionaries enabling biased locking for all
  66     // currently loaded classes.
  67     ClassLoaderDataGraph::dictionary_classes_do(enable_biased_locking);
  68     // Indicate that future instances should enable it as well
  69     _biased_locking_enabled = true;
  70 
  71     log_info(biasedlocking)("Biased locking enabled");
  72   }




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


< prev index next >