hotspot/src/share/vm/runtime/biasedLocking.cpp
changeset 231 3cfeeae32993
parent 1 489c9b5090e2
child 257 229330365385
equal deleted inserted replaced
230:b4ebad8ef528 231:3cfeeae32993
    36   Klass::cast(k)->set_prototype_header(markOopDesc::biased_locking_prototype());
    36   Klass::cast(k)->set_prototype_header(markOopDesc::biased_locking_prototype());
    37 }
    37 }
    38 
    38 
    39 class VM_EnableBiasedLocking: public VM_Operation {
    39 class VM_EnableBiasedLocking: public VM_Operation {
    40  public:
    40  public:
    41   VM_EnableBiasedLocking() {}
    41   VM_EnableBiasedLocking()        {}
    42   VMOp_Type type() const   { return VMOp_EnableBiasedLocking; }
    42   VMOp_Type type() const          { return VMOp_EnableBiasedLocking; }
       
    43   Mode evaluation_mode() const    { return _async_safepoint; }
       
    44   bool is_cheap_allocated() const { return true; }
       
    45 
    43   void doit() {
    46   void doit() {
    44     // Iterate the system dictionary enabling biased locking for all
    47     // Iterate the system dictionary enabling biased locking for all
    45     // currently loaded classes
    48     // currently loaded classes
    46     SystemDictionary::classes_do(enable_biased_locking);
    49     SystemDictionary::classes_do(enable_biased_locking);
    47     // Indicate that future instances should enable it as well
    50     // Indicate that future instances should enable it as well
    60 class EnableBiasedLockingTask : public PeriodicTask {
    63 class EnableBiasedLockingTask : public PeriodicTask {
    61  public:
    64  public:
    62   EnableBiasedLockingTask(size_t interval_time) : PeriodicTask(interval_time) {}
    65   EnableBiasedLockingTask(size_t interval_time) : PeriodicTask(interval_time) {}
    63 
    66 
    64   virtual void task() {
    67   virtual void task() {
    65     VM_EnableBiasedLocking op;
    68     // Use async VM operation to avoid blocking the Watcher thread.
    66     VMThread::execute(&op);
    69     // VM Thread will free C heap storage.
       
    70     VM_EnableBiasedLocking *op = new VM_EnableBiasedLocking();
       
    71     VMThread::execute(op);
    67 
    72 
    68     // Reclaim our storage and disenroll ourself
    73     // Reclaim our storage and disenroll ourself
    69     delete this;
    74     delete this;
    70   }
    75   }
    71 };
    76 };