--- old/src/hotspot/share/classfile/javaClasses.cpp 2020-07-22 12:00:27.691654366 -0700 +++ new/src/hotspot/share/classfile/javaClasses.cpp 2020-07-22 12:00:27.503647289 -0700 @@ -139,9 +139,9 @@ // Helpful routine for computing field offsets at run time rather than hardcoding them // Finds local fields only, including static fields. Static field offsets are from the // beginning of the mirror. -static void compute_offset(int &dest_offset, - InstanceKlass* ik, Symbol* name_symbol, Symbol* signature_symbol, - bool is_static = false) { +void JavaClasses::compute_offset(int &dest_offset, + InstanceKlass* ik, Symbol* name_symbol, Symbol* signature_symbol, + bool is_static) { fieldDescriptor fd; if (ik == NULL) { ResourceMark rm; @@ -165,9 +165,9 @@ } // Overloading to pass name as a string. -static void compute_offset(int& dest_offset, InstanceKlass* ik, - const char* name_string, Symbol* signature_symbol, - bool is_static = false) { +void JavaClasses::compute_offset(int& dest_offset, InstanceKlass* ik, + const char* name_string, Symbol* signature_symbol, + bool is_static) { TempNewSymbol name = SymbolTable::probe(name_string, (int)strlen(name_string)); if (name == NULL) { ResourceMark rm; @@ -184,7 +184,7 @@ #endif #define FIELD_COMPUTE_OFFSET(offset, klass, name, signature, is_static) \ - compute_offset(offset, klass, name, vmSymbols::signature(), is_static) + JavaClasses::compute_offset(offset, klass, name, vmSymbols::signature(), is_static) // java_lang_String @@ -3413,12 +3413,17 @@ module->obj_field_put(_name_offset, value); } -ModuleEntry* java_lang_Module::module_entry(oop module) { +ModuleEntry* java_lang_Module::module_entry_raw(oop module) { assert(_module_entry_offset != 0, "Uninitialized module_entry_offset"); assert(module != NULL, "module can't be null"); assert(oopDesc::is_oop(module), "module must be oop"); ModuleEntry* module_entry = (ModuleEntry*)module->address_field(_module_entry_offset); + return module_entry; +} + +ModuleEntry* java_lang_Module::module_entry(oop module) { + ModuleEntry* module_entry = module_entry_raw(module); if (module_entry == NULL) { // If the inject field containing the ModuleEntry* is null then return the // class loader's unnamed module. @@ -4842,7 +4847,6 @@ Klass* klass = obj->klass(); if (klass == SystemDictionary::ClassLoader_klass() || // ClassLoader::loader_data is malloc'ed. - klass == SystemDictionary::Module_klass() || // Module::module_entry is malloc'ed // The next 3 classes are used to implement java.lang.invoke, and are not used directly in // regular Java code. The implementation of java.lang.invoke uses generated anonymoys classes // (e.g., as referenced by ResolvedMethodName::vmholder) that are not yet supported by CDS.