6667089: 3/3 multiple redefinitions of a class break reflection
authordcubed
Wed, 12 Mar 2008 18:39:05 -0700
changeset 224 6a257cd604e7
parent 223 5c3b023117d9
child 225 6258c2e3adfd
6667089: 3/3 multiple redefinitions of a class break reflection Summary: Use instanceKlass::method_with_idnum() instead of slot() to work with RedefineClasses(). Reviewed-by: sspitsyn
hotspot/src/share/vm/runtime/reflection.cpp
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Wed Mar 12 18:37:03 2008 -0700
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Wed Mar 12 18:39:05 2008 -0700
@@ -1548,10 +1548,11 @@
   }
 
   instanceKlassHandle klass(THREAD, java_lang_Class::as_klassOop(mirror));
-  if (!klass->methods()->is_within_bounds(slot)) {
+  methodOop m = klass->method_with_idnum(slot);
+  if (m == NULL) {
     THROW_MSG_0(vmSymbols::java_lang_InternalError(), "invoke");
   }
-  methodHandle method(THREAD, methodOop(klass->methods()->obj_at(slot)));
+  methodHandle method(THREAD, m);
 
   return invoke(klass, method, receiver, override, ptypes, rtype, args, true, THREAD);
 }
@@ -1564,10 +1565,11 @@
   objArrayHandle ptypes(THREAD, objArrayOop(java_lang_reflect_Constructor::parameter_types(constructor_mirror)));
 
   instanceKlassHandle klass(THREAD, java_lang_Class::as_klassOop(mirror));
-  if (!klass->methods()->is_within_bounds(slot)) {
+  methodOop m = klass->method_with_idnum(slot);
+  if (m == NULL) {
     THROW_MSG_0(vmSymbols::java_lang_InternalError(), "invoke");
   }
-  methodHandle method(THREAD, methodOop(klass->methods()->obj_at(slot)));
+  methodHandle method(THREAD, m);
   assert(method->name() == vmSymbols::object_initializer_name(), "invalid constructor");
 
   // Make sure klass gets initialize