src/hotspot/share/classfile/javaClasses.cpp
changeset 58177 4932dce35882
parent 57938 8ec5ad4f5cc3
child 58493 55a8d95c7787
equal deleted inserted replaced
58176:470af058bd5f 58177:4932dce35882
   876       set_module(mirror(), javabase_handle());
   876       set_module(mirror(), javabase_handle());
   877     }
   877     }
   878   } else {
   878   } else {
   879     assert(Universe::is_module_initialized() ||
   879     assert(Universe::is_module_initialized() ||
   880            (ModuleEntryTable::javabase_defined() &&
   880            (ModuleEntryTable::javabase_defined() &&
   881             (oopDesc::equals(module(), ModuleEntryTable::javabase_moduleEntry()->module()))),
   881             (module() == ModuleEntryTable::javabase_moduleEntry()->module())),
   882            "Incorrect java.lang.Module specification while creating mirror");
   882            "Incorrect java.lang.Module specification while creating mirror");
   883     set_module(mirror(), module());
   883     set_module(mirror(), module());
   884   }
   884   }
   885 }
   885 }
   886 
   886 
   953         return;
   953         return;
   954       }
   954       }
   955     }
   955     }
   956 
   956 
   957     // set the classLoader field in the java_lang_Class instance
   957     // set the classLoader field in the java_lang_Class instance
   958     assert(oopDesc::equals(class_loader(), k->class_loader()), "should be same");
   958     assert(class_loader() == k->class_loader(), "should be same");
   959     set_class_loader(mirror(), class_loader());
   959     set_class_loader(mirror(), class_loader());
   960 
   960 
   961     // Setup indirection from klass->mirror
   961     // Setup indirection from klass->mirror
   962     // after any exceptions can happen during allocations.
   962     // after any exceptions can happen during allocations.
   963     k->set_java_mirror(mirror);
   963     k->set_java_mirror(mirror);
  1508   BasicType type = T_VOID;
  1508   BasicType type = T_VOID;
  1509   if (ak != NULL) {
  1509   if (ak != NULL) {
  1510     // Note: create_basic_type_mirror above initializes ak to a non-null value.
  1510     // Note: create_basic_type_mirror above initializes ak to a non-null value.
  1511     type = ArrayKlass::cast(ak)->element_type();
  1511     type = ArrayKlass::cast(ak)->element_type();
  1512   } else {
  1512   } else {
  1513     assert(oopDesc::equals(java_class, Universe::void_mirror()), "only valid non-array primitive");
  1513     assert(java_class == Universe::void_mirror(), "only valid non-array primitive");
  1514   }
  1514   }
  1515   assert(oopDesc::equals(Universe::java_mirror(type), java_class), "must be consistent");
  1515   assert(Universe::java_mirror(type) == java_class, "must be consistent");
  1516   return type;
  1516   return type;
  1517 }
  1517 }
  1518 
  1518 
  1519 BasicType java_lang_Class::as_BasicType(oop java_class, Klass** reference_klass) {
  1519 BasicType java_lang_Class::as_BasicType(oop java_class, Klass** reference_klass) {
  1520   assert(java_lang_Class::is_instance(java_class), "must be a Class object");
  1520   assert(java_lang_Class::is_instance(java_class), "must be a Class object");
  3710   }
  3710   }
  3711   return name;
  3711   return name;
  3712 }
  3712 }
  3713 
  3713 
  3714 bool java_lang_invoke_MethodType::equals(oop mt1, oop mt2) {
  3714 bool java_lang_invoke_MethodType::equals(oop mt1, oop mt2) {
  3715   if (oopDesc::equals(mt1, mt2))
  3715   if (mt1 == mt2)
  3716     return true;
  3716     return true;
  3717   if (!oopDesc::equals(rtype(mt1), rtype(mt2)))
  3717   if (rtype(mt1) != rtype(mt2))
  3718     return false;
  3718     return false;
  3719   if (ptype_count(mt1) != ptype_count(mt2))
  3719   if (ptype_count(mt1) != ptype_count(mt2))
  3720     return false;
  3720     return false;
  3721   for (int i = ptype_count(mt1) - 1; i >= 0; i--) {
  3721   for (int i = ptype_count(mt1) - 1; i >= 0; i--) {
  3722     if (!oopDesc::equals(ptype(mt1, i), ptype(mt2, i)))
  3722     if (ptype(mt1, i) != ptype(mt2, i))
  3723       return false;
  3723       return false;
  3724   }
  3724   }
  3725   return true;
  3725   return true;
  3726 }
  3726 }
  3727 
  3727 
  3931   oop acl = loader;
  3931   oop acl = loader;
  3932   debug_only(jint loop_count = 0);
  3932   debug_only(jint loop_count = 0);
  3933   // This loop taken verbatim from ClassLoader.java:
  3933   // This loop taken verbatim from ClassLoader.java:
  3934   do {
  3934   do {
  3935     acl = parent(acl);
  3935     acl = parent(acl);
  3936     if (oopDesc::equals(cl, acl)) {
  3936     if (cl == acl) {
  3937       return true;
  3937       return true;
  3938     }
  3938     }
  3939     assert(++loop_count > 0, "loop_count overflow");
  3939     assert(++loop_count > 0, "loop_count overflow");
  3940   } while (acl != NULL);
  3940   } while (acl != NULL);
  3941   return false;
  3941   return false;
  3961   // Fix for 4474172; see evaluation for more details
  3961   // Fix for 4474172; see evaluation for more details
  3962   loader = non_reflection_class_loader(loader);
  3962   loader = non_reflection_class_loader(loader);
  3963 
  3963 
  3964   oop cl = SystemDictionary::java_system_loader();
  3964   oop cl = SystemDictionary::java_system_loader();
  3965   while(cl != NULL) {
  3965   while(cl != NULL) {
  3966     if (oopDesc::equals(cl, loader)) return true;
  3966     if (cl == loader) return true;
  3967     cl = parent(cl);
  3967     cl = parent(cl);
  3968   }
  3968   }
  3969   return false;
  3969   return false;
  3970 }
  3970 }
  3971 
  3971