< prev index next >

src/hotspot/share/runtime/reflection.cpp

Print this page
rev 49275 : [mq]: JDK-8199781.patch


 401 
 402   Klass* klass = java_lang_Class::as_Klass(mirror);
 403   if (!klass->is_array_klass()) {
 404     return NULL;
 405   }
 406 
 407   oop result = java_lang_Class::component_mirror(mirror);
 408 #ifdef ASSERT
 409   oop result2 = NULL;
 410   if (ArrayKlass::cast(klass)->dimension() == 1) {
 411     if (klass->is_typeArray_klass()) {
 412       result2 = basic_type_arrayklass_to_mirror(klass, CHECK_NULL);
 413     } else {
 414       result2 = ObjArrayKlass::cast(klass)->element_klass()->java_mirror();
 415     }
 416   } else {
 417     Klass* lower_dim = ArrayKlass::cast(klass)->lower_dimension();
 418     assert(lower_dim->is_array_klass(), "just checking");
 419     result2 = lower_dim->java_mirror();
 420   }
 421   assert(result == result2, "results must be consistent");
 422 #endif //ASSERT
 423   return result;
 424 }
 425 
 426 static bool under_host_klass(const InstanceKlass* ik, const InstanceKlass* host_klass) {
 427   DEBUG_ONLY(int inf_loop_check = 1000 * 1000 * 1000);
 428   for (;;) {
 429     const InstanceKlass* hc = ik->host_klass();
 430     if (hc == NULL)        return false;
 431     if (hc == host_klass)  return true;
 432     ik = hc;
 433 
 434     // There's no way to make a host class loop short of patching memory.
 435     // Therefore there cannot be a loop here unless there's another bug.
 436     // Still, let's check for it.
 437     assert(--inf_loop_check > 0, "no host_klass loop");
 438   }
 439 }
 440 
 441 static bool can_relax_access_check_for(const Klass* accessor,




 401 
 402   Klass* klass = java_lang_Class::as_Klass(mirror);
 403   if (!klass->is_array_klass()) {
 404     return NULL;
 405   }
 406 
 407   oop result = java_lang_Class::component_mirror(mirror);
 408 #ifdef ASSERT
 409   oop result2 = NULL;
 410   if (ArrayKlass::cast(klass)->dimension() == 1) {
 411     if (klass->is_typeArray_klass()) {
 412       result2 = basic_type_arrayklass_to_mirror(klass, CHECK_NULL);
 413     } else {
 414       result2 = ObjArrayKlass::cast(klass)->element_klass()->java_mirror();
 415     }
 416   } else {
 417     Klass* lower_dim = ArrayKlass::cast(klass)->lower_dimension();
 418     assert(lower_dim->is_array_klass(), "just checking");
 419     result2 = lower_dim->java_mirror();
 420   }
 421   assert(oopDesc::equals(result, result2), "results must be consistent");
 422 #endif //ASSERT
 423   return result;
 424 }
 425 
 426 static bool under_host_klass(const InstanceKlass* ik, const InstanceKlass* host_klass) {
 427   DEBUG_ONLY(int inf_loop_check = 1000 * 1000 * 1000);
 428   for (;;) {
 429     const InstanceKlass* hc = ik->host_klass();
 430     if (hc == NULL)        return false;
 431     if (hc == host_klass)  return true;
 432     ik = hc;
 433 
 434     // There's no way to make a host class loop short of patching memory.
 435     // Therefore there cannot be a loop here unless there's another bug.
 436     // Still, let's check for it.
 437     assert(--inf_loop_check > 0, "no host_klass loop");
 438   }
 439 }
 440 
 441 static bool can_relax_access_check_for(const Klass* accessor,


< prev index next >