@@ -990,7 +990,7 @@ void java_lang_Class::fixup_mirror(Klass* k, TRAPS) {
990990 create_mirror (k, Handle (), Handle (), Handle (), Handle (), CHECK);
991991}
992992
993- void java_lang_Class::initialize_mirror_fields (Klass* k ,
993+ void java_lang_Class::initialize_mirror_fields (InstanceKlass* ik ,
994994 Handle mirror,
995995 Handle protection_domain,
996996 Handle classData,
@@ -1005,7 +1005,7 @@ void java_lang_Class::initialize_mirror_fields(Klass* k,
10051005 set_protection_domain (mirror (), protection_domain ());
10061006
10071007 // Initialize static fields
1008- InstanceKlass::cast (k) ->do_local_static_fields (&initialize_static_field, mirror, CHECK);
1008+ ik ->do_local_static_fields (&initialize_static_field, mirror, CHECK);
10091009
10101010 // Set classData
10111011 set_class_data (mirror (), classData ());
@@ -1111,8 +1111,7 @@ void java_lang_Class::allocate_mirror(Klass* k, bool is_scratch, Handle protecti
11111111 // and java_mirror in this klass.
11121112 } else {
11131113 assert (k->is_instance_klass (), " Must be" );
1114-
1115- initialize_mirror_fields (k, mirror, protection_domain, classData, THREAD);
1114+ initialize_mirror_fields (InstanceKlass::cast (k), mirror, protection_domain, classData, THREAD);
11161115 if (HAS_PENDING_EXCEPTION) {
11171116 // If any of the fields throws an exception like OOM remove the klass field
11181117 // from the mirror so GC doesn't follow it after the klass has been deallocated.
@@ -2590,7 +2589,7 @@ static void print_stack_element_to_stream(outputStream* st, Handle mirror, int m
25902589 ResourceMark rm;
25912590 stringStream ss;
25922591
2593- InstanceKlass* holder = InstanceKlass::cast ( java_lang_Class::as_Klass (mirror () ));
2592+ InstanceKlass* holder = java_lang_Class::as_InstanceKlass (mirror ());
25942593 const char * klass_name = holder->external_name ();
25952594 char * method_name = name->as_C_string ();
25962595 ss.print (" \t at %s.%s(" , klass_name, method_name);
@@ -2969,7 +2968,7 @@ void java_lang_Throwable::get_stack_trace_elements(int depth, Handle backtrace,
29692968 THROW (vmSymbols::java_lang_NullPointerException ());
29702969 }
29712970
2972- InstanceKlass* holder = InstanceKlass::cast ( java_lang_Class::as_Klass (bte._mirror () ));
2971+ InstanceKlass* holder = java_lang_Class::as_InstanceKlass (bte._mirror ());
29732972 methodHandle method (THREAD, holder->method_with_orig_idnum (bte._method_id , bte._version ));
29742973
29752974 java_lang_StackTraceElement::fill_in (stack_trace_element, holder,
@@ -3055,7 +3054,7 @@ bool java_lang_Throwable::get_top_method_and_bci(oop throwable, Method** method,
30553054 // Get first backtrace element.
30563055 BacktraceElement bte = iter.next (current);
30573056
3058- InstanceKlass* holder = InstanceKlass::cast ( java_lang_Class::as_Klass (bte._mirror () ));
3057+ InstanceKlass* holder = java_lang_Class::as_InstanceKlass (bte._mirror ());
30593058 assert (holder != nullptr , " first element should be non-null" );
30603059 Method* m = holder->method_with_orig_idnum (bte._method_id , bte._version );
30613060
@@ -3441,11 +3440,11 @@ void java_lang_reflect_Method::serialize_offsets(SerializeClosure* f) {
34413440
34423441Handle java_lang_reflect_Method::create (TRAPS) {
34433442 assert (Universe::is_fully_initialized (), " Need to find another solution to the reflection problem" );
3444- Klass * klass = vmClasses::reflect_Method_klass ();
3443+ InstanceKlass * klass = vmClasses::reflect_Method_klass ();
34453444 // This class is eagerly initialized during VM initialization, since we keep a reference
34463445 // to one of the methods
3447- assert (InstanceKlass::cast ( klass) ->is_initialized (), " must be initialized" );
3448- return InstanceKlass::cast ( klass) ->allocate_instance_handle (THREAD);
3446+ assert (klass->is_initialized (), " must be initialized" );
3447+ return klass->allocate_instance_handle (THREAD);
34493448}
34503449
34513450oop java_lang_reflect_Method::clazz (oop reflect) {
@@ -3914,17 +3913,15 @@ void reflect_ConstantPool::set_cp(oop reflect, ConstantPool* value) {
39143913}
39153914
39163915ConstantPool* reflect_ConstantPool::get_cp (oop reflect) {
3917-
39183916 oop mirror = reflect->obj_field (_oop_offset);
3919- Klass* k = java_lang_Class::as_Klass (mirror);
3920- assert (k->is_instance_klass (), " Must be" );
3917+ InstanceKlass* ik = java_lang_Class::as_InstanceKlass (mirror);
39213918
39223919 // Get the constant pool back from the klass. Since class redefinition
39233920 // merges the new constant pool into the old, this is essentially the
39243921 // same constant pool as the original. If constant pool merging is
39253922 // no longer done in the future, this will have to change to save
39263923 // the original.
3927- return InstanceKlass::cast (k) ->constants ();
3924+ return ik ->constants ();
39283925}
39293926
39303927
@@ -5531,7 +5528,7 @@ void JavaClasses::check_offsets() {
55315528#endif // PRODUCT
55325529
55335530int InjectedField::compute_offset () {
5534- InstanceKlass* ik = InstanceKlass::cast ( klass () );
5531+ InstanceKlass* ik = klass ();
55355532 for (AllFieldStream fs (ik); !fs.done (); fs.next ()) {
55365533 if (!may_be_java && !fs.field_flags ().is_injected ()) {
55375534 // Only look at injected fields
0 commit comments