hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 38937 2bf3c37c4841
parent 38259 b495d1cfe673
child 39216 40c3d66352ae
equal deleted inserted replaced
38934:486eb871e215 38937:2bf3c37c4841
  1102 }
  1102 }
  1103 
  1103 
  1104 
  1104 
  1105 void InstanceKlass::mask_for(const methodHandle& method, int bci,
  1105 void InstanceKlass::mask_for(const methodHandle& method, int bci,
  1106   InterpreterOopMap* entry_for) {
  1106   InterpreterOopMap* entry_for) {
  1107   // Dirty read, then double-check under a lock.
  1107   // Lazily create the _oop_map_cache at first request
  1108   if (_oop_map_cache == NULL) {
  1108   // Lock-free access requires load_ptr_acquire.
  1109     // Otherwise, allocate a new one.
  1109   OopMapCache* oop_map_cache =
       
  1110       static_cast<OopMapCache*>(OrderAccess::load_ptr_acquire(&_oop_map_cache));
       
  1111   if (oop_map_cache == NULL) {
  1110     MutexLocker x(OopMapCacheAlloc_lock);
  1112     MutexLocker x(OopMapCacheAlloc_lock);
  1111     // First time use. Allocate a cache in C heap
  1113     // Check if _oop_map_cache was allocated while we were waiting for this lock
  1112     if (_oop_map_cache == NULL) {
  1114     if ((oop_map_cache = _oop_map_cache) == NULL) {
  1113       // Release stores from OopMapCache constructor before assignment
  1115       oop_map_cache = new OopMapCache();
  1114       // to _oop_map_cache. C++ compilers on ppc do not emit the
  1116       // Ensure _oop_map_cache is stable, since it is examined without a lock
  1115       // required memory barrier only because of the volatile
  1117       OrderAccess::release_store_ptr(&_oop_map_cache, oop_map_cache);
  1116       // qualifier of _oop_map_cache.
  1118     }
  1117       OrderAccess::release_store_ptr(&_oop_map_cache, new OopMapCache());
  1119   }
  1118     }
  1120   // _oop_map_cache is constant after init; lookup below does its own locking.
  1119   }
  1121   oop_map_cache->lookup(method, bci, entry_for);
  1120   // _oop_map_cache is constant after init; lookup below does is own locking.
       
  1121   _oop_map_cache->lookup(method, bci, entry_for);
       
  1122 }
  1122 }
  1123 
  1123 
  1124 
  1124 
  1125 bool InstanceKlass::find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
  1125 bool InstanceKlass::find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
  1126   for (JavaFieldStream fs(this); !fs.done(); fs.next()) {
  1126   for (JavaFieldStream fs(this); !fs.done(); fs.next()) {