8158854: Ensure release_store is paired with load_acquire in lock-free code

Reviewed-by: shade, dcubed, zgu
This commit is contained in:
David Holmes 2016-08-29 20:13:45 -04:00
parent 56ff858c45
commit 6db26ca5bf
10 changed files with 87 additions and 23 deletions

View file

@ -148,7 +148,7 @@ class InstanceKlass: public Klass {
// Package this class is defined in
PackageEntry* _package_entry;
// Array classes holding elements of this class.
Klass* _array_klasses;
Klass* volatile _array_klasses;
// Constant pool for this class.
ConstantPool* _constants;
// The InnerClasses attribute and EnclosingMethod attribute. The
@ -230,7 +230,7 @@ class InstanceKlass: public Klass {
OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily)
MemberNameTable* _member_names; // Member names
JNIid* _jni_ids; // First JNI identifier for static fields in this class
jmethodID* _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or NULL if none
jmethodID* volatile _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or NULL if none
intptr_t _dep_context; // packed DependencyContext structure
nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class
#if INCLUDE_JVMTI
@ -368,7 +368,9 @@ class InstanceKlass: public Klass {
// array klasses
Klass* array_klasses() const { return _array_klasses; }
inline Klass* array_klasses_acquire() const; // load with acquire semantics
void set_array_klasses(Klass* k) { _array_klasses = k; }
inline void release_set_array_klasses(Klass* k); // store with release semantics
// methods
Array<Method*>* methods() const { return _methods; }
@ -1238,10 +1240,8 @@ private:
// cache management logic if the caches can grow instead of just
// going from NULL to non-NULL.
bool idnum_can_increment() const { return has_been_redefined(); }
jmethodID* methods_jmethod_ids_acquire() const
{ return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids); }
void release_set_methods_jmethod_ids(jmethodID* jmeths)
{ OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths); }
inline jmethodID* methods_jmethod_ids_acquire() const;
inline void release_set_methods_jmethod_ids(jmethodID* jmeths);
// Lock during initialization
public: