< prev index next >

src/hotspot/share/code/compiledIC.cpp

Print this page




  35 #include "memory/metadataFactory.hpp"
  36 #include "memory/oopFactory.hpp"
  37 #include "memory/resourceArea.hpp"
  38 #include "memory/universe.hpp"
  39 #include "oops/method.inline.hpp"
  40 #include "oops/oop.inline.hpp"
  41 #include "oops/symbol.hpp"
  42 #include "runtime/handles.inline.hpp"
  43 #include "runtime/icache.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "runtime/stubRoutines.hpp"
  46 #include "utilities/events.hpp"
  47 
  48 
  49 // Every time a compiled IC is changed or its type is being accessed,
  50 // either the CompiledIC_lock must be set or we must be at a safe point.
  51 
  52 CompiledICLocker::CompiledICLocker(CompiledMethod* method)
  53   : _method(method),
  54     _behaviour(CompiledICProtectionBehaviour::current()),
  55     _locked(_behaviour->lock(_method)),
  56     _nsv(true, !SafepointSynchronize::is_at_safepoint()) {
  57 }
  58 
  59 CompiledICLocker::~CompiledICLocker() {
  60   if (_locked) {
  61     _behaviour->unlock(_method);
  62   }
  63 }
  64 
  65 bool CompiledICLocker::is_safe(CompiledMethod* method) {
  66   return CompiledICProtectionBehaviour::current()->is_safe(method);
  67 }
  68 
  69 bool CompiledICLocker::is_safe(address code) {
  70   CodeBlob* cb = CodeCache::find_blob_unsafe(code);
  71   assert(cb != NULL && cb->is_compiled(), "must be compiled");
  72   CompiledMethod* cm = cb->as_compiled_method();
  73   return CompiledICProtectionBehaviour::current()->is_safe(cm);
  74 }
  75 
  76 //-----------------------------------------------------------------------------




  35 #include "memory/metadataFactory.hpp"
  36 #include "memory/oopFactory.hpp"
  37 #include "memory/resourceArea.hpp"
  38 #include "memory/universe.hpp"
  39 #include "oops/method.inline.hpp"
  40 #include "oops/oop.inline.hpp"
  41 #include "oops/symbol.hpp"
  42 #include "runtime/handles.inline.hpp"
  43 #include "runtime/icache.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "runtime/stubRoutines.hpp"
  46 #include "utilities/events.hpp"
  47 
  48 
  49 // Every time a compiled IC is changed or its type is being accessed,
  50 // either the CompiledIC_lock must be set or we must be at a safe point.
  51 
  52 CompiledICLocker::CompiledICLocker(CompiledMethod* method)
  53   : _method(method),
  54     _behaviour(CompiledICProtectionBehaviour::current()),
  55     _locked(_behaviour->lock(_method)) {

  56 }
  57 
  58 CompiledICLocker::~CompiledICLocker() {
  59   if (_locked) {
  60     _behaviour->unlock(_method);
  61   }
  62 }
  63 
  64 bool CompiledICLocker::is_safe(CompiledMethod* method) {
  65   return CompiledICProtectionBehaviour::current()->is_safe(method);
  66 }
  67 
  68 bool CompiledICLocker::is_safe(address code) {
  69   CodeBlob* cb = CodeCache::find_blob_unsafe(code);
  70   assert(cb != NULL && cb->is_compiled(), "must be compiled");
  71   CompiledMethod* cm = cb->as_compiled_method();
  72   return CompiledICProtectionBehaviour::current()->is_safe(cm);
  73 }
  74 
  75 //-----------------------------------------------------------------------------


< prev index next >