SUGGESTED FIX
From: John Rose <###@###.###>
Date: June 1, 2011 11:44:29 AM PDT
To: hotspot compiler <###@###.###>
Subject: review request (URGENT): 7049415: Failure of resolution of sym.reference to the c.s.s. should be wrapped in BootstrapMethodError
Low-level fix to ensure wrapping of early linkage errors in bootstrap method errors, for invokedynamic corner cases.
7049415: Failure of resolution of sym.reference to the c.s.s. should be wrapped in BootstrapMethodError
JVM Summary: Delegate invokedynamic linkage errors to MethodHandleNatives.raiseException.
JDK Summary: Wrap invokedynamic linkage errors in BootstrapMethodError, as needed.
http://cr.openjdk.java.net/~jrose/7049415/webrev.jvm.00
http://cr.openjdk.java.net/~jrose/7049415/webrev.jdk.00
These changes can integrate in any order. To fix the bug, both must be integrated.
Test case attached. All paths have been exercised.
-- John
<Test 7049415.java>
|
EVALUATION
A corner case of a corner case, but covered by the JCK: If an invokedynamic instruction fails to link because a constant pool reference fails to resolve before the BSM is invoked, the JVM can fail to wrap the LinkageError inside a BootstrapMethodError (which is also a LinkageError).
Thus, users who (a) have broken indy instructions and (b) are catching BSME (but not LE) will be surprised by a lack of spec. compliance.
The fix is fairly simple: Cut into the JVM routine which resolves an invokedynamic instruction, and cause it to verify any LinkageError is in fact a BSME. If a stray LE is found, wrap it. We have to call up to Java to get the wrapping done. Ungraceful, but it works.
|