aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/InstructionModifier.java
diff options
context:
space:
mode:
authorVolodymyr Vysotskyi <vvovyk@gmail.com>2019-03-10 13:57:03 +0200
committerSorabh Hamirwasia <sorabh@apache.org>2019-03-14 15:36:11 -0700
commit5aa38a51d90998234b4ca46434ce225df72addc5 (patch)
tree46c8777ef8cd139b7f285b8df7cbed7d4cb4cb85 /exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/InstructionModifier.java
parente7f0bbf1f45b0d39d3796be81207aecd716d6aae (diff)
DRILL-2326: Fix scalar replacement for the case when static method which does not return values is called
- Fix check for return function value to handle the case when created object is returned without assigning it to the local variable closes #1687
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/InstructionModifier.java')
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/InstructionModifier.java24
1 files changed, 13 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. " +