From cfba796f1b9c58022c753d45cb7d0d77bb14101b Mon Sep 17 00:00:00 2001
From: Lukas Stadler <lukas.stadler@oracle.com>
Date: Fri, 16 Feb 2018 15:19:54 +0100
Subject: [PATCH] try to supply names in LocalReadVariableNode

---
 .../r/nodes/access/variables/LocalReadVariableNode.java   | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/LocalReadVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/LocalReadVariableNode.java
index f67c254ce6..533db22101 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/LocalReadVariableNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/LocalReadVariableNode.java
@@ -51,6 +51,7 @@ public final class LocalReadVariableNode extends Node {
 
     private final Object identifier;
     private final boolean forceResult;
+    @CompilationFinal private boolean firstExecution = true;
 
     @CompilationFinal(dimensions = 1) private boolean[] seenValueKinds;
     @CompilationFinal private ValueProfile valueProfile;
@@ -144,6 +145,13 @@ public final class LocalReadVariableNode extends Node {
                 isPromiseProfile = ConditionProfile.createBinaryProfile();
             }
             if (isPromiseProfile.profile(result instanceof RPromise)) {
+                if (firstExecution) {
+                    CompilerDirectives.transferToInterpreterAndInvalidate();
+                    firstExecution = false;
+                    if (identifier instanceof String) {
+                        return ReadVariableNode.evalPromiseSlowPathWithName((String) identifier, frame, (RPromise) result);
+                    }
+                }
                 if (promiseHelper == null) {
                     CompilerDirectives.transferToInterpreterAndInvalidate();
                     promiseHelper = insert(new PromiseHelperNode());
-- 
GitLab