From 25dd1f98854c95c9c1b2d5ba28c6a0ccd242492b Mon Sep 17 00:00:00 2001 From: Florian Angerer <florian.angerer@oracle.com> Date: Mon, 16 Oct 2017 17:53:18 +0200 Subject: [PATCH] Storing evaluated args in locals. --- .../com/oracle/truffle/r/nodes/builtin/InternalNode.java | 9 ++++++--- .../com/oracle/truffle/r/nodes/function/PromiseNode.java | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/InternalNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/InternalNode.java index 3be03b9913..1139df347c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/InternalNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/InternalNode.java @@ -242,7 +242,8 @@ public abstract class InternalNode extends OperatorNode { protected Object[] prepareArgs(VirtualFrame frame) { Object[] args = new Object[arguments.length]; for (int i = 0; i < args.length; i++) { - args[i] = arguments[i].execute(frame); + Object execute = arguments[i].execute(frame); + args[i] = execute; } return args; } @@ -300,11 +301,13 @@ public abstract class InternalNode extends OperatorNode { Object[] args = new Object[factory.getSignature().getLength()]; for (int i = 0; i < args.length - 1; i++) { - args[i] = arguments[i].execute(frame); + Object arg = arguments[i].execute(frame); + args[i] = arg; } Object[] varArgs = new Object[arguments.length - (factory.getSignature().getLength() - 1)]; for (int i = 0; i < varArgs.length; i++) { - varArgs[i] = arguments[args.length - 1 + i].execute(frame); + Object arg = arguments[args.length - 1 + i].execute(frame); + varArgs[i] = arg; } args[args.length - 1] = new RArgsValuesAndNames(varArgs, ArgumentsSignature.empty(varArgs.length)); return args; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java index c3a0a12254..4421b00568 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java @@ -540,10 +540,10 @@ public abstract class PromiseNode extends RNode { evaluatedArgs[i] = argValue; } else { size++; - evaluatedArgs[i] = promiseCheckHelper.checkEvaluate(frame, argValue); + Object arg = promiseCheckHelper.checkEvaluate(frame, argValue); + evaluatedArgs[i] = arg; } if (evaluatedArgs[i] == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); throw RInternalError.shouldNotReachHere("evaluated argument must not be null"); } } @@ -565,10 +565,10 @@ public abstract class PromiseNode extends RNode { evaluatedArgs[i] = argValue; } else { size++; - evaluatedArgs[i] = promiseCheckHelper.checkEvaluate(frame, argValue); + Object arg = promiseCheckHelper.checkEvaluate(frame, argValue); + evaluatedArgs[i] = arg; } if (evaluatedArgs[i] == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); throw RInternalError.shouldNotReachHere("evaluated argument must not be null"); } } -- GitLab