Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7047697

MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp

XMLWordPrintable

    • b16
    • generic
    • generic
    • Verified

        The test below causes VM failure instead of WrongMethodTypeException if uncomment any of invokeExact calls and run the test with -Xcomp option:
        ----------------------------------------------------------
        import java.lang.invoke.*;

        class A {
            public static String foo(){return "";}
        }
        public class Test {
            public static void main(String argv[]) throws Throwable {
                MethodHandle handle = MethodHandles.lookup().findStatic
                    (A.class, "foo", MethodType.methodType(String.class));
                String inv1 = (String) handle.invokeExact(null);
        // String inv2 = (String) handle.invokeExact(new Object[]{});
        // String inv3 = (String) handle.invokeExact(-1);
        // CharSequence cs = (CharSequence) handle.invokeExact();
        // Object obj = handle.invokeExact();
            }
        }
        ----------------------------------------------------------

        C:\JDK\7\bin>java -version
        java version "1.7.0-ea"
        Java(TM) SE Runtime Environment (build 1.7.0-ea-b143)
        Java HotSpot(TM) Client VM (build 21.0-b13, mixed mode)
        C:\JDK\7\bin>javac Test.java
        C:\JDK\7\bin>java -Xcomp Test
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x66029cd6, pid=324, tid=3976
        #
        # JRE version: 7.0-b143
        # Java VM: Java HotSpot(TM) Client VM (21.0-b13 compiled mode windows-x86 )
        # Problematic frame:
        # V [jvm.dll+0x39cd6]
        #
        # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
        #
        # An error report file with more information is saved as:
        # D:\JCK7\292\hs_err_pid324.log
        Phoning home...
        Using server: 10.161.186.18, port 4711
        #
        # If you would like to submit a bug report, please visit:
        # http://bugreport.sun.com/bugreport/crash.jsp
        #
        The issue is also reproducible on Linux and Solaris with "-client" option.
        The problem is reproducible on b144:
        ---------------------------------------------------------
        <dm154731@zenit> /set/java/re/jdk/7/latest/binaries/solaris-amd64/bin/java -version
        java version "1.7.0-ea"
        Java(TM) SE Runtime Environment (build 1.7.0-ea-b144)
        Java HotSpot(TM) Server VM (build 21.0-b14, mixed mode)
        <dm154731@zenit> /set/java/re/jdk/7/latest/binaries/solaris-amd64/bin/java -Xcomp -client Test
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # SIGSEGV (0xb) at pc=0xfea8b557, pid=15125, tid=2
        #
        # JRE version: 7.0-b144
        # Java VM: Java HotSpot(TM) Client VM (21.0-b14 compiled mode solaris-x86 )
        # Problematic frame:
        # V [libjvm.so+0x68b557] int methodOopDesc::validate_bci_from_bcx(int)const+0x27
        #
        # Core dump written. Default location: /home/dm154731/292/core or core.15125
        #
        # An error report file with more information is saved as:
        # /home/dm154731/292/hs_err_pid15125.log
        Phoning home...
        Using server: 10.161.186.18, port 4711
        #
        # If you would like to submit a bug report, please visit:
        # http://bugreport.sun.com/bugreport/crash.jsp
        #
        Abort (core dumped)
        ---------------------------------------------------------

              jrose John Rose
              dmiltsov Dmitry Miltsov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: