Crash with invokeDynamic on MethodMissing attempt

Christian Thalinger Christian.Thalinger at Sun.COM
Thu May 21 04:31:31 PDT 2009


On Thu, 2009-05-21 at 11:32 +0200, Christian Thalinger wrote:
> On Wed, 2009-05-20 at 21:41 -0700, John Rose wrote:
> > Thanks.  We have seen problems with indy in the JIT; that's probably it.
> > 
> > (We're working on the JIT support right now.)
> > 
> > Try running with java -Xint; does that make the crash go away?
> 
> Yes and no.  Indeed it crashes in the compiler, but when running with
> the interpreter it asserts too.  The problem is
> GenerateOopMap::do_method.  That's the same point where I'm currently
> hanging in the compiler.  Let's see if I can come up with a fix...

I think I have a fix for it.  John, is that correct?

diff --git a/src/share/vm/oops/generateOopMap.cpp b/src/share/vm/oops/generateOopMap.cpp
--- a/src/share/vm/oops/generateOopMap.cpp
+++ b/src/share/vm/oops/generateOopMap.cpp
@@ -1559,7 +1559,7 @@ void GenerateOopMap::interp1(BytecodeStr
     case Bytecodes::_invokevirtual:
     case Bytecodes::_invokespecial:     do_method(false, false, itr->get_index_big(), itr->bci()); break;
     case Bytecodes::_invokestatic:      do_method(true,  false, itr->get_index_big(), itr->bci()); break;
-    case Bytecodes::_invokedynamic:     do_method(false, true,  itr->get_index_int(), itr->bci()); break;
+    case Bytecodes::_invokedynamic:     do_method(true,  false, itr->get_index_int(), itr->bci()); break;
     case Bytecodes::_invokeinterface:   do_method(false, true,  itr->get_index_big(), itr->bci()); break;
     case Bytecodes::_newarray:
     case Bytecodes::_anewarray:         pp_new_ref(vCTS, itr->bci()); break;
@@ -1901,10 +1901,17 @@ void GenerateOopMap::do_field(int is_get
 
 void GenerateOopMap::do_method(int is_static, int is_interface, int idx, int bci) {
   // Dig up signature for field in constant pool
-  constantPoolOop cp    = _method->constants();
-  int nameAndTypeIdx    = cp->name_and_type_ref_index_at(idx);
-  int signatureIdx      = cp->signature_ref_index_at(nameAndTypeIdx);  // @@@@@
-  symbolOop signature   = cp->symbol_at(signatureIdx);
+  constantPoolOop cp  = _method->constants();
+
+  // invokedynamic has a secondary index.
+  int nameAndTypeIdx;
+  if (constantPoolCacheOopDesc::is_secondary_index(idx))
+    nameAndTypeIdx    = cp->map_instruction_operand_to_index(idx);
+  else
+    nameAndTypeIdx    = cp->name_and_type_ref_index_at(idx);
+
+  int signatureIdx    = cp->signature_ref_index_at(nameAndTypeIdx);  // @@@@@
+  symbolOop signature = cp->symbol_at(signatureIdx);
 
   // Parse method signature
   CellTypeState out[4];

-- Christian




More information about the mlvm-dev mailing list