diff options
author | ksrini <none@none> | 2013-11-06 11:31:49 -0800 |
---|---|---|
committer | ksrini <none@none> | 2013-11-06 11:31:49 -0800 |
commit | 0c2f18b4098ec1b43fb22e25d5d5f9bef717fe3d (patch) | |
tree | 0685d95072c1c21054af256d6aa2c778fc64f05b /src | |
parent | 0ae0e5374dc24e36a02a1a5e9da622af09df0f22 (diff) |
8027232: Update j.l.invoke code generating class files to use ASM enhancements for invocation of non-abstract methods on ifaces
Reviewed-by: ksrini, rfield
Contributed-by: john.r.rose@oracle.com, paul.sandoz@oracle.com
Diffstat (limited to 'src')
3 files changed, 10 insertions, 7 deletions
diff --git a/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java b/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java index a85c505c0..2fc8618cb 100644 --- a/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java +++ b/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; /* package */ final class InnerClassLambdaMetafactory extends AbstractValidatingLambdaMetafactory { private static final Unsafe UNSAFE = Unsafe.getUnsafe(); - private static final int CLASSFILE_VERSION = 51; + private static final int CLASSFILE_VERSION = 52; private static final String METHOD_DESCRIPTOR_VOID = Type.getMethodDescriptor(Type.VOID_TYPE); private static final String JAVA_LANG_OBJECT = "java/lang/Object"; private static final String NAME_CTOR = "<init>"; @@ -465,7 +465,9 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; convertArgumentTypes(methodType); // Invoke the method we want to forward to - visitMethodInsn(invocationOpcode(), implMethodClassName, implMethodName, implMethodDesc); + visitMethodInsn(invocationOpcode(), implMethodClassName, + implMethodName, implMethodDesc, + implDefiningClass.isInterface()); // Convert the return value (if any) and return it // Note: if adapting from non-void to void, the 'return' diff --git a/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java index 639b3628f..5a3ee424b 100644 --- a/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java +++ b/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java @@ -275,7 +275,7 @@ class InvokerBytecodeGenerator { */ private void classFilePrologue() { cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES); - cw.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, className, null, superName, null); + cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, className, null, superName, null); cw.visitSource(sourceFile, null); String invokerDesc = invokerType.toMethodDescriptorString(); @@ -646,7 +646,8 @@ class InvokerBytecodeGenerator { // invocation if (member.isMethod()) { mtype = member.getMethodType().toMethodDescriptorString(); - mv.visitMethodInsn(refKindOpcode(refKind), cname, mname, mtype); + mv.visitMethodInsn(refKindOpcode(refKind), cname, mname, mtype, + member.getDeclaringClass().isInterface()); } else { mtype = MethodType.toFieldDescriptorString(member.getFieldType()); mv.visitFieldInsn(refKindOpcode(refKind), cname, mname, mtype); diff --git a/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java b/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java index f65049df0..5d8e1bf82 100644 --- a/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java +++ b/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ import static sun.invoke.util.Wrapper.*; class TypeConvertingMethodAdapter extends MethodVisitor { TypeConvertingMethodAdapter(MethodVisitor mv) { - super(Opcodes.ASM4, mv); + super(Opcodes.ASM5, mv); } private static final int NUM_WRAPPERS = Wrapper.values().length; |