don't use loadLocal, add new node to package-info

This commit is contained in:
Robert Muir 2016-06-10 17:37:57 -04:00
parent 9e0a70c4b2
commit 16d17351f7
2 changed files with 7 additions and 5 deletions

View File

@ -26,6 +26,7 @@ import org.elasticsearch.painless.Location;
import org.elasticsearch.painless.MethodWriter;
import org.elasticsearch.painless.Locals;
import org.elasticsearch.painless.Locals.Variable;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import static org.elasticsearch.painless.WriterConstants.DEF_BOOTSTRAP_HANDLE;
@ -77,19 +78,19 @@ public class ECapturingFunctionRef extends AExpression {
if (defInterface && captured.type.sort == Definition.Sort.DEF) {
// dynamic interface, dynamic implementation
writer.push("D" + type + "." + call + ",1");
writer.loadLocal(captured.slot);
writer.visitVarInsn(captured.type.type.getOpcode(Opcodes.ILOAD), captured.slot);
} else if (defInterface) {
// dynamic interface, typed implementation
writer.push("S" + captured.type.name + "." + call + ",1");
writer.loadLocal(captured.slot);
writer.visitVarInsn(captured.type.type.getOpcode(Opcodes.ILOAD), captured.slot);
} else if (ref == null) {
// typed interface, dynamic implementation
writer.loadLocal(captured.slot);
writer.visitVarInsn(captured.type.type.getOpcode(Opcodes.ILOAD), captured.slot);
String descriptor = Type.getMethodType(expected.type, captured.type.type).getDescriptor();
writer.invokeDynamic(call, descriptor, DEF_BOOTSTRAP_HANDLE, (Object)DefBootstrap.REFERENCE, expected.name);
} else {
// typed interface, typed implementation
writer.loadLocal(captured.slot);
writer.visitVarInsn(captured.type.type.getOpcode(Opcodes.ILOAD), captured.slot);
// convert MethodTypes to asm Type for the constant pool.
String invokedType = ref.invokedType.toMethodDescriptorString();
Type samMethodType = Type.getMethodType(ref.samMethodType.toMethodDescriptorString());

View File

@ -35,6 +35,7 @@
* {@link org.elasticsearch.painless.node.EBinary} - Represents a binary math expression.
* {@link org.elasticsearch.painless.node.EBool} - Represents a boolean expression.
* {@link org.elasticsearch.painless.node.EBoolean} - Represents a boolean constant.
* {@link org.elasticsearch.painless.node.ECapturingFunctionRef} - Represents a function reference (capturing).
* {@link org.elasticsearch.painless.node.ECast} - Represents an implicit cast in most cases. (Internal only.)
* {@link org.elasticsearch.painless.node.EChain} - Represents the entirety of a variable/method chain for read/write operations.
* {@link org.elasticsearch.painless.node.EComp} - Represents a comparison expression.
@ -42,7 +43,7 @@
* {@link org.elasticsearch.painless.node.EConstant} - Represents a constant. (Internal only.)
* {@link org.elasticsearch.painless.node.EDecimal} - Represents a decimal constant.
* {@link org.elasticsearch.painless.node.EExplicit} - Represents an explicit cast.
* {@link org.elasticsearch.painless.node.EFunctionRef} - Represents a function reference.
* {@link org.elasticsearch.painless.node.EFunctionRef} - Represents a function reference (non-capturing).
* {@link org.elasticsearch.painless.node.ENull} - Represents a null constant.
* {@link org.elasticsearch.painless.node.ENumeric} - Represents a non-decimal numeric constant.
* {@link org.elasticsearch.painless.node.EUnary} - Represents a unary math expression.