current bug with throwing through MH calls

John Rose John.Rose at Sun.COM
Wed Jul 8 21:05:57 PDT 2009


FTR, here's a test case I just minimized.  It may be related to some  
of the failures we've been seeing.

-- John

/*
   Minimized test case for stack walking bug.
   JVM crash occurs when compiled code calls DMH to compiled code.

   To reproduce:

   $JAVA7X_HOME/bin/javac -XDinvokedynamic $BUGDIR/ThrowBug.java
   $JAVA7X_HOME/bin/java -Xbatch -XX:+PrintCompilation -XX: 
+EnableMethodHandles -cp $BUGDIR ThrowBug

   continues to reproduce with - 
XX:CompileCommand=compileonly,ThrowBug.* (2 methods compiled only)
  */

import java.dyn.*;
import static java.dyn.MethodHandles.*;

class ThrowBug {
     public static void main(String... av) throws Throwable {
         for (int i = 0; i < 10001; i++) {
             catcher(THROWER);
         }
         System.out.println("catches="+catches);
     }

     static final Exception blintz = new ClassCastException("blintz");
     static Object thrower() throws Throwable {
         throw blintz;  // food fight!!
     }
     static final MethodHandle THROWER
         = lookup().findStatic(ThrowBug.class, "thrower",  
methodType(Object.class));

     static Object catcher(MethodHandle thrower) {
         try {
             return THROWER.invoke();
         } catch (Throwable ex) {
             catches++;
             return null;
         }
     }
     static int catches;
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20090708/1a73e5f3/attachment.html 


More information about the mlvm-dev mailing list