United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7007377 JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
JDK-7007377 : JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot

Details
Type:
Bug
Submit Date:
2010-12-16
Status:
Closed
Updated Date:
2012-02-01
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs19,hs20
Fixed Versions:
hs20 (b06)

Related Reports
Backport:
Backport:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Relates:
Relates:

Sub Tasks

Description
After fixing 6990933 another error surfaced.

On 64-bit SPARC:

$ gamma -Xcomp -XX:+DeoptimizeALot -XX:-PrintVMOptions -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -cp /java/devtools/share/junit/latest/junit.jar:. org.junit.runner.JUnitCore test.java.dyn.MethodHandlesTest
JUnit version 4.4
.IIIIII...........................E..
Time: 16.508
There was 1 failure:
1) testCastFailure(test.java.dyn.MethodHandlesTest)
java.lang.InternalError: unexpected code -1: required class java.lang.Integer but encountered class java.lang.String
        at sun.dyn.MethodHandleImpl.raiseException(MethodHandleImpl.java:1247)
        at sun.dyn.FilterOneArgument.invoke(FilterOneArgument.java:50)
        at test.java.dyn.MethodHandlesTest.testCastFailure(MethodHandlesTest.java:1917)
        at test.java.dyn.MethodHandlesTest.testCastFailure(MethodHandlesTest.java:1825)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:613)
        at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
        at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
        at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
        at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
        at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
        at org.junit.internal.runners.CompositeRunner.runChildren(CompositeRunner.java:33)
        at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:28)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:130)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:109)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:100)
        at org.junit.runner.JUnitCore.runMain(JUnitCore.java:81)
        at org.junit.runner.JUnitCore.main(JUnitCore.java:44)

FAILURES!!!
Tests run: 30,  Failures: 1


On 32-bit SPARC:

JUnit version 4.4
.IIIIII...........................==============================================================================
Unexpected Error
------------------------------------------------------------------------------
SIGSEGV (0xb) at pc=0xfb980884, pid=8817, tid=2

Do you want to debug the problem?

To debug, run 'dbx - 8817'; then switch to thread 2
Enter 'yes' to launch dbx automatically (PATH must include dbx)
Otherwise, press RETURN to abort...
==============================================================================

<snip>
 1 - frame( sp=0xfd7fe460, unextended_sp=0xfd7fe460, fp=0xfd7fe840, pc=0xfb51211c)
java.lang.String.valueOf(String.java:2902)
 2 - frame( sp=0xfd7fe460, unextended_sp=0xfd7fe460, fp=0xfd7fe840, pc=0xfb51211c)
java.lang.StringBuilder.append(StringBuilder.java:128)
 3 - frame( sp=0xfd7fe840, unextended_sp=0xfd7fe840, fp=0xfd7fe8c8, pc=0xfb406490)
sun.dyn.MethodHandleImpl.raiseException(MethodHandleImpl.java:1240)
 4 - frame( sp=0xfd7fe8c8, unextended_sp=0xfd7fe8e0, fp=0xfd7fe938, pc=0xfbc771c4)
sun.dyn.FilterOneArgument.invoke(FilterOneArgument.java:50)
 5 - frame( sp=0xfd7fe938, unextended_sp=0xfd7fe968, fp=0xfd7fe9e8, pc=0xfbd0c5e8)
test.java.dyn.MethodHandlesTest.testCastFailure(MethodHandlesTest.java:1917)
<snip>

<snip>
[8] sp=0xfd7fe400 pc=0xfdb3df50: sema_post+0x7e4 in /lib/libc.so.1 at 0xfda80000
[9] sp=0xfd7fe460 pc=fb512114: Compiled {method} 'append' '(Ljava/lang/Object;)Ljava/lang/StringBuilder;' in 'java/lang/StringBuilder'  = (CodeBlob*)0xfb511fc8
[10] sp=0xfd7fe840 pc=0xfb406488 is an Interpreter codelet
return entry points  [0xfb405140, 0xfb408580]  13376 bytes
[11] sp=0xfd7fe8c8 pc=fbc7727c: Compiled {method} 'invoke' '(Ljava/lang/Object;)Ljava/lang/Object;' in 'sun/dyn/FilterOneArgument'  = (CodeBlob*)0xfbc77048
[12] sp=0xfd7fe938 pc=fbd0cc4c: Compiled {method} 'testCastFailure' '(Ljava/lang/String;I)V' in 'test/java/dyn/MethodHandlesTest'  = (CodeBlob*)0xfbd0c0c8
<snip>

                                    

Comments
SUGGESTED FIX

To avoid duplication of that set up logic, _raise_exception can
instead use a C2I adapter that does the set up.  This makes the
_raise_exception adapter simpler as the arguments only need to be
passed in the compiler argument registers.  Since this is a slow
path anyway performance should not be a problem.
                                     
2010-12-20
EVALUATION

To throw an exception _raise_exception calls the Java method
MethodHandleImpl.raiseException.  In order to do so it has to set up
an interpreter state including an interpreter stack frame.  That logic
is broken.
                                     
2010-12-20
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/8d0b933dda2d
                                     
2010-12-22



Hardware and Software, Engineered to Work Together