diff --git a/src/cpu/x86/vm/interp_masm_x86_64.cpp b/src/cpu/x86/vm/interp_masm_x86_64.cpp --- a/src/cpu/x86/vm/interp_masm_x86_64.cpp +++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp @@ -296,9 +296,11 @@ get_constant_pool(result); // load pointer for resolved_references[] objArray - movptr(result, Address(result, ConstantPool::resolved_references_offset_in_bytes())); - // JNIHandles::resolve(obj); - movptr(result, Address(result, 0)); + movptr(result, Address(result, ConstantPool::pool_holder_offset_in_bytes())); + // get java_mirror (not compressed) + movptr(result, Address(result, in_bytes(Klass::java_mirror_offset()))); + // get resolved_references array + load_heap_oop(result, Address(result, java_lang_Class::resolved_references_offset_in_bytes())); // Add in the index addptr(result, tmp); load_heap_oop(result, Address(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT))); diff --git a/src/share/vm/classfile/classLoaderData.hpp b/src/share/vm/classfile/classLoaderData.hpp --- a/src/share/vm/classfile/classLoaderData.hpp +++ b/src/share/vm/classfile/classLoaderData.hpp @@ -146,7 +146,7 @@ // Has to be an int because we cas it. Klass* _klasses; // The classes defined by the class loader. - JNIHandleBlock* _handles; // Handles to constant pool arrays + JNIHandleBlock* _handles; // Handles to mirrors // These method IDs are created for the class loader and set to NULL when the // class loader is unloaded. They are rarely freed, only for redefine classes diff --git a/src/share/vm/classfile/javaClasses.cpp b/src/share/vm/classfile/javaClasses.cpp --- a/src/share/vm/classfile/javaClasses.cpp +++ b/src/share/vm/classfile/javaClasses.cpp @@ -648,6 +648,15 @@ java_class->obj_field_put(_init_lock_offset, init_lock); } +objArrayOop java_lang_Class::resolved_references(oop java_class) { + assert(_resolved_references_offset != 0, "must be set"); + return (objArrayOop)java_class->obj_field(_resolved_references_offset); +} +void java_lang_Class::set_resolved_references(oop java_class, objArrayOop refs) { + assert(_resolved_references_offset != 0, "must be set"); + java_class->obj_field_put(_resolved_references_offset, (oop)refs); +} + objArrayOop java_lang_Class::signers(oop java_class) { assert(_signers_offset != 0, "must be set"); return (objArrayOop)java_class->obj_field(_signers_offset); @@ -3058,7 +3067,9 @@ int java_lang_Class::_static_oop_field_count_offset; int java_lang_Class::_protection_domain_offset; int java_lang_Class::_init_lock_offset; +int java_lang_Class::_resolved_references_offset; int java_lang_Class::_signers_offset; +int java_lang_Class::resolved_references_offset; // Hard coded setting GrowableArray* java_lang_Class::_fixup_mirror_list = NULL; int java_lang_Throwable::backtrace_offset; int java_lang_Throwable::detailMessage_offset; @@ -3253,6 +3264,8 @@ java_lang_AssertionStatusDirectives::packageEnabled_offset = java_lang_AssertionStatusDirectives::hc_packageEnabled_offset * x + header; java_lang_AssertionStatusDirectives::deflt_offset = java_lang_AssertionStatusDirectives::hc_deflt_offset * x + header; + // java_lang_Class + java_lang_Class::resolved_references_offset = java_lang_Class::hc_resolved_references_offset * x + header; } @@ -3410,9 +3423,8 @@ // java.lang.Class - // Fake fields - // CHECK_OFFSET("java/lang/Class", java_lang_Class, klass); // %%% this needs to be checked - // CHECK_OFFSET("java/lang/Class", java_lang_Class, array_klass); // %%% this needs to be checked + // Fake field for resolved_reference array which is also used as the init_lock + valid &= (java_lang_Class::resolved_references_offset == java_lang_Class::_resolved_references_offset); // java.lang.Throwable diff --git a/src/share/vm/classfile/javaClasses.hpp b/src/share/vm/classfile/javaClasses.hpp --- a/src/share/vm/classfile/javaClasses.hpp +++ b/src/share/vm/classfile/javaClasses.hpp @@ -212,6 +212,7 @@ macro(java_lang_Class, static_oop_field_count, int_signature, false) \ macro(java_lang_Class, protection_domain, object_signature, false) \ macro(java_lang_Class, init_lock, object_signature, false) \ + macro(java_lang_Class, resolved_references, object_signature, false) \ macro(java_lang_Class, signers, object_signature, false) class java_lang_Class : AllStatic { @@ -219,6 +220,10 @@ private: // The fake offsets are added by the class loader when java.lang.Class is loaded + // We need this one for code generation. + enum { + hc_resolved_references_offset = 12 + }; static int _klass_offset; static int _array_klass_offset; @@ -228,10 +233,12 @@ static int _protection_domain_offset; static int _init_lock_offset; + static int _resolved_references_offset; static int _signers_offset; static bool offsets_computed; static int classRedefinedCount_offset; + static int resolved_references_offset; // hardcoded offset static GrowableArray* _fixup_mirror_list; static void set_init_lock(oop java_class, oop init_lock); @@ -268,6 +275,10 @@ // compiler support for class operations static int klass_offset_in_bytes() { return _klass_offset; } static int array_klass_offset_in_bytes() { return _array_klass_offset; } + static int resolved_references_offset_in_bytes() { + assert(resolved_references_offset != 0, "should be calculated already"); + return resolved_references_offset; + } // Support for classRedefinedCount field static int classRedefinedCount(oop the_class_mirror); static void set_classRedefinedCount(oop the_class_mirror, int value); @@ -277,6 +288,8 @@ static oop init_lock(oop java_class); static objArrayOop signers(oop java_class); static void set_signers(oop java_class, objArrayOop signers); + static objArrayOop resolved_references(oop java_class); + static void set_resolved_references(oop java_class, objArrayOop resolved_refs); static int oop_size(oop java_class); static void set_oop_size(oop java_class, int size); diff --git a/src/share/vm/classfile/vmSymbols.hpp b/src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp +++ b/src/share/vm/classfile/vmSymbols.hpp @@ -394,6 +394,7 @@ template(static_oop_field_count_name, "static_oop_field_count") \ template(protection_domain_name, "protection_domain") \ template(init_lock_name, "init_lock") \ + template(resolved_references_name, "resolved_references") \ template(signers_name, "signers_name") \ template(loader_data_name, "loader_data") \ template(dependencies_name, "dependencies") \ diff --git a/src/share/vm/interpreter/interpreter.cpp b/src/share/vm/interpreter/interpreter.cpp --- a/src/share/vm/interpreter/interpreter.cpp +++ b/src/share/vm/interpreter/interpreter.cpp @@ -64,7 +64,7 @@ void InterpreterCodelet::print_on(outputStream* st) const { ttyLocker ttyl; - if (PrintInterpreter) { + if (PrintInterpreter && Verbose) { st->cr(); st->print_cr("----------------------------------------------------------------------"); } @@ -74,7 +74,7 @@ st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "] %d bytes", code_begin(), code_end(), code_size()); - if (PrintInterpreter) { + if (PrintInterpreter && Verbose) { st->cr(); Disassembler::decode(code_begin(), code_end(), st, DEBUG_ONLY(_strings) NOT_DEBUG(CodeStrings())); } diff --git a/src/share/vm/oops/constantPool.cpp b/src/share/vm/oops/constantPool.cpp --- a/src/share/vm/oops/constantPool.cpp +++ b/src/share/vm/oops/constantPool.cpp @@ -62,7 +62,6 @@ set_tags(NULL); set_cache(NULL); set_reference_map(NULL); - set_resolved_references(NULL); set_operands(NULL); set_pool_holder(NULL); set_flags(0); @@ -101,7 +100,7 @@ } objArrayOop ConstantPool::resolved_references() const { - return (objArrayOop)JNIHandles::resolve(_resolved_references); + return java_lang_Class::resolved_references(pool_holder()->java_mirror()); } // Create resolved_references array and mapping array for original cp indexes @@ -133,8 +132,7 @@ // Create Java array for holding resolved strings, methodHandles, // methodTypes, invokedynamic and invokehandle appendix objects, etc. objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK); - Handle refs_handle (THREAD, (oop)stom); // must handleize. - set_resolved_references(loader_data->add_handle(refs_handle)); + java_lang_Class::set_resolved_references(pool_holder()->java_mirror(), stom); } } @@ -149,10 +147,7 @@ int map_length = resolved_reference_length(); if (map_length > 0) { objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK); - Handle refs_handle (THREAD, (oop)stom); // must handleize. - - ClassLoaderData* loader_data = pool_holder()->class_loader_data(); - set_resolved_references(loader_data->add_handle(refs_handle)); + java_lang_Class::set_resolved_references(pool_holder()->java_mirror(), stom); } // Also need to recreate the mutex. Make sure this matches the constructor @@ -166,7 +161,6 @@ // as reference_map.length() if invokedynamic is saved. set_resolved_reference_length( resolved_references() != NULL ? resolved_references()->length() : 0); - set_resolved_references(NULL); set_lock(NULL); } diff --git a/src/share/vm/oops/constantPool.hpp b/src/share/vm/oops/constantPool.hpp --- a/src/share/vm/oops/constantPool.hpp +++ b/src/share/vm/oops/constantPool.hpp @@ -91,9 +91,8 @@ InstanceKlass* _pool_holder; // the corresponding class Array* _operands; // for variable-sized (InvokeDynamic) nodes, usually empty - // Array of resolved objects from the constant pool and map from resolved - // object index to original constant pool index - jobject _resolved_references; + // Array of resolved objects from the constant pool (stored in the mirror) + // and map from resolved object index to original constant pool index Array* _reference_map; enum { @@ -231,7 +230,6 @@ static int tags_offset_in_bytes() { return offset_of(ConstantPool, _tags); } static int cache_offset_in_bytes() { return offset_of(ConstantPool, _cache); } static int pool_holder_offset_in_bytes() { return offset_of(ConstantPool, _pool_holder); } - static int resolved_references_offset_in_bytes() { return offset_of(ConstantPool, _resolved_references); } // Storing constants @@ -785,7 +783,6 @@ private: - void set_resolved_references(jobject s) { _resolved_references = s; } Array* reference_map() const { return _reference_map; } void set_reference_map(Array* o) { _reference_map = o; } diff --git a/src/share/vm/runtime/vmStructs.cpp b/src/share/vm/runtime/vmStructs.cpp --- a/src/share/vm/runtime/vmStructs.cpp +++ b/src/share/vm/runtime/vmStructs.cpp @@ -282,7 +282,6 @@ nonstatic_field(ConstantPool, _pool_holder, InstanceKlass*) \ nonstatic_field(ConstantPool, _operands, Array*) \ nonstatic_field(ConstantPool, _length, int) \ - nonstatic_field(ConstantPool, _resolved_references, jobject) \ nonstatic_field(ConstantPool, _reference_map, Array*) \ nonstatic_field(ConstantPoolCache, _length, int) \ nonstatic_field(ConstantPoolCache, _constant_pool, ConstantPool*) \