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;
}

_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to