< prev index next >

src/hotspot/share/classfile/javaClasses.cpp

Print this page
rev 58760 : 8238358: Implementation of JEP 371: Hidden Classes
Reviewed-by: alanb, cjplummer, coleenp, dholmes, dlong, forax, jlahoda, psandoz, plevart, vromero
Contributed-by: mandy.chung@oracle.com, lois.foltan@oracle.com, david.holmes@oracle.com, harold.seigel@oracle.com, serguei.spitsyn@oracle.com, alex.buckley@oracle.com, jamsheed.c.m@oracle.com, jan.lahoda@oracle.com, amy.lu@oracle.com

*** 850,865 **** } else { k->set_java_mirror_handle(NULL); k->clear_has_raw_archived_mirror(); } } ! create_mirror(k, Handle(), Handle(), Handle(), CHECK); } void java_lang_Class::initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain, TRAPS) { // Allocate a simple java object for a lock. // This needs to be a java object because during class initialization // it can be held across a java call. typeArrayOop r = oopFactory::new_typeArray(T_INT, 0, CHECK); --- 850,866 ---- } else { k->set_java_mirror_handle(NULL); k->clear_has_raw_archived_mirror(); } } ! create_mirror(k, Handle(), Handle(), Handle(), Handle(), CHECK); } void java_lang_Class::initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain, + Handle classData, TRAPS) { // Allocate a simple java object for a lock. // This needs to be a java object because during class initialization // it can be held across a java call. typeArrayOop r = oopFactory::new_typeArray(T_INT, 0, CHECK);
*** 868,877 **** --- 869,881 ---- // Set protection domain also set_protection_domain(mirror(), protection_domain()); // Initialize static fields InstanceKlass::cast(k)->do_local_static_fields(&initialize_static_field, mirror, CHECK); + + // Set classData + set_class_data(mirror(), classData()); } // Set the java.lang.Module module field in the java_lang_Class mirror void java_lang_Class::set_mirror_module_field(Klass* k, Handle mirror, Handle module, TRAPS) { if (module.is_null()) {
*** 921,931 **** new (ResourceObj::C_HEAP, mtModule) GrowableArray<Klass*>(500, true); set_fixup_module_field_list(module_list); } void java_lang_Class::create_mirror(Klass* k, Handle class_loader, ! Handle module, Handle protection_domain, TRAPS) { assert(k != NULL, "Use create_basic_type_mirror for primitive types"); assert(k->java_mirror() == NULL, "should only assign mirror once"); // Use this moment of initialization to cache modifier_flags also, // to support Class.getModifiers(). Instance classes recalculate --- 925,936 ---- new (ResourceObj::C_HEAP, mtModule) GrowableArray<Klass*>(500, true); set_fixup_module_field_list(module_list); } void java_lang_Class::create_mirror(Klass* k, Handle class_loader, ! Handle module, Handle protection_domain, ! Handle classData, TRAPS) { assert(k != NULL, "Use create_basic_type_mirror for primitive types"); assert(k->java_mirror() == NULL, "should only assign mirror once"); // Use this moment of initialization to cache modifier_flags also, // to support Class.getModifiers(). Instance classes recalculate
*** 968,978 **** // See below for ordering dependencies between field array_klass in component mirror // and java_mirror in this klass. } else { assert(k->is_instance_klass(), "Must be"); ! initialize_mirror_fields(k, mirror, protection_domain, THREAD); if (HAS_PENDING_EXCEPTION) { // If any of the fields throws an exception like OOM remove the klass field // from the mirror so GC doesn't follow it after the klass has been deallocated. // This mirror looks like a primitive type, which logically it is because it // it represents no class. --- 973,983 ---- // See below for ordering dependencies between field array_klass in component mirror // and java_mirror in this klass. } else { assert(k->is_instance_klass(), "Must be"); ! initialize_mirror_fields(k, mirror, protection_domain, classData, THREAD); if (HAS_PENDING_EXCEPTION) { // If any of the fields throws an exception like OOM remove the klass field // from the mirror so GC doesn't follow it after the klass has been deallocated. // This mirror looks like a primitive type, which logically it is because it // it represents no class.
*** 1395,1404 **** --- 1400,1417 ---- void java_lang_Class::set_signers(oop java_class, objArrayOop signers) { assert(_signers_offset != 0, "must be set"); java_class->obj_field_put(_signers_offset, (oop)signers); } + oop java_lang_Class::class_data(oop java_class) { + assert(_classData_offset != 0, "must be set"); + return java_class->obj_field(_classData_offset); + } + void java_lang_Class::set_class_data(oop java_class, oop class_data) { + assert(_classData_offset != 0, "must be set"); + java_class->obj_field_put(_classData_offset, class_data); + } void java_lang_Class::set_class_loader(oop java_class, oop loader) { assert(_class_loader_offset != 0, "offsets should have been initialized"); java_class->obj_field_put(_class_loader_offset, loader); }
*** 1598,1607 **** --- 1611,1621 ---- macro(classRedefinedCount_offset, k, "classRedefinedCount", int_signature, false); \ macro(_class_loader_offset, k, "classLoader", classloader_signature, false); \ macro(_component_mirror_offset, k, "componentType", class_signature, false); \ macro(_module_offset, k, "module", module_signature, false); \ macro(_name_offset, k, "name", string_signature, false); \ + macro(_classData_offset, k, "classData", object_signature, false); void java_lang_Class::compute_offsets() { if (offsets_computed) { return; }
*** 4266,4275 **** --- 4280,4290 ---- int java_lang_Class::_component_mirror_offset; int java_lang_Class::_init_lock_offset; int java_lang_Class::_signers_offset; int java_lang_Class::_name_offset; int java_lang_Class::_source_file_offset; + int java_lang_Class::_classData_offset; GrowableArray<Klass*>* java_lang_Class::_fixup_mirror_list = NULL; GrowableArray<Klass*>* java_lang_Class::_fixup_module_field_list = NULL; int java_lang_Throwable::backtrace_offset; int java_lang_Throwable::detailMessage_offset; int java_lang_Throwable::stackTrace_offset;
< prev index next >