--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Wed Jul 06 10:33:17 2016 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Wed Jul 06 17:10:36 2016 +0200
@@ -751,11 +751,25 @@
classFileEpilogue();
bogusMethod(lambdaForm);
- final byte[] classFile = cw.toByteArray();
+ final byte[] classFile;
+ try {
+ classFile = cw.toByteArray();
+ } catch (RuntimeException e) {
+ // ASM throws RuntimeException if something goes wrong - capture these and wrap them in a meaningful
+ // exception to support falling back to LambdaForm interpretation
+ throw new BytecodeGenerationException(e);
+ }
maybeDump(className, classFile);
return classFile;
}
+ @SuppressWarnings("serial")
+ static final class BytecodeGenerationException extends RuntimeException {
+ BytecodeGenerationException(Exception cause) {
+ super(cause);
+ }
+ }
+
void emitArrayLoad(Name name) { emitArrayOp(name, Opcodes.AALOAD); }
void emitArrayStore(Name name) { emitArrayOp(name, Opcodes.AASTORE); }
void emitArrayLength(Name name) { emitArrayOp(name, Opcodes.ARRAYLENGTH); }