diff options
Diffstat (limited to 'exec/java-exec/src/main/java/org')
2 files changed, 20 insertions, 11 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/InstructionModifier.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/InstructionModifier.java index 71c222b61..291cf6baa 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/InstructionModifier.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/InstructionModifier.java @@ -434,23 +434,25 @@ public class InstructionModifier extends MethodVisitor { * * Does the function being called return a holder? */ - final ReplacingBasicValue functionReturn = getFunctionReturn(); - if (functionReturn != null) { - /* - * The return of this method is an actual instance of the object we're escaping. - * Update so that it gets mapped correctly. - */ - super.visitMethodInsn(opcode, owner, name, desc, itf); - functionReturn.markFunctionReturn(); - return; + if (Type.getReturnType(desc) != Type.VOID_TYPE) { + ReplacingBasicValue functionReturn = getFunctionReturn(); + if (functionReturn != null) { + /* + * The return of this method is an actual instance of the object we're escaping. + * Update so that it gets mapped correctly. + */ + super.visitMethodInsn(opcode, owner, name, desc, itf); + functionReturn.markFunctionReturn(); + return; + } } /* * Holders can't be passed as arguments to methods, because their contents aren't * maintained; we use the locals instead. Therefore, complain if any arguments are holders. */ - for(int argDepth = argCount - 1; argDepth >= 0; --argDepth) { - final ReplacingBasicValue argValue = peekFromTop(argDepth); + for (int argDepth = argCount - 1; argDepth >= 0; --argDepth) { + ReplacingBasicValue argValue = peekFromTop(argDepth); if (argValue != null) { throw new IllegalStateException( String.format("Holder types are not allowed to be passed between methods. " + diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingInterpreter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingInterpreter.java index 13063c8a5..a34854dbc 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingInterpreter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingInterpreter.java @@ -83,6 +83,13 @@ public class ReplacingInterpreter extends BasicInterpreter { } @Override + public void returnOperation(AbstractInsnNode insn, BasicValue value, BasicValue expected) { + if (value instanceof ReplacingBasicValue) { + ((ReplacingBasicValue) value).markFunctionReturn(); + } + } + + @Override public BasicValue unaryOperation(final AbstractInsnNode insn, final BasicValue value) throws AnalyzerException { /* |