< prev index next >

src/hotspot/share/runtime/reflection.cpp

roman_version

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

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