@@ -867,6 +867,7 @@ int java_lang_Class::_source_file_offset;
867867int java_lang_Class::_classData_offset;
868868int java_lang_Class::_classRedefinedCount_offset;
869869int java_lang_Class::_reflectionData_offset;
870+ int java_lang_Class::_modifiers_offset;
870871
871872bool java_lang_Class::_offsets_computed = false ;
872873GrowableArray<Klass*>* java_lang_Class::_fixup_mirror_list = nullptr ;
@@ -1060,6 +1061,10 @@ void java_lang_Class::allocate_mirror(Klass* k, bool is_scratch, Handle protecti
10601061 // Setup indirection from mirror->klass
10611062 set_klass (mirror (), k);
10621063
1064+ // Set the modifiers flag.
1065+ int computed_modifiers = k->compute_modifier_flags ();
1066+ set_modifiers (mirror (), computed_modifiers);
1067+
10631068 InstanceMirrorKlass* mk = InstanceMirrorKlass::cast (mirror->klass ());
10641069 assert (oop_size (mirror ()) == mk->instance_size (k), " should have been set" );
10651070
@@ -1355,6 +1360,7 @@ oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, Basic
13551360 InstanceMirrorKlass* mk = InstanceMirrorKlass::cast (vmClasses::Class_klass ());
13561361 assert (static_oop_field_count (java_class) == 0 , " should have been zeroed by allocation" );
13571362#endif
1363+ set_modifiers (java_class, JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC);
13581364 return java_class;
13591365}
13601366
@@ -1493,7 +1499,8 @@ oop java_lang_Class::primitive_mirror(BasicType t) {
14931499 macro (_name_offset, k, " name" , string_signature, false ); \
14941500 macro (_classData_offset, k, " classData" , object_signature, false ); \
14951501 macro (_reflectionData_offset, k, " reflectionData" , java_lang_ref_SoftReference_signature, false ); \
1496- macro (_signers_offset, k, " signers" , object_array_signature, false );
1502+ macro (_signers_offset, k, " signers" , object_array_signature, false ); \
1503+ macro (_modifiers_offset, k, vmSymbols::modifiers_name(), int_signature, false);
14971504
14981505void java_lang_Class::compute_offsets () {
14991506 if (_offsets_computed) {
@@ -1527,6 +1534,16 @@ void java_lang_Class::set_classRedefinedCount(oop the_class_mirror, int value) {
15271534 the_class_mirror->int_field_put (_classRedefinedCount_offset, value);
15281535}
15291536
1537+ int java_lang_Class::modifiers (oop the_class_mirror) {
1538+ assert (_modifiers_offset != 0 , " offsets should have been initialized" );
1539+ return the_class_mirror->int_field (_modifiers_offset);
1540+ }
1541+
1542+ void java_lang_Class::set_modifiers (oop the_class_mirror, int value) {
1543+ assert (_modifiers_offset != 0 , " offsets should have been initialized" );
1544+ the_class_mirror->int_field_put (_modifiers_offset, value);
1545+ }
1546+
15301547
15311548// Note: JDK1.1 and before had a privateInfo_offset field which was used for the
15321549// platform thread structure, and a eetop offset which was used for thread
0 commit comments