From 3878aba1d8dde97a9ad9467b4ccb8d667ea83ca2 Mon Sep 17 00:00:00 2001
From: Mick Jordan <mick.jordan@oracle.com>
Date: Sun, 13 Mar 2016 15:49:55 -0700
Subject: [PATCH] retire old instrumentation framework, update truffle import

---
 .../r/engine/RRuntimeASTAccessImpl.java       |   2 +-
 .../truffle/r/engine/TruffleRLanguage.java    |  24 +-
 .../truffle/r/library/fastr/FastRTrace.java   |   2 +-
 .../truffle/r/nodes/builtin/base/DoCall.java  |   3 +-
 .../r/nodes/access/ReadArgumentNode.java      |   8 -
 .../access/WriteCurrentVariableNode.java      |  13 -
 .../access/WriteSuperFrameVariableNode.java   |   1 -
 .../nodes/access/WriteSuperVariableNode.java  |  13 -
 .../r/nodes/function/ArgumentsNode.java       |   3 -
 .../truffle/r/nodes/function/RCallNode.java   |   3 +-
 .../instrument/OldInstrumentFactory.java      | 131 ----
 .../r/nodes/instrument/RASTProber.java        | 151 -----
 .../r/nodes/instrument/REntryCounters.java    | 170 ------
 .../r/nodes/instrument/RInstrument.java       | 345 -----------
 .../r/nodes/instrument/RNodeTimer.java        | 286 ---------
 .../nodes/instrument/debug/DebugHandling.java | 571 ------------------
 .../nodes/instrument/trace/TraceHandling.java | 254 --------
 .../wrappers/ConvertBooleanNodeWrapper.java   | 108 ----
 .../wrappers/ReadArgumentNodeWrapper.java     |  72 ---
 .../WriteCurrentVariableNodeWrapper.java      | 116 ----
 .../WriteSuperVariableNodeWrapper.java        | 116 ----
 .../instrumentation/RInstrumentation.java     |  43 +-
 .../r/nodes/instrumentation/RSyntaxTags.java  |  21 +-
 .../ConvertBooleanNodeWrapperFactory.java     | 104 ----
 .../ReadArgumentNodeWrapperFactory.java       |  86 ---
 ...riteCurrentVariableNodeWrapperFactory.java |   5 -
 .../WriteSuperVariableNodeFactory.java        |   5 -
 .../r/nodes/unary/ConvertBooleanNode.java     |   8 -
 .../truffle/r/runtime/FastROptions.java       |   1 -
 .../oracle/truffle/r/runtime/nodes/RNode.java |  17 +-
 .../nodes/instrument/NeedsWrapper.java        |  46 --
 .../nodes/instrument/RNodeWrapper.java        |  88 ---
 .../instrumentation/RNodeWrapperFactory.java  |   4 -
 mx.fastr/suite.py                             |  12 +-
 34 files changed, 61 insertions(+), 2771 deletions(-)
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/OldInstrumentFactory.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RASTProber.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/REntryCounters.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RInstrument.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RNodeTimer.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/debug/DebugHandling.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/trace/TraceHandling.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/ConvertBooleanNodeWrapper.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/ReadArgumentNodeWrapper.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/WriteCurrentVariableNodeWrapper.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/WriteSuperVariableNodeWrapper.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/ConvertBooleanNodeWrapperFactory.java
 delete mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/ReadArgumentNodeWrapperFactory.java
 delete mode 100644 com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrument/NeedsWrapper.java
 delete mode 100644 com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrument/RNodeWrapper.java

diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java
index 6174278a83..1b4a5a81ea 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java
@@ -41,7 +41,7 @@ import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode;
 import com.oracle.truffle.r.nodes.function.GroupDispatchNode;
 import com.oracle.truffle.r.nodes.function.PromiseHelperNode;
 import com.oracle.truffle.r.nodes.function.RCallNode;
-import com.oracle.truffle.r.nodes.instrument.debug.DebugHandling;
+import com.oracle.truffle.r.nodes.instrumentation.debug.DebugHandling;
 import com.oracle.truffle.r.nodes.runtime.RASTDeparse;
 import com.oracle.truffle.r.runtime.Arguments;
 import com.oracle.truffle.r.runtime.ArgumentsSignature;
diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguage.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguage.java
index 89dd0f2c2c..f072a9da37 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguage.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguage.java
@@ -35,11 +35,11 @@ import com.oracle.truffle.api.source.Source;
 import com.oracle.truffle.api.vm.PolyglotEngine;
 import com.oracle.truffle.r.nodes.RASTBuilder;
 import com.oracle.truffle.r.nodes.builtin.RBuiltinPackages;
-import com.oracle.truffle.r.nodes.instrument.OldInstrumentFactory;
 import com.oracle.truffle.r.nodes.instrumentation.NewInstrumentFactory;
 import com.oracle.truffle.r.runtime.FastROptions;
 import com.oracle.truffle.r.runtime.RAccuracyInfo;
 import com.oracle.truffle.r.runtime.RError;
+import com.oracle.truffle.r.runtime.RInternalError;
 import com.oracle.truffle.r.runtime.RPerfStats;
 import com.oracle.truffle.r.runtime.RRuntime;
 import com.oracle.truffle.r.runtime.RVersionInfo;
@@ -47,10 +47,8 @@ import com.oracle.truffle.r.runtime.TempPathName;
 import com.oracle.truffle.r.runtime.context.Engine.IncompleteSourceException;
 import com.oracle.truffle.r.runtime.context.Engine.ParseException;
 import com.oracle.truffle.r.runtime.context.RContext;
-import com.oracle.truffle.r.runtime.context.RInstrumentFactory;
 import com.oracle.truffle.r.runtime.ffi.Load_RFFIFactory;
 import com.oracle.truffle.r.runtime.ffi.RFFIFactory;
-import com.oracle.truffle.r.runtime.nodes.RNode;
 
 /**
  * Only does the minimum for running under the debugger. It is not completely clear how to correctly
@@ -94,18 +92,6 @@ public final class TruffleRLanguage extends TruffleLanguage<RContext> {
         return false;
     }
 
-    /**
-     * Depending on the value of {@link FastROptions#UseOldInstrument} we pick the factory that
-     * allows most of the system to be independent of the choice.
-     */
-    public static RInstrumentFactory initializeInstrument(Env env) {
-        if (FastROptions.UseOldInstrument.getBooleanValue()) {
-            return new OldInstrumentFactory(env);
-        } else {
-            return new NewInstrumentFactory(env);
-        }
-    }
-
     @Override
     protected RContext createContext(Env env) {
         // Currently using env.instrumenter as "initialized" flag
@@ -115,7 +101,7 @@ public final class TruffleRLanguage extends TruffleLanguage<RContext> {
             initialize();
             initialized = true;
         }
-        RContext result = RContext.create(env, initializeInstrument(env), initialContext);
+        RContext result = RContext.create(env, new NewInstrumentFactory(env), initialContext);
         return result;
     }
 
@@ -174,14 +160,12 @@ public final class TruffleRLanguage extends TruffleLanguage<RContext> {
 
     @Override
     protected boolean isInstrumentable(Node node) {
-        RNode rNode = (RNode) node;
-        return rNode.isRInstrumentable();
+        throw RInternalError.shouldNotReachHere();
     }
 
     @Override
     protected WrapperNode createWrapperNode(Node node) {
-        RNode rNode = (RNode) node;
-        return rNode.createRWrapperNode();
+        throw RInternalError.shouldNotReachHere();
     }
 
     @Override
diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastr/FastRTrace.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastr/FastRTrace.java
index be19555af0..0ed6d53c55 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastr/FastRTrace.java
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastr/FastRTrace.java
@@ -26,7 +26,7 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.r.nodes.RASTUtils;
 import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode;
-import com.oracle.truffle.r.nodes.instrument.trace.TraceHandling;
+import com.oracle.truffle.r.nodes.instrumentation.trace.TraceHandling;
 import com.oracle.truffle.r.runtime.ArgumentsSignature;
 import com.oracle.truffle.r.runtime.RError;
 import com.oracle.truffle.r.runtime.data.RFunction;
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java
index a488e57962..55af1d9ccb 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java
@@ -147,7 +147,8 @@ public abstract class DoCall extends RBuiltinNode {
         if (func.isBuiltin() && builtin.getGroup() != null) {
             if (groupDispatch == null) {
                 CompilerDirectives.transferToInterpreterAndInvalidate();
-                groupDispatch = insert(GroupDispatchNode.create(builtin.getName(), null, func, getOriginalCall().getSourceSection()));
+                /* This child is not being used in a syntax context so remove tags */
+                groupDispatch = insert(GroupDispatchNode.create(builtin.getName(), null, func, getOriginalCall().getSourceSection().withTags()));
             }
             for (int i = 0; i < argValues.length; i++) {
                 Object arg = argValues[i];
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadArgumentNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadArgumentNode.java
index 0802ec86ee..f35d257e03 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadArgumentNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadArgumentNode.java
@@ -23,13 +23,9 @@
 package com.oracle.truffle.r.nodes.access;
 
 import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.api.instrument.*;
-import com.oracle.truffle.r.nodes.instrument.wrappers.*;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.nodes.*;
-import com.oracle.truffle.r.runtime.nodes.instrument.NeedsWrapper;
 
-@NeedsWrapper
 public class ReadArgumentNode extends RNode {
 
     private final int index;
@@ -54,8 +50,4 @@ public class ReadArgumentNode extends RNode {
         return index;
     }
 
-    @Override
-    public WrapperNode createRWrapperNode() {
-        return new ReadArgumentNodeWrapper(this);
-    }
 }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteCurrentVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteCurrentVariableNode.java
index 105b730ef6..358697cd54 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteCurrentVariableNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteCurrentVariableNode.java
@@ -23,18 +23,15 @@
 package com.oracle.truffle.r.nodes.access;
 
 import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrument.WrapperNode;
 import com.oracle.truffle.api.nodes.NodeCost;
 import com.oracle.truffle.api.nodes.NodeInfo;
 import com.oracle.truffle.api.source.SourceSection;
 import com.oracle.truffle.r.nodes.RASTUtils;
-import com.oracle.truffle.r.nodes.instrument.wrappers.WriteCurrentVariableNodeWrapper;
 import com.oracle.truffle.r.runtime.ArgumentsSignature;
 import com.oracle.truffle.r.runtime.RDeparse.State;
 import com.oracle.truffle.r.runtime.RSerialize;
 import com.oracle.truffle.r.runtime.VisibilityController;
 import com.oracle.truffle.r.runtime.env.REnvironment;
-import com.oracle.truffle.r.runtime.nodes.instrument.NeedsWrapper;
 import com.oracle.truffle.r.runtime.nodes.RNode;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxCall;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxElement;
@@ -45,7 +42,6 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
  * The "syntax" variant corresponding to {@code x <- y} in the source.
  */
 @NodeInfo(cost = NodeCost.NONE)
-@NeedsWrapper
 public class WriteCurrentVariableNode extends WriteVariableNodeSyntaxHelper implements RSyntaxNode, RSyntaxCall, VisibilityController {
     @Child WriteLocalFrameVariableNode writeLocalFrameVariableNode;
 
@@ -60,19 +56,16 @@ public class WriteCurrentVariableNode extends WriteVariableNodeSyntaxHelper impl
     }
 
     @Override
-    @NeedsWrapper
     public Object getName() {
         return writeLocalFrameVariableNode.getName();
     }
 
     @Override
-    @NeedsWrapper
     public RNode getRhs() {
         return writeLocalFrameVariableNode.getRhs();
     }
 
     @Override
-    @NeedsWrapper
     public Object execute(VirtualFrame frame) {
         Object result = writeLocalFrameVariableNode.execute(frame);
         forceVisibility(false);
@@ -80,7 +73,6 @@ public class WriteCurrentVariableNode extends WriteVariableNodeSyntaxHelper impl
     }
 
     @Override
-    @NeedsWrapper
     public void execute(VirtualFrame frame, Object value) {
         writeLocalFrameVariableNode.execute(frame, value);
     }
@@ -111,11 +103,6 @@ public class WriteCurrentVariableNode extends WriteVariableNodeSyntaxHelper impl
         return create(RSyntaxNode.EAGER_DEPARSE, name, rhsSub);
     }
 
-    @Override
-    public WrapperNode createRWrapperNode() {
-        return new WriteCurrentVariableNodeWrapper(this);
-    }
-
     public RSyntaxElement getSyntaxLHS() {
         return RSyntaxLookup.createDummyLookup(null, "<-", true);
     }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperFrameVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperFrameVariableNode.java
index 58a6a21eee..9444996f2f 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperFrameVariableNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperFrameVariableNode.java
@@ -31,7 +31,6 @@ import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.api.nodes.Node.*;
 import com.oracle.truffle.api.profiles.*;
 import com.oracle.truffle.r.nodes.*;
-import com.oracle.truffle.r.nodes.instrument.*;
 import com.oracle.truffle.r.nodes.access.WriteVariableNode.Mode;
 import com.oracle.truffle.r.nodes.access.WriteLocalFrameVariableNodeFactory.UnresolvedWriteLocalFrameVariableNodeGen;
 import com.oracle.truffle.r.nodes.access.BaseWriteVariableNode.*;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperVariableNode.java
index a86cd0a6f4..be63588e27 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperVariableNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperVariableNode.java
@@ -23,18 +23,15 @@
 package com.oracle.truffle.r.nodes.access;
 
 import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrument.WrapperNode;
 import com.oracle.truffle.api.nodes.NodeCost;
 import com.oracle.truffle.api.nodes.NodeInfo;
 import com.oracle.truffle.api.source.SourceSection;
-import com.oracle.truffle.r.nodes.instrument.wrappers.WriteSuperVariableNodeWrapper;
 import com.oracle.truffle.r.runtime.ArgumentsSignature;
 import com.oracle.truffle.r.runtime.RDeparse.State;
 import com.oracle.truffle.r.runtime.RInternalError;
 import com.oracle.truffle.r.runtime.RSerialize;
 import com.oracle.truffle.r.runtime.VisibilityController;
 import com.oracle.truffle.r.runtime.env.REnvironment;
-import com.oracle.truffle.r.runtime.nodes.instrument.NeedsWrapper;
 import com.oracle.truffle.r.runtime.nodes.RNode;
 import com.oracle.truffle.r.runtime.nodes.RSourceSectionNode;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxCall;
@@ -50,7 +47,6 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
  * .
  */
 @NodeInfo(cost = NodeCost.NONE)
-@NeedsWrapper
 public class WriteSuperVariableNode extends WriteVariableNodeSyntaxHelper implements RSyntaxNode, RSyntaxCall, VisibilityController {
 
     @Child WriteVariableNode writeSuperFrameVariableNode;
@@ -66,19 +62,16 @@ public class WriteSuperVariableNode extends WriteVariableNodeSyntaxHelper implem
     }
 
     @Override
-    @NeedsWrapper
     public Object getName() {
         return writeSuperFrameVariableNode.getName();
     }
 
     @Override
-    @NeedsWrapper
     public RNode getRhs() {
         return writeSuperFrameVariableNode.getRhs();
     }
 
     @Override
-    @NeedsWrapper
     public Object execute(VirtualFrame frame) {
         Object result = writeSuperFrameVariableNode.execute(frame);
         forceVisibility(false);
@@ -86,7 +79,6 @@ public class WriteSuperVariableNode extends WriteVariableNodeSyntaxHelper implem
     }
 
     @Override
-    @NeedsWrapper
     public void execute(VirtualFrame frame, Object value) {
         writeSuperFrameVariableNode.execute(frame, value);
     }
@@ -107,11 +99,6 @@ public class WriteSuperVariableNode extends WriteVariableNodeSyntaxHelper implem
         throw RInternalError.unimplemented();
     }
 
-    @Override
-    public WrapperNode createRWrapperNode() {
-        return new WriteSuperVariableNodeWrapper(this);
-    }
-
     public RSyntaxElement getSyntaxLHS() {
         return RSyntaxLookup.createDummyLookup(null, "<<-", true);
     }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentsNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentsNode.java
index 21f59d9b7f..91ad434ec4 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentsNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentsNode.java
@@ -26,7 +26,6 @@ import java.util.*;
 
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.nodes.*;
-import com.oracle.truffle.r.runtime.nodes.instrument.NeedsWrapper;
 
 /**
  * Base class that represents a list of argument/name pairs with some convenience methods. Semantics
@@ -49,12 +48,10 @@ public abstract class ArgumentsNode extends RNode implements UnmatchedArguments
         assert signature != null;
     }
 
-    @NeedsWrapper
     public RNode[] getArguments() {
         return arguments;
     }
 
-    @NeedsWrapper
     public ArgumentsSignature getSignature() {
         return signature;
     }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java
index 41552050b2..002f71b4c6 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java
@@ -61,6 +61,7 @@ import com.oracle.truffle.r.nodes.builtin.RBuiltinRootNode;
 import com.oracle.truffle.r.nodes.function.MatchedArguments.MatchedArgumentsNode;
 import com.oracle.truffle.r.nodes.function.S3FunctionLookupNode.Result;
 import com.oracle.truffle.r.nodes.function.signature.RArgumentsNode;
+import com.oracle.truffle.r.nodes.instrumentation.RSyntaxTags;
 import com.oracle.truffle.r.nodes.runtime.RASTDeparse;
 import com.oracle.truffle.r.runtime.Arguments;
 import com.oracle.truffle.r.runtime.ArgumentsSignature;
@@ -264,7 +265,7 @@ public final class RCallNode extends RSourceSectionNode implements RSyntaxNode,
     @Child private CallArgumentsNode foreignCallArguments;
 
     public RCallNode(SourceSection sourceSection, RNode function, RSyntaxNode[] arguments, ArgumentsSignature signature) {
-        super(sourceSection);
+        super(sourceSection.withTags(RSyntaxTags.CALL));
         this.functionNode = function;
         this.arguments = new SyntaxArguments(arguments);
         this.signature = signature;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/OldInstrumentFactory.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/OldInstrumentFactory.java
deleted file mode 100644
index 40f1700e9b..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/OldInstrumentFactory.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrument;
-
-import com.oracle.truffle.api.TruffleLanguage;
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.StandardSyntaxTag;
-import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode;
-import com.oracle.truffle.r.nodes.instrument.debug.DebugHandling;
-import com.oracle.truffle.r.nodes.instrument.trace.TraceHandling;
-import com.oracle.truffle.r.runtime.FunctionUID;
-import com.oracle.truffle.r.runtime.RError;
-import com.oracle.truffle.r.runtime.WithFunctionUID;
-import com.oracle.truffle.r.runtime.context.RInstrumentFactory;
-import com.oracle.truffle.r.runtime.data.RFunction;
-
-public class OldInstrumentFactory extends RInstrumentFactory {
-
-    public OldInstrumentFactory(TruffleLanguage.Env env) {
-        RInstrument.initialize(env.instrumenter());
-        RASTProber prober = RInstrument.instrumentingEnabled() ? RASTProber.getRASTProber() : null;
-        if (prober != null) {
-            env.instrumenter().registerASTProber(prober);
-        }
-    }
-
-    private static FunctionUID getFunctionUID(RFunction fun) {
-        FunctionDefinitionNode fdn = (FunctionDefinitionNode) fun.getRootNode();
-        return fdn.getUID();
-    }
-
-    @Override
-    public void registerFunctionDefinitionNode(WithFunctionUID fdn) {
-        RInstrument.registerFunctionDefinition((FunctionDefinitionNode) fdn);
-    }
-
-    @Override
-    public void checkDebugRequested(RFunction func) {
-        RInstrument.checkDebugRequested(func);
-    }
-
-    @Override
-    public Object findSingleProbe(RFunction func, Object tag) {
-        return RInstrument.findSingleProbe(getFunctionUID(func), (StandardSyntaxTag) tag);
-    }
-
-    @Override
-    public boolean enableDebug(RFunction func, Object text, Object condition, boolean once) {
-        return DebugHandling.enableDebug(func, text, condition, once);
-    }
-
-    @Override
-    public boolean undebug(RFunction func) {
-        return DebugHandling.undebug(func);
-    }
-
-    @Override
-    public boolean isDebugged(RFunction func) {
-        return DebugHandling.isDebugged(func);
-    }
-
-    @Override
-    public boolean enableTrace(RFunction func) {
-        return TraceHandling.enableTrace(func);
-    }
-
-    @Override
-    public boolean disableTrace(RFunction func) {
-        return TraceHandling.disableTrace(func);
-    }
-
-    @Override
-    public void setTracingState(boolean state) {
-        TraceHandling.setTracingState(state);
-    }
-
-    @Override
-    public boolean installCounter(RFunction func) {
-        FunctionUID uuid = getFunctionUID(func);
-        if (REntryCounters.findCounter(uuid) == null) {
-            Probe probe = RInstrument.findSingleProbe(uuid, StandardSyntaxTag.START_METHOD);
-            if (probe == null) {
-                return false;
-            }
-            REntryCounters.Function counter = new REntryCounters.Function(uuid);
-            RInstrument.getInstrumenter().attach(probe, counter, REntryCounters.Function.INFO);
-        }
-        return true;
-    }
-
-    @Override
-    public int getCounter(RFunction func) {
-        REntryCounters.Function counter = (REntryCounters.Function) REntryCounters.findCounter(getFunctionUID(func));
-        if (counter == null) {
-            return -1;
-        } else {
-            return counter.getEnterCount();
-        }
-    }
-
-    @Override
-    public boolean installFunctionTimer(RFunction func) {
-        throw RError.nyi(RError.NO_CALLER, "installFunctionTimer");
-    }
-
-    @Override
-    public long getFunctionTime(RFunction func) {
-        return 0;
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RASTProber.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RASTProber.java
deleted file mode 100644
index 14cd6799a6..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RASTProber.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrument;
-
-import static com.oracle.truffle.api.instrument.StandardSyntaxTag.*;
-
-import com.oracle.truffle.api.instrument.*;
-import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.api.source.SourceSection;
-import com.oracle.truffle.r.nodes.control.*;
-import com.oracle.truffle.r.nodes.function.*;
-import com.oracle.truffle.r.runtime.*;
-import com.oracle.truffle.r.runtime.nodes.*;
-
-/**
- * A visitor which traverses a completely parsed R AST (presumed not yet executed) and attaches
- * {@linkplain Probe Probes} at some of them for use by the instrumentation framework.
- *
- * Syntax nodes in {@link SequenceNode}s are tagged with {@link StandardSyntaxTag#STATEMENT}.
- * {@link FunctionStatementsNode}s are tagged with {@link StandardSyntaxTag#START_METHOD} which
- * allows the debugger to pause after the arguments have been saved in the frame.
- *
- * N.B. The calls to {@code probe()} insert a {@link WrapperNode} as the parent of the associated
- * node.
- */
-public final class RASTProber implements ASTProber {
-
-    private static final RASTProber singleton = new RASTProber();
-
-    private RASTProber() {
-    }
-
-    public static RASTProber getRASTProber() {
-        return singleton;
-    }
-
-    public void probeAST(Instrumenter instrumenter, RootNode rootNode) {
-        if (rootNode instanceof FunctionDefinitionNode) {
-            FunctionDefinitionNode fdn = (FunctionDefinitionNode) rootNode;
-            if (!fdn.getInstrumented()) {
-                RSyntaxNode body = fdn.getBody();
-                if (body.getSourceSection() == null || body.getSourceSection() == RSyntaxNode.SOURCE_UNAVAILABLE) {
-                    // Can't instrument AST (bodies) without a SourceSection
-                    if (FastROptions.debugMatches("RASTProberNoSource")) {
-                        RDeparse.State state = RDeparse.State.createPrintableState();
-                        fdn.deparseImpl(state);
-                        System.out.printf("No source sections for %s, can't instrument%n", fdn);
-                        System.out.println(state.toString());
-                    }
-                    fdn.setInstrumented();
-                    return;
-                }
-                RInstrument.registerFunctionDefinition(fdn);
-                FunctionUID uid = fdn.getUID();
-                instrumenter.probe(body.asNode()).tagAs(START_METHOD, uid);
-                TaggingNodeVisitor visitor = new TaggingNodeVisitor(uid, instrumenter);
-                if (FastROptions.debugMatches("RASTProberTag")) {
-                    System.out.printf("Tagging function uid %s%n", uid);
-                }
-                RSyntaxNode.accept(body.asNode(), 0, visitor, false);
-                fdn.setInstrumented();
-            }
-        }
-    }
-
-    public abstract static class StatementVisitor implements RSyntaxNodeVisitor {
-        protected final FunctionUID uid;
-
-        StatementVisitor(FunctionUID uid) {
-            this.uid = uid;
-        }
-
-        @Override
-        public boolean visit(RSyntaxNode node, int depth) {
-            if (node instanceof BlockNode) {
-                BlockNode sequenceNode = (BlockNode) node;
-                RNode[] block = sequenceNode.getSequence();
-                for (int i = 0; i < block.length; i++) {
-                    RSyntaxNode n = block[i].unwrap().asRSyntaxNode();
-                    if (n.getSourceSection() != null) {
-                        if (!callback(n)) {
-                            return false;
-                        }
-                    }
-                }
-            }
-            return true;
-        }
-
-        protected abstract boolean callback(RSyntaxNode node);
-
-    }
-
-    public static class TaggingNodeVisitor extends StatementVisitor {
-        private Instrumenter instrumenter;
-
-        TaggingNodeVisitor(FunctionUID uid, Instrumenter instrumenter) {
-            super(uid);
-            this.instrumenter = instrumenter;
-        }
-
-        @Override
-        public boolean visit(RSyntaxNode node, int depth) {
-            super.visit(node, depth);
-            if (node instanceof RCallNode) {
-                if (node.getSourceSection() != null) {
-                    tagNode(node, CALL);
-                }
-            }
-            return true;
-        }
-
-        private void tagNode(RSyntaxNode node, StandardSyntaxTag tag) {
-            RInstrument.NodeId nodeId = new RInstrument.NodeId(uid, node);
-            instrumenter.probe(node.asRNode()).tagAs(tag, new RInstrument.NodeId(uid, node));
-            if (FastROptions.debugMatches("RASTProberTag")) {
-                SourceSection ss = node.getSourceSection();
-                System.out.printf("Tagged %s @line %d as %s: %s%n", node.getClass().getSimpleName(), ss.getStartLine(), tag, nodeId.toString());
-            }
-
-        }
-
-        @Override
-        protected boolean callback(RSyntaxNode node) {
-            tagNode(node, STATEMENT);
-            return true;
-        }
-
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/REntryCounters.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/REntryCounters.java
deleted file mode 100644
index 58ada5ad6c..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/REntryCounters.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrument;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.SimpleInstrumentListener;
-import com.oracle.truffle.r.runtime.FunctionUID;
-import com.oracle.truffle.r.runtime.RPerfStats;
-
-/**
- * Basic support for adding entry/exit counters to nodes. A counter must be identified with some
- * unique value that enables it to be retrieved.
- *
- */
-public class REntryCounters {
-
-    private static HashMap<Object, Basic> counterMap = new HashMap<>();
-    public static final String INFO = "R node entry counter";
-
-    public static class Basic implements SimpleInstrumentListener {
-
-        protected int enterCount;
-        protected int exitCount;
-
-        public Basic(Object tag) {
-            counterMap.put(tag, this);
-        }
-
-        @Override
-        public void onEnter(Probe probe) {
-            enterCount++;
-        }
-
-        private void returnAny(@SuppressWarnings("unused") Probe probe) {
-            exitCount++;
-        }
-
-        @Override
-        public void onReturnVoid(Probe probe) {
-            returnAny(probe);
-        }
-
-        @Override
-        public void onReturnValue(Probe probe, Object result) {
-            returnAny(probe);
-        }
-
-        @Override
-        public void onReturnExceptional(Probe probe, Throwable exception) {
-            returnAny(probe);
-        }
-
-        public int getEnterCount() {
-            return enterCount;
-        }
-
-        public int getExitCount() {
-            return exitCount;
-        }
-    }
-
-    /**
-     * A counter that is specialized for function entry, tagged with the {@link FunctionUID}.
-     */
-    public static class Function extends Basic {
-        public static final String INFO = "R function entry counter";
-
-        static {
-            RPerfStats.register(new PerfHandler());
-        }
-
-        private static class PerfHandler implements RPerfStats.Handler {
-            private static class FunctionCount implements Comparable<FunctionCount> {
-                int count;
-                String name;
-
-                FunctionCount(int count, String name) {
-                    this.count = count;
-                    this.name = name;
-                }
-
-                public int compareTo(FunctionCount o) {
-                    if (count < o.count) {
-                        return 1;
-                    } else if (count > o.count) {
-                        return -1;
-                    } else {
-                        return name.compareTo(o.name);
-                    }
-                }
-            }
-
-            static final String NAME = "functioncounts";
-
-            public void initialize(String optionText) {
-            }
-
-            public String getName() {
-                return NAME;
-            }
-
-            /**
-             * R's anonymous function definitions don't help with reporting. We make an attempt to
-             * locate a function name in the global/package environments.
-             */
-            public void report() {
-                RPerfStats.out().println("R Function Entry Counts");
-                ArrayList<FunctionCount> results = new ArrayList<>();
-                for (Map.Entry<Object, Basic> entry : counterMap.entrySet()) {
-                    if (entry.getValue() instanceof Function) {
-                        FunctionUID uid = (FunctionUID) entry.getKey();
-                        RInstrument.FunctionIdentification fdi = RInstrument.getFunctionIdentification(uid);
-                        int count = entry.getValue().getEnterCount();
-                        if (count > 0) {
-                            results.add(new FunctionCount(count, fdi.name));
-                        }
-                    }
-                }
-                FunctionCount[] sortedCounts = new FunctionCount[results.size()];
-                results.toArray(sortedCounts);
-                Arrays.sort(sortedCounts);
-                for (FunctionCount functionCount : sortedCounts) {
-                    RPerfStats.out().printf("%6d: %s%n", functionCount.count, functionCount.name);
-                }
-            }
-        }
-
-        public Function(FunctionUID uuid) {
-            super(uuid);
-        }
-
-        public static boolean enabled() {
-            return RPerfStats.enabled(PerfHandler.NAME);
-        }
-
-    }
-
-    /**
-     * Return the counter tagged with {@code tag}, or {@code null} if not found.
-     */
-    public static REntryCounters.Basic findCounter(Object tag) {
-        return counterMap.get(tag);
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RInstrument.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RInstrument.java
deleted file mode 100644
index 6592d956f3..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RInstrument.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrument;
-
-import java.util.*;
-
-import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
-import com.oracle.truffle.api.instrument.*;
-import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.api.source.*;
-import com.oracle.truffle.r.nodes.function.*;
-import com.oracle.truffle.r.nodes.instrument.debug.*;
-import com.oracle.truffle.r.nodes.instrument.trace.*;
-import com.oracle.truffle.r.runtime.*;
-import com.oracle.truffle.r.runtime.data.*;
-import com.oracle.truffle.r.runtime.env.*;
-import com.oracle.truffle.r.runtime.instrument.*;
-import com.oracle.truffle.r.runtime.nodes.*;
-
-/**
- * Handles the initialization of the instrumentation system which sets up various instruments
- * depending on command line options.
- *
- */
-public class RInstrument {
-
-    /**
-     * Collects together all the relevant data for a function, keyed by the {@link FunctionUID},
-     * which is unique.
-     */
-    private static Map<FunctionUID, FunctionData> functionMap = new HashMap<>();
-
-    public static class FunctionIdentification {
-        public final Source source;
-        public final String name;
-        public final String origin;
-        public final FunctionDefinitionNode node;
-
-        FunctionIdentification(Source source, String name, String origin, FunctionDefinitionNode node) {
-            this.source = source;
-            this.name = name;
-            this.origin = origin;
-            this.node = node;
-        }
-    }
-
-    private static class FunctionData {
-        private final FunctionUID uid;
-        private final FunctionDefinitionNode fdn;
-        private ArrayList<Probe> probes = new ArrayList<>();
-        private FunctionIdentification ident;
-
-        FunctionData(FunctionUID uid, FunctionDefinitionNode fdn) {
-            this.uid = uid;
-            this.fdn = fdn;
-        }
-
-        private FunctionIdentification getIdentification() {
-            if (ident == null) {
-                SourceSection ss = fdn.getSourceSection();
-                /*
-                 * The default for "name" is the description associated with "fdn". If the function
-                 * was parsed from text this will be the variable name the function value was
-                 * assigned to, or the first 40 characters of the definition if anonymous.
-                 */
-                String idName = fdn.toString();
-                Source idSource = null;
-                String idOrigin = null;
-                if (ss != null) {
-                    idSource = ss.getSource();
-                    String sourceName = idSource.getName();
-                    idOrigin = sourceName;
-                    if (sourceName.startsWith("<package:")) {
-                        // try to find the name in the package environments
-                        // format of sourceName is "<package"xxx deparse>"
-                        String functionName = findFunctionName(uid, sourceName.substring(1, sourceName.lastIndexOf(' ')));
-                        if (functionName != null) {
-                            idName = functionName;
-                        }
-                    } else {
-                        idOrigin = sourceName;
-                    }
-                } else {
-                    // One of the RSyntaxNode "unavailable"s.
-                    idOrigin = idName;
-                    idSource = Source.fromText(idName, idName);
-                }
-                ident = new FunctionIdentification(idSource, idName, idOrigin, fdn);
-            }
-            return ident;
-
-        }
-    }
-
-    /**
-     * Abstracts how nodes are identified in instrumentation maps.
-     */
-    public static class NodeId {
-        public final FunctionUID uid;
-        public final int charIndex;
-
-        NodeId(FunctionUID uid, RSyntaxNode node) {
-            this.uid = uid;
-            SourceSection ss = node.getSourceSection();
-            RInternalError.guarantee(ss != null);
-            this.charIndex = ss.getCharIndex();
-        }
-
-        @Override
-        public int hashCode() {
-            return uid.hashCode() ^ charIndex;
-        }
-
-        @Override
-        public boolean equals(Object other) {
-            if (other instanceof NodeId) {
-                NodeId otherNodeId = (NodeId) other;
-                return otherNodeId.uid.equals(uid) && otherNodeId.charIndex == charIndex;
-            } else {
-                return false;
-            }
-        }
-
-        @Override
-        public String toString() {
-            return Integer.toString(charIndex);
-        }
-    }
-
-    private static class RProbeListener implements ProbeListener {
-
-        @Override
-        public void startASTProbing(RootNode rootNode) {
-        }
-
-        @Override
-        public void newProbeInserted(Probe probe) {
-        }
-
-        @Override
-        public void probeTaggedAs(Probe probe, SyntaxTag tag, Object tagValue) {
-            if (tag == StandardSyntaxTag.START_METHOD) {
-                putProbe((FunctionUID) tagValue, probe);
-                if (FastROptions.TraceCalls.getBooleanValue()) {
-                    TraceHandling.attachTraceHandler((FunctionUID) tagValue);
-                }
-                if (REntryCounters.Function.enabled()) {
-                    getInstrumenter().attach(probe, new REntryCounters.Function((FunctionUID) tagValue), "R function entry counter");
-                }
-            } else if (tag == StandardSyntaxTag.STATEMENT) {
-                if (RNodeTimer.Statement.enabled()) {
-                    getInstrumenter().attach(probe, new RNodeTimer.Statement((NodeId) tagValue), RNodeTimer.Statement.INFO);
-                }
-            }
-        }
-
-        @Override
-        public void endASTProbing(RootNode rootNode) {
-        }
-
-    }
-
-    @CompilationFinal private static Instrumenter instrumenter;
-
-    /**
-     * Controls whether ASTs are instrumented after parse. The default value controlled by
-     * {@code FastROptions.Option.Instrument}.
-     */
-    @CompilationFinal private static boolean instrumentingEnabled;
-
-    /**
-     * The function names that were requested to be used in implicit {@code debug(f)} calls, when
-     * those functions are defined.
-     */
-    @CompilationFinal private static String[] debugFunctionNames;
-
-    /**
-     * Called back from {@link RASTProber} so that we can record the {@link FunctionUID} and use
-     * {@code fdn} as the canonical {@link FunctionDefinitionNode}.
-     *
-     * @param fdn
-     */
-    public static void registerFunctionDefinition(FunctionDefinitionNode fdn) {
-        FunctionUID uid = fdn.getUID();
-        FunctionData fd = functionMap.get(uid);
-        // Owing to FDN duplication, fdn may be registered multiple times
-        if (fd == null) {
-            functionMap.put(uid, new FunctionData(uid, fdn));
-        }
-    }
-
-    public static FunctionIdentification getFunctionIdentification(FunctionUID uid) {
-        return functionMap.get(uid).getIdentification();
-    }
-
-    private static void putProbe(FunctionUID uid, Probe probe) {
-        ArrayList<Probe> list = functionMap.get(uid).probes;
-        list.add(probe);
-    }
-
-    /**
-     * Initialize the instrumentation system. {@link RASTProber} is registered to tag interesting
-     * nodes. {@link RProbeListener} is added to (optionally) add probes to nodes tagged by
-     * {@link RASTProber}.
-     *
-     * As a convenience we force {@link #instrumentingEnabled} on if those {@code RPerfStats}
-     * features that need it are also enabled.
-     */
-    public static void initialize(Instrumenter instrumenterArg) {
-        instrumenter = instrumenterArg;
-        instrumentingEnabled = FastROptions.Instrument.getBooleanValue() || FastROptions.TraceCalls.getBooleanValue() || FastROptions.Rdebug.getStringValue() != null ||
-                        REntryCounters.Function.enabled() || RNodeTimer.Statement.enabled();
-        if (instrumentingEnabled) {
-            instrumenter.addProbeListener(new RProbeListener());
-        }
-        if (instrumentingEnabled || FastROptions.LoadPkgSourcesIndex.getBooleanValue()) {
-            RPackageSource.initialize();
-        }
-        String rdebugValue = FastROptions.Rdebug.getStringValue();
-        if (rdebugValue != null) {
-            debugFunctionNames = rdebugValue.split(",");
-        }
-    }
-
-    public static Instrumenter getInstrumenter() {
-        return instrumenter;
-    }
-
-    public static boolean instrumentingEnabled() {
-        return instrumentingEnabled;
-    }
-
-    public static void checkDebugRequested(RFunction func) {
-        if (debugFunctionNames != null) {
-            FunctionDefinitionNode fdn = (FunctionDefinitionNode) func.getRootNode();
-            for (String debugFunctionName : debugFunctionNames) {
-                if (debugFunctionName.equals(fdn.toString())) {
-                    DebugHandling.enableDebug(func, "", RNull.instance, false);
-                }
-            }
-        }
-    }
-
-    /**
-     * Returns the {@link Probe} with the given tag for the given function, or {@code null} if not
-     * found.
-     */
-    public static Probe findSingleProbe(FunctionUID uid, SyntaxTag tag) {
-        if (!instrumentingEnabled) {
-            return null;
-        }
-        ArrayList<Probe> list = functionMap.get(uid).probes;
-        if (list != null) {
-            for (Probe probe : list) {
-                if (probe.isTaggedAs(tag)) {
-                    return probe;
-                }
-            }
-        }
-        return null;
-    }
-
-    private static Map<FunctionUID, String> functionNameMap;
-
-    /**
-     * Attempts to locate a name for an (assumed) builtin or global function. Returns {@code null}
-     * if not found.
-     */
-    private static String findFunctionName(FunctionUID uid, String packageName) {
-        if (functionNameMap == null) {
-            functionNameMap = new HashMap<>();
-        }
-        String name = functionNameMap.get(uid);
-        if (name == null) {
-            name = findFunctionInPackage(uid, packageName);
-        }
-        return name;
-    }
-
-    /**
-     * Try to find the function identified by uid in the given package. N.B. If we have the uid, the
-     * promise identifying the lazily loaded function must have been evaluated! So there is no need
-     * to evaluate any promises. N.B. For packages, we must use the namespace env as that contains
-     * public and private functions.
-     */
-    private static String findFunctionInPackage(FunctionUID uid, String packageName) {
-        if (packageName == null) {
-            return findFunctionInEnv(uid, REnvironment.globalEnv());
-        }
-        REnvironment env = REnvironment.lookupOnSearchPath(packageName);
-        env = env.getPackageNamespaceEnv();
-        return findFunctionInEnv(uid, env);
-    }
-
-    private static String findFunctionInEnv(FunctionUID uid, REnvironment env) {
-        // This is rather inefficient, but it doesn't matter
-        RStringVector names = env.ls(true, null, false);
-        for (int i = 0; i < names.getLength(); i++) {
-            String name = names.getDataAt(i);
-            Object val = env.get(name);
-            if (val instanceof RPromise) {
-                RPromise prVal = (RPromise) val;
-                if (prVal.isEvaluated()) {
-                    val = prVal.getValue();
-                } else {
-                    continue;
-                }
-            }
-            if (val instanceof RFunction) {
-                RFunction func = (RFunction) val;
-                RootNode rootNode = func.getRootNode();
-                if (rootNode instanceof FunctionDefinitionNode) {
-                    FunctionDefinitionNode fdn = (FunctionDefinitionNode) rootNode;
-                    if (fdn.getUID().equals(uid)) {
-                        functionNameMap.put(fdn.getUID(), name);
-                        return name;
-                    }
-                }
-            }
-        }
-        // Most likely a nested function, which is ok
-        // because they are not lazy and so have names from the parser.
-        return null;
-    }
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RNodeTimer.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RNodeTimer.java
deleted file mode 100644
index 9edb426ded..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/RNodeTimer.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrument;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
-
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.SimpleInstrumentListener;
-import com.oracle.truffle.api.source.SourceSection;
-import com.oracle.truffle.r.nodes.instrument.RInstrument.FunctionIdentification;
-import com.oracle.truffle.r.nodes.instrument.RInstrument.NodeId;
-import com.oracle.truffle.r.runtime.FastROptions;
-import com.oracle.truffle.r.runtime.FunctionUID;
-import com.oracle.truffle.r.runtime.RPerfStats;
-import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
-
-/**
- * Basic support for adding as timer to a node. A timer must be identified with some unique value
- * that enables it to be retrieved.
- *
- * The instrument records the cumulative time spent executing this node during the process execution
- * using {@link System#nanoTime()}.
- *
- */
-
-public class RNodeTimer {
-    private static HashMap<Object, Basic> timerMap = new HashMap<>();
-
-    public static class Basic implements SimpleInstrumentListener {
-
-        public static final String INFO = "R node timer";
-
-        protected long enterTime;
-        protected long cumulativeTime;
-
-        public Basic(RInstrument.NodeId tag) {
-            timerMap.put(tag, this);
-        }
-
-        @Override
-        public void onEnter(Probe probe) {
-            enterTime = System.nanoTime();
-        }
-
-        private void returnAny(@SuppressWarnings("unused") Probe probe) {
-            cumulativeTime += System.nanoTime() - enterTime;
-        }
-
-        @Override
-        public void onReturnVoid(Probe probe) {
-            returnAny(probe);
-        }
-
-        @Override
-        public void onReturnValue(Probe probe, Object result) {
-            returnAny(probe);
-        }
-
-        @Override
-        public void onReturnExceptional(Probe probe, Throwable exception) {
-            returnAny(probe);
-        }
-
-        public long getTime() {
-            return cumulativeTime;
-        }
-
-    }
-
-    public static class Statement extends Basic {
-        public Statement(RInstrument.NodeId tag) {
-            super(tag);
-        }
-
-        static {
-            RPerfStats.register(new PerfHandler());
-        }
-
-        private static class TimingData implements Comparable<TimingData> {
-            long time;
-            FunctionUID functionUID;
-
-            TimingData(FunctionUID functionUID) {
-                this.functionUID = functionUID;
-            }
-
-            void addTime(long t) {
-                this.time += t;
-            }
-
-            public int compareTo(TimingData o) {
-                if (time < o.time) {
-                    return 1;
-                } else if (time > o.time) {
-                    return -1;
-                } else {
-                    return 0;
-                }
-            }
-        }
-
-        private static class PerfHandler implements RPerfStats.Handler {
-            static final String NAME = "timing";
-            private boolean stmts;
-            private int threshold;
-
-            public void initialize(String optionText) {
-                if (optionText.length() > 0) {
-                    String[] subOptions = optionText.split(":");
-                    for (String subOption : subOptions) {
-                        if (subOption.equals("stmts")) {
-                            stmts = true;
-                        } else if (subOption.startsWith("threshold")) {
-                            threshold = Integer.parseInt(subOption.substring(subOption.indexOf('=') + 1)) * 1000;
-                        }
-                    }
-                }
-            }
-
-            public String getName() {
-                return NAME;
-            }
-
-            /**
-             * Report the statement timing information at the end of the run. The report is per
-             * function {@link FunctionUID}, which uniquely defines a function in the face of call
-             * target splitting. Functions that consumed less time than requested threshold (default
-             * 0) are not included in the report. The report is sorted by cumulative time.
-             */
-            public void report() {
-                Map<FunctionUID, TimingData> functionMap = new TreeMap<>();
-
-                for (Map.Entry<Object, Basic> entry : timerMap.entrySet()) {
-                    if (entry.getValue() instanceof Statement) {
-                        NodeId nodeId = (NodeId) entry.getKey();
-                        TimingData timingData = functionMap.get(nodeId.uid);
-                        if (timingData == null) {
-                            timingData = new TimingData(nodeId.uid);
-                            functionMap.put(nodeId.uid, timingData);
-                        }
-                        timingData.addTime(millis(entry.getValue().cumulativeTime));
-                    }
-                }
-
-                Collection<TimingData> values = functionMap.values();
-                TimingData[] sortedData = new TimingData[values.size()];
-                values.toArray(sortedData);
-                Arrays.sort(sortedData);
-                long totalTime = 0;
-                for (TimingData t : sortedData) {
-                    totalTime += t.time;
-                }
-
-                for (TimingData t : sortedData) {
-                    if (t.time > 0) {
-                        if (t.time > threshold) {
-                            FunctionIdentification fdi = RInstrument.getFunctionIdentification(t.functionUID);
-                            /*
-                             * Currently a problem with the way source sections are used in some
-                             * promises and eval wrappers, that cause ArrayIndexOutOfBounds
-                             * exceptions.
-                             */
-                            if (!(fdi.name.equals("<promise>") || fdi.name.equals("<eval wrapper>"))) {
-                                RPerfStats.out().println("==========");
-                                RPerfStats.out().printf("%d ms (%.2f%%): %s, %s%n", t.time, percent(t.time, totalTime), fdi.name, fdi.origin);
-                                if (stmts) {
-                                    SourceSection ss = fdi.node.getSourceSection();
-                                    if (ss == null) {
-                                        // wrapper
-                                        ss = fdi.node.getBody().getSourceSection();
-                                        if (ss == null) {
-                                            RPerfStats.out().println("no source available");
-                                        }
-                                    } else {
-                                        long[] time = createLineTimes(fdi);
-                                        int startLine = ss.getStartLine();
-                                        int lastLine = ss.getEndLine();
-                                        for (int i = startLine; i <= lastLine; i++) {
-                                            RPerfStats.out().printf("%8dms: %s%n", time[i], fdi.source.getCode(i));
-                                        }
-
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        private static double percent(long a, long b) {
-            return ((double) a * 100) / b;
-        }
-
-        private static class LineTimesNodeVisitor extends RASTProber.StatementVisitor {
-            private final long[] times;
-
-            LineTimesNodeVisitor(FunctionUID uid, long[] time) {
-                super(uid);
-                this.times = time;
-            }
-
-            @Override
-            protected boolean callback(RSyntaxNode node) {
-                SourceSection ss = node.getSourceSection();
-                if (ss != null) {
-                    NodeId nodeId = new NodeId(uid, node);
-                    Statement stmt = (Statement) timerMap.get(nodeId);
-                    if (stmt != null) {
-                        assert ss.getStartLine() != 0;
-                        long stmtTime = millis(stmt.cumulativeTime);
-                        times[0] += stmtTime;
-                        times[ss.getStartLine()] += stmtTime;
-                    } else {
-                        /*
-                         * This happens because default arguments are not visited during the AST
-                         * probe walk.
-                         */
-                        if (FastROptions.debugMatches("nodetimer")) {
-                            System.out.printf("Failed to find map entry: %s%n", nodeId);
-                            System.out.printf("Map entries for function: %s%n", uid);
-                            for (Map.Entry<Object, Basic> entry : timerMap.entrySet()) {
-                                NodeId nid = (NodeId) entry.getKey();
-                                if (nid.uid.equals(uid)) {
-                                    System.out.printf("%d%n", nid.charIndex);
-                                }
-                            }
-                        }
-                    }
-                }
-                return true;
-            }
-        }
-
-        private static long millis(long nanos) {
-            return nanos / 1000000;
-        }
-
-        private static long[] createLineTimes(FunctionIdentification fdi) {
-            /*
-             * Although only those lines occupied by the function will actually have entries in the
-             * array, addressing is easier if we allocate an array that is as long as the entire
-             * source. Since there is never a line 0, we use that to compute the total.
-             */
-            final long[] times = new long[fdi.source.getLineCount() + 1];
-            RSyntaxNode.accept(fdi.node.getBody().asNode(), 0, new LineTimesNodeVisitor(fdi.node.getUID(), times), false);
-            return times;
-        }
-
-        public static boolean enabled() {
-            return RPerfStats.enabled(PerfHandler.NAME);
-        }
-
-        /**
-         * Return the timer tagged with {@code tag}, or {@code null} if not found.
-         */
-        public static RNodeTimer.Basic findTimer(Object tag) {
-            return timerMap.get(tag);
-        }
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/debug/DebugHandling.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/debug/DebugHandling.java
deleted file mode 100644
index 5325fe0f2f..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/debug/DebugHandling.java
+++ /dev/null
@@ -1,571 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrument.debug;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.WeakHashMap;
-
-import com.oracle.truffle.api.Assumption;
-import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
-import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrument.Instrumenter;
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.ProbeInstrument;
-import com.oracle.truffle.api.instrument.StandardBeforeInstrumentListener;
-import com.oracle.truffle.api.instrument.StandardInstrumentListener;
-import com.oracle.truffle.api.instrument.StandardSyntaxTag;
-import com.oracle.truffle.api.instrument.TagInstrument;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.NodeVisitor;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.source.SourceSection;
-import com.oracle.truffle.api.utilities.CyclicAssumption;
-import com.oracle.truffle.r.nodes.control.AbstractLoopNode;
-import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode;
-import com.oracle.truffle.r.nodes.function.FunctionStatementsNode;
-import com.oracle.truffle.r.nodes.instrument.RInstrument;
-import com.oracle.truffle.r.runtime.FunctionUID;
-import com.oracle.truffle.r.runtime.RArguments;
-import com.oracle.truffle.r.runtime.RDeparse;
-import com.oracle.truffle.r.runtime.RError;
-import com.oracle.truffle.r.runtime.RInternalError;
-import com.oracle.truffle.r.runtime.conn.StdConnections;
-import com.oracle.truffle.r.runtime.context.ConsoleHandler;
-import com.oracle.truffle.r.runtime.context.RContext;
-import com.oracle.truffle.r.runtime.data.RFunction;
-import com.oracle.truffle.r.runtime.instrument.Browser;
-import com.oracle.truffle.r.runtime.nodes.RBaseNode;
-
-/**
- * The implementation of the R debug functions.
- *
- * When a function is enabled for debugging a set of {@link DebugEventReceiver}s are created and
- * associated with {@link ProbeInstrument}s and attached to key nodes in the AST body associated
- * with the {@link FunctionDefinitionNode} corresponding to the {@link RFunction} instance.
- *
- * Two different receiver classes are defined:
- * <ul>
- * <li>{@link FunctionStatementsEventReceiver}: attaches to {@link FunctionStatementsNode} and
- * handles the special behavior on entry/exit</li>
- * <li>{@link StatementEventReceiver}: attaches to all {@link StandardSyntaxTag#STATEMENT} nodes and
- * handles "n" and "s" browser commands</li>
- * <li>{@link LoopStatementEventReceiver}: attaches to {@link AbstractLoopNode} instances and
- * handles special "f" command behavior.
- * </ul>
- * <p>
- * Step Into is slightly tricky because, at the point the command is issued, we do not know what
- * function the call will resolve to. There are two solutions to this:
- * <ul>
- * <li></li>Use the global trap mechanism of the instrumentation framework to force entry to
- * <b>any</b> function. This is enabled on a step into command and immediately disabled on taking
- * the trap (cf hardware single step).
- * <li></li>A callback from the {@code execute} method of {@link FunctionDefinitionNode}, which acts
- * as if {@code debugonce} had been called by the user (unless debug was already enabled in which
- * case there is nothing to do). This has been prototyped but it is not clear it provides sufficient
- * value for the added complexity..
- * <p>
- * When invoked from within a loop The "f" command continues the loop body without entry and the
- * re-enables entry. This is handled by creating a {@link LoopStatementEventReceiver} per
- * {@link AbstractLoopNode}. On a "f" every receiver <b>except</b> the one associated with that loop
- * is disabled. On return from the loop, everything is re-enabled.
- * <p>
- * Currently, {@code debugonce} and {@code undebug} are handled by disabling the receiver behavior.
- * Any change in enabled state is managed by an {@link Assumption} which will invalidate the code of
- * the receiver. In the case where events are disabled there should be no compilation overhead from
- * the receivers.
- */
-public class DebugHandling {
-
-    /**
-     * Records all functions that have debug receivers installed.
-     */
-    private static final WeakHashMap<FunctionUID, FunctionStatementsEventReceiver> receiverMap = new WeakHashMap<>();
-
-    /**
-     * This flag is used to (temporarily) disable all debugging across calls that are used
-     * internally in the implementation.
-     */
-    private static boolean globalDisable;
-
-    /**
-     * Attach the DebugHandling instrument to the FunctionStatementsNode and all syntactic nodes.
-     */
-    public static boolean enableDebug(RFunction func, Object text, Object condition, boolean once) {
-        FunctionDefinitionNode fdn = (FunctionDefinitionNode) func.getRootNode();
-        FunctionStatementsEventReceiver fbr = receiverMap.get(fdn.getUID());
-        if (fbr == null) {
-            Probe probe = attachDebugHandler(fdn, text, condition, once);
-            return probe != null;
-        } else {
-            fbr.enable();
-            return true;
-        }
-    }
-
-    public static boolean undebug(RFunction func) {
-        FunctionStatementsEventReceiver fbr = receiverMap.get(((FunctionDefinitionNode) func.getRootNode()).getUID());
-        if (fbr == null) {
-            return false;
-        } else {
-            fbr.disable();
-            return true;
-        }
-    }
-
-    public static boolean isDebugged(RFunction func) {
-        FunctionStatementsEventReceiver fser = receiverMap.get(((FunctionDefinitionNode) func.getRootNode()).getUID());
-        return fser != null && !fser.disabled();
-    }
-
-    /**
-     * Disables/enables debugging globally. Intended to be used for short period, typically while
-     * executing functions used internally by the implementation.
-     *
-     * @param disable {@code true} to disable, {@code false} to enable.
-     * @return the current value (default {@code false}.
-     */
-    public static boolean globalDisable(boolean disable) {
-        boolean current = globalDisable;
-        globalDisable = disable;
-        return current;
-    }
-
-    private static Probe findStartMethodProbe(FunctionDefinitionNode fdn) {
-        return RInstrument.findSingleProbe(fdn.getUID(), StandardSyntaxTag.START_METHOD);
-    }
-
-    private static Probe attachDebugHandler(FunctionDefinitionNode fdn, Object text, Object condition, boolean once) {
-        Probe probe = findStartMethodProbe(fdn);
-        if (probe == null) {
-            return null;
-        }
-        FunctionStatementsEventReceiver fser = new FunctionStatementsEventReceiver(fdn, text, condition, once);
-        Instrumenter instrumenter = RInstrument.getInstrumenter();
-        instrumenter.attach(probe, fser, "debug");
-        attachToStatementNodes(fser, instrumenter);
-        return probe;
-    }
-
-    private static void ensureSingleStep(FunctionDefinitionNode fdn) {
-        FunctionStatementsEventReceiver fbr = receiverMap.get(fdn.getUID());
-        if (fbr == null) {
-            attachDebugHandler(fdn, null, null, true);
-        } else {
-            if (fbr.disabled()) {
-                fbr.enable();
-            }
-        }
-    }
-
-    private static void attachToStatementNodes(FunctionStatementsEventReceiver functionStatementsEventReceiver, Instrumenter instrumenter) {
-        functionStatementsEventReceiver.getFunctionDefinitionNode().getBody().asNode().accept(new NodeVisitor() {
-            public boolean visit(Node node) {
-                if (node instanceof WrapperNode) {
-                    WrapperNode wrapper = (WrapperNode) node;
-                    Probe probe = wrapper.getProbe();
-                    if (probe.isTaggedAs(StandardSyntaxTag.STATEMENT)) {
-                        Node child = wrapper.getChild();
-                        if (child instanceof AbstractLoopNode) {
-                            instrumenter.attach(probe, functionStatementsEventReceiver.getLoopStatementReceiver(wrapper), "debug:loop");
-                        } else {
-                            instrumenter.attach(probe, functionStatementsEventReceiver.getStatementReceiver(), "debug:stmt");
-                        }
-                    }
-                }
-                return true;
-            }
-        });
-    }
-
-    private abstract static class DebugEventReceiver implements StandardInstrumentListener {
-
-        protected final Object text;
-        protected final Object condition;
-        protected final FunctionDefinitionNode functionDefinitionNode;
-        protected TagInstrument stepIntoInstrument;
-        @CompilationFinal private boolean disabled;
-        CyclicAssumption disabledUnchangedAssumption = new CyclicAssumption("debug event disabled state unchanged");
-
-        protected DebugEventReceiver(FunctionDefinitionNode functionDefinitionNode, Object text, Object condition) {
-            this.text = text;
-            this.condition = condition;
-            this.functionDefinitionNode = functionDefinitionNode;
-        }
-
-        FunctionDefinitionNode getFunctionDefinitionNode() {
-            return functionDefinitionNode;
-        }
-
-        @Override
-        public void onReturnVoid(Probe probe, Node node, VirtualFrame frame) {
-            if (!disabled()) {
-                throw RInternalError.shouldNotReachHere();
-            }
-        }
-
-        @Override
-        public void onReturnExceptional(Probe probe, Node node, VirtualFrame frame, Throwable exception) {
-        }
-
-        boolean disabled() {
-            return disabled || globalDisable;
-        }
-
-        void disable() {
-            setDisabledState(true);
-        }
-
-        void enable() {
-            setDisabledState(false);
-        }
-
-        private void setDisabledState(boolean newState) {
-            if (newState != disabled) {
-                disabledUnchangedAssumption.invalidate();
-                disabled = newState;
-            }
-        }
-
-        protected static void print(String msg, boolean nl) {
-            try {
-                StdConnections.getStdout().writeString(msg, nl);
-            } catch (IOException ex) {
-                throw RError.error(RError.SHOW_CALLER2, RError.Message.GENERIC, ex.getMessage());
-            }
-        }
-
-        protected void browserInteract(Node node, VirtualFrame frame) {
-            Browser.ExitMode exitMode = Browser.interact(frame.materialize());
-            switch (exitMode) {
-                case NEXT:
-                    break;
-                case STEP:
-                    if (this instanceof StatementEventReceiver) {
-                        stepIntoInstrument = RInstrument.getInstrumenter().attach(StandardSyntaxTag.START_METHOD, new StepIntoInstrumentListener(receiverMap.get(functionDefinitionNode.getUID())),
-                                        "step");
-                    }
-                    break;
-                case CONTINUE:
-                    // Have to disable
-                    doContinue();
-                    clearTrap();
-                    break;
-                case FINISH:
-                    // If in loop, continue to loop end, else act like CONTINUE
-                    AbstractLoopNode loopNode = inLoop(node);
-                    if (loopNode != null) {
-                        // Have to disable just the body of the loop
-                        FunctionStatementsEventReceiver fser = receiverMap.get(functionDefinitionNode.getUID());
-                        fser.setFinishing(loopNode);
-                    } else {
-                        doContinue();
-                    }
-                    clearTrap();
-            }
-        }
-
-        private void doContinue() {
-            FunctionStatementsEventReceiver fser = receiverMap.get(functionDefinitionNode.getUID());
-            fser.setContinuing();
-        }
-
-        protected void clearTrap() {
-            if (stepIntoInstrument != null) {
-                stepIntoInstrument.dispose();
-                stepIntoInstrument = null;
-            }
-        }
-
-    }
-
-    /**
-     * This handles function entry and exit. We try to emulate GnuR behavior but since FastR does
-     * not (yet) handle <@code {</code> correctly, it is a bit heuristic. In particular, if a
-     * function is defined using <@code { }</code>, GnuR stops at the <@code {</code> and then
-     * "steps over" the <@code {</code> to the first statement, otherwise it just stops at the first
-     * statement.
-     */
-    private static class FunctionStatementsEventReceiver extends DebugEventReceiver {
-
-        private final StatementEventReceiver statementReceiver;
-        ArrayList<LoopStatementEventReceiver> loopStatementReceivers = new ArrayList<>();
-
-        private boolean once;
-        private boolean continuing;
-
-        FunctionStatementsEventReceiver(FunctionDefinitionNode functionDefinitionNode, Object text, Object condition, boolean once) {
-            super(functionDefinitionNode, text, condition);
-            receiverMap.put(functionDefinitionNode.getUID(), this);
-            statementReceiver = new StatementEventReceiver(functionDefinitionNode, text, condition);
-            this.once = once;
-        }
-
-        StatementEventReceiver getStatementReceiver() {
-            return statementReceiver;
-        }
-
-        LoopStatementEventReceiver getLoopStatementReceiver(WrapperNode loopNodeWrapper) {
-            LoopStatementEventReceiver lser = new LoopStatementEventReceiver(functionDefinitionNode, text, condition, loopNodeWrapper, this);
-            loopStatementReceivers.add(lser);
-            return lser;
-        }
-
-        @Override
-        void disable() {
-            super.disable();
-            statementReceiver.disable();
-            for (LoopStatementEventReceiver lser : loopStatementReceivers) {
-                lser.disable();
-            }
-        }
-
-        @Override
-        void enable() {
-            super.enable();
-            enableChildren();
-        }
-
-        void enableChildren() {
-            statementReceiver.enable();
-            for (LoopStatementEventReceiver lser : loopStatementReceivers) {
-                lser.enable();
-            }
-        }
-
-        void setContinuing() {
-            continuing = true;
-            statementReceiver.disable();
-            for (LoopStatementEventReceiver lser : loopStatementReceivers) {
-                lser.disable();
-            }
-        }
-
-        void setFinishing(AbstractLoopNode loopNode) {
-            // Disable every statement receiver except that for loopNode
-            WrapperNode loopNodeWrapper = (WrapperNode) loopNode.getParent();
-            for (LoopStatementEventReceiver lser : loopStatementReceivers) {
-                if (lser.getLoopNodeWrapper() == loopNodeWrapper) {
-                    lser.setFinishing();
-                } else {
-                    lser.disable();
-                }
-            }
-            statementReceiver.disable();
-        }
-
-        void endFinishing() {
-            enableChildren();
-        }
-
-        @Override
-        public void onEnter(Probe probe, Node node, VirtualFrame frame) {
-            if (!disabled()) {
-                print("debugging in: ", false);
-                printCall(frame);
-                FunctionDefinitionNode fdn = (FunctionDefinitionNode) RArguments.getFunction(frame).getRootNode();
-                /*
-                 * If this is a recursive call, then returnCleanup will not have happened, so we
-                 * enable our child listeners unconditionally. TODO It is possible that the enabled
-                 * state should be stacked to match the call stack in the recursive case.
-                 */
-                enableChildren();
-                boolean brace = fdn.hasBraces();
-                if (brace) {
-                    printNode(node, brace);
-                    browserInteract(node, frame);
-                }
-            }
-        }
-
-        @Override
-        public void onReturnValue(Probe probe, Node node, VirtualFrame frame, Object result) {
-            if (!disabled()) {
-                returnCleanup(frame);
-            }
-        }
-
-        @Override
-        public void onReturnExceptional(Probe probe, Node node, VirtualFrame frame, Throwable exception) {
-            if (!disabled()) {
-                returnCleanup(frame);
-            }
-        }
-
-        private void returnCleanup(VirtualFrame frame) {
-            print("exiting from: ", false);
-            printCall(frame);
-            if (once) {
-                disable();
-            } else if (continuing) {
-                statementReceiver.enable();
-                for (LoopStatementEventReceiver lser : loopStatementReceivers) {
-                    lser.enable();
-                }
-                continuing = false;
-            }
-        }
-
-        private static void printCall(VirtualFrame frame) {
-            String callString = RContext.getRRuntimeASTAccess().getCallerSource(RArguments.getCall(frame));
-            print(callString, true);
-        }
-
-    }
-
-    @TruffleBoundary
-    private static void printNode(Node node, boolean curly) {
-        ConsoleHandler consoleHandler = RContext.getInstance().getConsoleHandler();
-        RDeparse.State state = RDeparse.State.createPrintableState();
-        RBaseNode rNode = (RBaseNode) node;
-        rNode.deparse(state);
-        SourceSection source = rNode.asRSyntaxNode().getSourceSection();
-        if (source == null) {
-            consoleHandler.print("debug: ");
-        } else {
-            consoleHandler.print("debug at #" + source.getStartLine() + ": ");
-        }
-        boolean printCurly = curly && !state.toString().startsWith("{");
-        if (printCurly) {
-            consoleHandler.println("{");
-        }
-        consoleHandler.print(state.toString());
-        if (printCurly) {
-            consoleHandler.print("}");
-        }
-        consoleHandler.print("\n");
-    }
-
-    private static class StatementEventReceiver extends DebugEventReceiver {
-
-        StatementEventReceiver(FunctionDefinitionNode functionDefinitionNode, Object text, Object condition) {
-            super(functionDefinitionNode, text, condition);
-        }
-
-        @Override
-        public void onEnter(Probe probe, Node node, VirtualFrame frame) {
-            if (!disabled()) {
-                // in case we did a step into that never called a function
-                clearTrap();
-                printNode(node, false);
-                browserInteract(node, frame);
-            }
-        }
-
-        @Override
-        public void onReturnValue(Probe probe, Node node, VirtualFrame frame, Object result) {
-        }
-
-    }
-
-    private static class LoopStatementEventReceiver extends StatementEventReceiver {
-
-        private boolean finishing;
-        /**
-         * The wrapper for the loop node is stable whereas the loop node itself will be replaced
-         * with a specialized node.
-         */
-        private final WrapperNode loopNodeWrapper;
-        private final FunctionStatementsEventReceiver fser;
-
-        LoopStatementEventReceiver(FunctionDefinitionNode functionDefinitionNode, Object text, Object condition, WrapperNode loopNodeWrapper, FunctionStatementsEventReceiver fser) {
-            super(functionDefinitionNode, text, condition);
-            this.loopNodeWrapper = loopNodeWrapper;
-            this.fser = fser;
-        }
-
-        @Override
-        public void onEnter(Probe probe, Node node, VirtualFrame frame) {
-            if (!disabled()) {
-                super.onEnter(probe, node, frame);
-            }
-        }
-
-        WrapperNode getLoopNodeWrapper() {
-            return loopNodeWrapper;
-        }
-
-        void setFinishing() {
-            finishing = true;
-        }
-
-        @Override
-        public void onReturnExceptional(Probe probe, Node node, VirtualFrame frame, Throwable exception) {
-            if (!disabled()) {
-                returnCleanup();
-            }
-        }
-
-        @Override
-        public void onReturnValue(Probe probe, Node node, VirtualFrame frame, Object result) {
-            if (!disabled()) {
-                returnCleanup();
-            }
-        }
-
-        private void returnCleanup() {
-            if (finishing) {
-                finishing = false;
-                fser.endFinishing();
-            }
-        }
-
-    }
-
-    private static AbstractLoopNode inLoop(final Node nodeArg) {
-        Node node = nodeArg;
-        while (!(node instanceof RootNode)) {
-            node = node.getParent();
-            if (node instanceof AbstractLoopNode) {
-                return (AbstractLoopNode) node;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Listener for (transient) step into.
-     */
-    private static class StepIntoInstrumentListener implements StandardBeforeInstrumentListener {
-        private FunctionStatementsEventReceiver functionStatementsEventReceiver;
-
-        StepIntoInstrumentListener(FunctionStatementsEventReceiver functionStatementsEventReceiver) {
-            this.functionStatementsEventReceiver = functionStatementsEventReceiver;
-        }
-
-        @Override
-        public void onEnter(Probe probe, Node node, VirtualFrame frame) {
-            if (!globalDisable) {
-                FunctionStatementsNode functionStatementsNode = (FunctionStatementsNode) node;
-                FunctionDefinitionNode fdn = (FunctionDefinitionNode) functionStatementsNode.getRootNode();
-                ensureSingleStep(fdn);
-                functionStatementsEventReceiver.clearTrap();
-                functionStatementsEventReceiver.onEnter(probe, functionStatementsNode, frame);
-            }
-        }
-
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/trace/TraceHandling.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/trace/TraceHandling.java
deleted file mode 100644
index 0725bcf56c..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/trace/TraceHandling.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrument.trace;
-
-import java.io.FileWriter;
-import java.io.IOException;
-
-import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.StandardInstrumentListener;
-import com.oracle.truffle.api.instrument.StandardSyntaxTag;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.utilities.CyclicAssumption;
-import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode;
-import com.oracle.truffle.r.nodes.function.FunctionStatementsNode;
-import com.oracle.truffle.r.nodes.instrument.RInstrument;
-import com.oracle.truffle.r.runtime.FastROptions;
-import com.oracle.truffle.r.runtime.FunctionUID;
-import com.oracle.truffle.r.runtime.RArguments;
-import com.oracle.truffle.r.runtime.RCaller;
-import com.oracle.truffle.r.runtime.RError;
-import com.oracle.truffle.r.runtime.RInternalError;
-import com.oracle.truffle.r.runtime.Utils;
-import com.oracle.truffle.r.runtime.conn.StdConnections;
-import com.oracle.truffle.r.runtime.context.RContext;
-import com.oracle.truffle.r.runtime.data.RFunction;
-import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
-
-/**
- * Handles everything related to the R {@code trace} function. Also used by
- * {@link FastROptions#TraceCalls} option.
- *
- * Output normally goes to the connection associated with the standard output, which can be
- * redirected via the {@code sink} R function. However, for use with {@link FastROptions#TraceCalls}
- * ,it may also be explicitly directed to the file {@code fastr_tracecalls.log}.
- */
-public class TraceHandling {
-
-    public static boolean enableTrace(RFunction func) {
-        FunctionDefinitionNode fdn = (FunctionDefinitionNode) func.getRootNode();
-        TraceFunctionEventReceiver fbr = (TraceFunctionEventReceiver) RContext.getInstance().stateTraceHandling.get(fdn.getUID());
-        if (fbr == null) {
-            Probe probe = attachTraceHandler(fdn.getUID());
-            return probe != null;
-        } else {
-            fbr.enable();
-            return true;
-        }
-
-    }
-
-    public static boolean disableTrace(RFunction func) {
-        FunctionDefinitionNode fdn = (FunctionDefinitionNode) func.getRootNode();
-        TraceFunctionEventReceiver fbr = (TraceFunctionEventReceiver) RContext.getInstance().stateTraceHandling.get(fdn.getUID());
-        if (fbr == null) {
-            return false;
-        } else {
-            fbr.disable();
-            return true;
-        }
-    }
-
-    public static void setTracingState(boolean state) {
-        Object[] listeners = RContext.getInstance().stateTraceHandling.getListeners();
-        for (int i = 0; i < listeners.length; i++) {
-            TraceFunctionEventReceiver tl = (TraceFunctionEventReceiver) listeners[i];
-            if (state) {
-                tl.enable();
-            } else {
-                tl.disable();
-            }
-        }
-    }
-
-    @SuppressWarnings("unused")
-    public static boolean enableStatementTrace(RFunction func, RSyntaxNode tracer) {
-        return false;
-    }
-
-    public static Probe attachTraceHandler(FunctionUID uid) {
-        Probe probe = RInstrument.findSingleProbe(uid, StandardSyntaxTag.START_METHOD);
-        if (probe == null) {
-            return null;
-        }
-        TraceFunctionEventReceiver fser = new TraceFunctionEventReceiver();
-        RInstrument.getInstrumenter().attach(probe, fser, "trace");
-        RContext.getInstance().stateTraceHandling.put(uid, fser);
-        if (outputHandler == null) {
-            setOutputHandler();
-        }
-        return probe;
-    }
-
-    private abstract static class TraceEventReceiver implements StandardInstrumentListener {
-
-        @CompilationFinal private boolean disabled;
-        CyclicAssumption disabledUnchangedAssumption = new CyclicAssumption("trace event disabled state unchanged");
-
-        protected TraceEventReceiver() {
-        }
-
-        @Override
-        public void onReturnVoid(Probe probe, Node node, VirtualFrame frame) {
-            if (!disabled()) {
-                throw RInternalError.shouldNotReachHere();
-            }
-        }
-
-        boolean disabled() {
-            return disabled;
-        }
-
-        void disable() {
-            setDisabledState(true);
-        }
-
-        void enable() {
-            setDisabledState(false);
-        }
-
-        private void setDisabledState(boolean newState) {
-            if (newState != disabled) {
-                disabledUnchangedAssumption.invalidate();
-                disabled = newState;
-            }
-        }
-
-    }
-
-    private abstract static class OutputHandler {
-        abstract void writeString(String s, boolean nl) throws IOException;
-    }
-
-    private static class StdoutOutputHandler extends OutputHandler {
-
-        @Override
-        void writeString(String s, boolean nl) throws IOException {
-            StdConnections.getStdout().writeString(s, nl);
-        }
-
-    }
-
-    private static class FileOutputHandler extends OutputHandler {
-        private FileWriter fileWriter;
-
-        FileOutputHandler() {
-            try {
-                fileWriter = new FileWriter("fastr_tracecalls.log");
-            } catch (IOException e) {
-                Utils.fatalError("failed to open 'fastr_tracecalls.log'" + e.getMessage());
-            }
-        }
-
-        @Override
-        void writeString(String s, boolean nl) throws IOException {
-            fileWriter.append(s);
-            if (nl) {
-                fileWriter.append('\n');
-            }
-            fileWriter.flush();
-        }
-    }
-
-    private static void setOutputHandler() {
-        outputHandler = FastROptions.TraceCallsToFile.getBooleanValue() ? new FileOutputHandler() : new StdoutOutputHandler();
-    }
-
-    private static OutputHandler outputHandler;
-
-    private static class TraceFunctionEventReceiver extends TraceEventReceiver {
-
-        TraceFunctionEventReceiver() {
-        }
-
-        public void onEnter(Probe probe, Node node, VirtualFrame frame) {
-            if (!disabled()) {
-                @SuppressWarnings("unused")
-                FunctionStatementsNode fsn = (FunctionStatementsNode) node;
-                int depth = RArguments.getDepth(frame);
-                try {
-                    for (int i = 0; i < depth; i++) {
-                        outputHandler.writeString(" ", false);
-                    }
-                    RCaller caller = RArguments.getCall(frame);
-                    String callString;
-                    if (caller != null) {
-                        callString = RContext.getRRuntimeASTAccess().getCallerSource(caller);
-                    } else {
-                        callString = "<no source>";
-                    }
-                    outputHandler.writeString("trace: " + callString, true);
-                } catch (IOException ex) {
-                    throw RError.error(RError.SHOW_CALLER2, RError.Message.GENERIC, ex.getMessage());
-                }
-            }
-        }
-
-        @Override
-        public void onReturnExceptional(Probe probe, Node node, VirtualFrame frame, Throwable exception) {
-        }
-
-        @Override
-        public void onReturnValue(Probe probe, Node node, VirtualFrame frame, Object result) {
-        }
-
-    }
-
-    @SuppressWarnings("unused")
-    private static class TraceStatementEventReceiver extends TraceEventReceiver {
-
-        public void onEnter(Probe probe, Node node, VirtualFrame vFrame) {
-            if (!disabled()) {
-                //
-            }
-
-        }
-
-        public void onReturnValue(Probe probe, Node node, VirtualFrame vFrame, Object result) {
-            if (!disabled()) {
-                //
-            }
-
-        }
-
-        public void onReturnExceptional(Probe probe, Node node, VirtualFrame vFrame, Throwable exception) {
-            if (!disabled()) {
-                //
-            }
-
-        }
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/ConvertBooleanNodeWrapper.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/ConvertBooleanNodeWrapper.java
deleted file mode 100644
index e6d6eb0a75..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/ConvertBooleanNodeWrapper.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-// Checkstyle: stop
-package com.oracle.truffle.r.nodes.instrument.wrappers;
-
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.EventHandlerNode;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.r.runtime.nodes.*;
-
-@NodeInfo(cost = NodeCost.NONE)
-public final class ConvertBooleanNodeWrapper extends com.oracle.truffle.r.nodes.unary.ConvertBooleanNode implements WrapperNode {
-    @Child com.oracle.truffle.r.nodes.unary.ConvertBooleanNode child;
-    @Child private EventHandlerNode eventHandlerNode;
-
-    public ConvertBooleanNodeWrapper(com.oracle.truffle.r.nodes.unary.ConvertBooleanNode child) {
-        assert child != null;
-        assert !(child instanceof ConvertBooleanNodeWrapper);
-        this.child = child;
-    }
-
-    public String instrumentationInfo() {
-        return "Wrapper node for com.oracle.truffle.r.nodes.unary.ConvertBooleanNode";
-    }
-
-    public Node getChild() {
-        return child;
-    }
-
-    public Probe getProbe() {
-        try {
-            return eventHandlerNode.getProbe();
-        } catch (IllegalStateException e) {
-            throw new IllegalStateException("A lite-Probed wrapper has no explicit Probe");
-        }
-    }
-
-    public void insertEventHandlerNode(EventHandlerNode newEventHandlerNode) {
-        this.eventHandlerNode = newEventHandlerNode;
-    }
-
-    @Override
-    public byte executeByte(com.oracle.truffle.api.frame.VirtualFrame frame) {
-        eventHandlerNode.enter(child, frame);
-
-        byte result;
-        try {
-            result = child.executeByte(frame);
-            eventHandlerNode.returnValue(child, frame, result);
-            return result;
-        } catch (Exception e) {
-            eventHandlerNode.returnExceptional(child, frame, e);
-            throw (e);
-        }
-    }
-
-    @Override
-    public byte executeByte(com.oracle.truffle.api.frame.VirtualFrame frame, java.lang.Object operandValue) {
-        eventHandlerNode.enter(child, frame);
-
-        byte result;
-        try {
-            result = child.executeByte(frame, operandValue);
-            eventHandlerNode.returnValue(child, frame, result);
-            return result;
-        } catch (Exception e) {
-            eventHandlerNode.returnExceptional(child, frame, e);
-            throw (e);
-        }
-    }
-
-    @Override
-    public com.oracle.truffle.r.runtime.nodes.RNode getOperand() {
-        return child.getOperand();
-    }
-
-    @Override
-    public RSyntaxNode getRSyntaxNode() {
-        return child.asRSyntaxNode();
-    }
-
-    @Override
-    public boolean isRInstrumentable() {
-        return false;
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/ReadArgumentNodeWrapper.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/ReadArgumentNodeWrapper.java
deleted file mode 100644
index befb32ecee..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/ReadArgumentNodeWrapper.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrument.wrappers;
-
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.EventHandlerNode;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.r.runtime.nodes.*;
-
-@NodeInfo(cost = NodeCost.NONE)
-public final class ReadArgumentNodeWrapper extends com.oracle.truffle.r.nodes.access.ReadArgumentNode implements WrapperNode {
-    @Child com.oracle.truffle.r.nodes.access.ReadArgumentNode child;
-    @Child private EventHandlerNode eventHandlerNode;
-
-    public ReadArgumentNodeWrapper(com.oracle.truffle.r.nodes.access.ReadArgumentNode child) {
-        assert child != null;
-        assert !(child instanceof ReadArgumentNodeWrapper);
-        this.child = child;
-    }
-
-    public String instrumentationInfo() {
-        return "Wrapper node for com.oracle.truffle.r.nodes.access.ReadArgumentNode";
-    }
-
-    public Node getChild() {
-        return child;
-    }
-
-    public Probe getProbe() {
-        try {
-            return eventHandlerNode.getProbe();
-        } catch (IllegalStateException e) {
-            throw new IllegalStateException("A lite-Probed wrapper has no explicit Probe");
-        }
-    }
-
-    public void insertEventHandlerNode(EventHandlerNode newEventHandlerNode) {
-        this.eventHandlerNode = newEventHandlerNode;
-    }
-
-    @Override
-    public RSyntaxNode getRSyntaxNode() {
-        return child.asRSyntaxNode();
-    }
-
-    @Override
-    public boolean isRInstrumentable() {
-        return false;
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/WriteCurrentVariableNodeWrapper.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/WriteCurrentVariableNodeWrapper.java
deleted file mode 100644
index 3a326ce097..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/WriteCurrentVariableNodeWrapper.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrument.wrappers;
-
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.EventHandlerNode;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.r.runtime.nodes.*;
-
-@NodeInfo(cost = NodeCost.NONE)
-public final class WriteCurrentVariableNodeWrapper extends com.oracle.truffle.r.nodes.access.WriteCurrentVariableNode implements WrapperNode {
-    @Child com.oracle.truffle.r.nodes.access.WriteCurrentVariableNode child;
-    @Child private EventHandlerNode eventHandlerNode;
-
-    public WriteCurrentVariableNodeWrapper(com.oracle.truffle.r.nodes.access.WriteCurrentVariableNode child) {
-        super(child.getSourceSection());
-        assert child != null;
-        assert !(child instanceof WriteCurrentVariableNodeWrapper);
-        this.child = child;
-    }
-
-    public String instrumentationInfo() {
-        return "Wrapper node for com.oracle.truffle.r.nodes.access.WriteCurrentVariableNode";
-    }
-
-    public Node getChild() {
-        return child;
-    }
-
-    public Probe getProbe() {
-        try {
-            return eventHandlerNode.getProbe();
-        } catch (IllegalStateException e) {
-            throw new IllegalStateException("A lite-Probed wrapper has no explicit Probe");
-        }
-    }
-
-    public void insertEventHandlerNode(EventHandlerNode newEventHandlerNode) {
-        this.eventHandlerNode = newEventHandlerNode;
-    }
-
-    @Override
-    public java.lang.Object execute(com.oracle.truffle.api.frame.VirtualFrame frame) {
-        eventHandlerNode.enter(child, frame);
-
-        java.lang.Object result;
-        try {
-            result = child.execute(frame);
-            eventHandlerNode.returnValue(child, frame, result);
-            return result;
-        } catch (Exception e) {
-            eventHandlerNode.returnExceptional(child, frame, e);
-            throw (e);
-        }
-    }
-
-    @Override
-    public com.oracle.truffle.r.runtime.nodes.RNode getRhs() {
-        return child.getRhs();
-    }
-
-    @Override
-    public void execute(com.oracle.truffle.api.frame.VirtualFrame frame, java.lang.Object value) {
-        eventHandlerNode.enter(child, frame);
-
-        try {
-            child.execute(frame, value);
-            eventHandlerNode.returnVoid(child, frame);
-        } catch (Exception e) {
-            eventHandlerNode.returnExceptional(child, frame, e);
-            throw (e);
-        }
-    }
-
-    @Override
-    public java.lang.Object getName() {
-        return child.getName();
-    }
-
-    @Override
-    public RSyntaxNode getRSyntaxNode() {
-        return child.asRSyntaxNode();
-    }
-
-    @Override
-    public boolean isRInstrumentable() {
-        return false;
-    }
-
-    @Override
-    public boolean isSyntax() {
-        return false;
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/WriteSuperVariableNodeWrapper.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/WriteSuperVariableNodeWrapper.java
deleted file mode 100644
index 05de9d27a8..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrument/wrappers/WriteSuperVariableNodeWrapper.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrument.wrappers;
-
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.EventHandlerNode;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.r.runtime.nodes.*;
-
-@NodeInfo(cost = NodeCost.NONE)
-public final class WriteSuperVariableNodeWrapper extends com.oracle.truffle.r.nodes.access.WriteSuperVariableNode implements WrapperNode {
-    @Child com.oracle.truffle.r.nodes.access.WriteSuperVariableNode child;
-    @Child private EventHandlerNode eventHandlerNode;
-
-    public WriteSuperVariableNodeWrapper(com.oracle.truffle.r.nodes.access.WriteSuperVariableNode child) {
-        super(child.getSourceSection());
-        assert child != null;
-        assert !(child instanceof WriteSuperVariableNodeWrapper);
-        this.child = child;
-    }
-
-    public String instrumentationInfo() {
-        return "Wrapper node for com.oracle.truffle.r.nodes.access.WriteSuperVariableNode";
-    }
-
-    public Node getChild() {
-        return child;
-    }
-
-    public Probe getProbe() {
-        try {
-            return eventHandlerNode.getProbe();
-        } catch (IllegalStateException e) {
-            throw new IllegalStateException("A lite-Probed wrapper has no explicit Probe");
-        }
-    }
-
-    public void insertEventHandlerNode(EventHandlerNode newEventHandlerNode) {
-        this.eventHandlerNode = newEventHandlerNode;
-    }
-
-    @Override
-    public com.oracle.truffle.r.runtime.nodes.RNode getRhs() {
-        return child.getRhs();
-    }
-
-    @Override
-    public void execute(com.oracle.truffle.api.frame.VirtualFrame frame, java.lang.Object value) {
-        eventHandlerNode.enter(child, frame);
-
-        try {
-            child.execute(frame, value);
-            eventHandlerNode.returnVoid(child, frame);
-        } catch (Exception e) {
-            eventHandlerNode.returnExceptional(child, frame, e);
-            throw (e);
-        }
-    }
-
-    @Override
-    public java.lang.Object execute(com.oracle.truffle.api.frame.VirtualFrame frame) {
-        eventHandlerNode.enter(child, frame);
-
-        java.lang.Object result;
-        try {
-            result = child.execute(frame);
-            eventHandlerNode.returnValue(child, frame, result);
-            return result;
-        } catch (Exception e) {
-            eventHandlerNode.returnExceptional(child, frame, e);
-            throw (e);
-        }
-    }
-
-    @Override
-    public java.lang.Object getName() {
-        return child.getName();
-    }
-
-    @Override
-    public RSyntaxNode getRSyntaxNode() {
-        return child.asRSyntaxNode();
-    }
-
-    @Override
-    public boolean isRInstrumentable() {
-        return false;
-    }
-
-    @Override
-    public boolean isSyntax() {
-        return false;
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RInstrumentation.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RInstrumentation.java
index 3e821ea637..44d8742d5e 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RInstrumentation.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RInstrumentation.java
@@ -148,16 +148,11 @@ public class RInstrumentation {
     }
 
     /**
-     * (Temporarily) tag with the function uid, and also with support for the repl debugger.
-     *
-     * TODO Remove hack to tag with {@code uidTag} once {@link SourceSectionFilter} provides a
-     * builtin way.
+     * (Temporary) support for the repl debugger.
      *
      * @param fdn
      */
     private static void fixupTags(FunctionDefinitionNode fdn) {
-        FunctionUID uid = fdn.getUID();
-        String uidTag = RSyntaxTags.createUidTag(uid);
         RSyntaxNode.accept(fdn, 0, new RSyntaxNodeVisitor() {
 
             public boolean visit(RSyntaxNode node, int depth) {
@@ -165,18 +160,7 @@ public class RInstrumentation {
                 assert ss != null;
                 String[] tags = RSyntaxTags.getTags(ss);
                 if (tags != null) {
-                    if (RSyntaxTags.containsTag(tags, RSyntaxTags.STATEMENT)) {
-                        String[] updatedTags = new String[tags.length + 1];
-                        System.arraycopy(tags, 0, updatedTags, 0, tags.length);
-                        updatedTags[tags.length] = "debug-HALT";
-                        node.setSourceSection(ss.withTags(updatedTags));
-                        tags = updatedTags;
-                    }
-                    // tag with function uid (will go away)
-                    String[] updatedTags = new String[tags.length + 1];
-                    System.arraycopy(tags, 0, updatedTags, 0, tags.length);
-                    updatedTags[tags.length] = uidTag;
-                    node.setSourceSection(ss.withTags(updatedTags));
+                    finesseDebuggerTags(node, tags);
                 }
                 return true;
             }
@@ -185,6 +169,26 @@ public class RInstrumentation {
 
     }
 
+    private static void finesseDebuggerTags(RSyntaxNode node, String[] tags) {
+        boolean isStatement = RSyntaxTags.containsTag(tags, RSyntaxTags.STATEMENT);
+        // TODO this causes Truffle debugger to fail on next command
+        boolean isCall = RSyntaxTags.containsTag(tags, RSyntaxTags.CALL);
+        // boolean isCall = false;
+        if (!(isStatement || isCall)) {
+            return;
+        }
+        String[] updatedTags = new String[tags.length + (isStatement && isCall ? 2 : 1)];
+        System.arraycopy(tags, 0, updatedTags, 0, tags.length);
+        int ix = tags.length;
+        if (isStatement) {
+            updatedTags[ix++] = RSyntaxTags.DEBUG_HALT;
+        }
+        if (isCall) {
+            updatedTags[ix++] = RSyntaxTags.DEBUG_CALL;
+        }
+        node.setSourceSection(node.getSourceSection().withTags(updatedTags));
+    }
+
     public static FunctionIdentification getFunctionIdentification(FunctionUID uid) {
         return functionMap.get(uid).getIdentification();
     }
@@ -217,8 +221,7 @@ public class RInstrumentation {
         SourceSection fdns = fdn.getSourceSection();
         builder.indexIn(fdns.getCharIndex(), fdns.getCharLength());
         builder.sourceIs(fdns.getSource());
-        // TODO remove when UID tag redundant
-        builder.tagIs(RSyntaxTags.createUidTag(fdn.getUID()));
+        builder.rootSourceSectionEquals(fdns);
         return builder;
 
     }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RSyntaxTags.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RSyntaxTags.java
index 332f25dce3..75bdb6580b 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RSyntaxTags.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RSyntaxTags.java
@@ -24,10 +24,11 @@ package com.oracle.truffle.r.nodes.instrumentation;
 
 import java.util.ArrayList;
 
+import com.oracle.truffle.api.debug.Debugger;
 import com.oracle.truffle.api.source.SourceSection;
 import com.oracle.truffle.r.nodes.control.BlockNode;
 import com.oracle.truffle.r.nodes.function.FunctionStatementsNode;
-import com.oracle.truffle.r.runtime.FunctionUID;
+import com.oracle.truffle.r.nodes.function.RCallNode;
 
 public class RSyntaxTags {
     /**
@@ -38,22 +39,22 @@ public class RSyntaxTags {
      * Applied to {@link FunctionStatementsNode}.
      */
     public static final String START_FUNCTION = "r-start_function";
+    /**
+     * All {@link RCallNode}s.
+     */
+    public static final String CALL = "r-call";
     /**
      * Applied to all loop nodes.
      */
     public static final String LOOP = "r-loop";
 
-    public static final String[] ALL_TAGS = new String[]{STATEMENT, START_FUNCTION, LOOP};
-
-    /**
-     * Temp hack to identify the function.
+    /*
+     * Hopefully Temporary if can agree on lang-call syntax.
      */
-    private static final String UID_PREFIX = "r-uid-";
+    public static final String DEBUG_CALL = Debugger.CALL_TAG;
+    public static final String DEBUG_HALT = Debugger.HALT_TAG;
 
-    public static String createUidTag(FunctionUID uid) {
-        String s = UID_PREFIX + uid.toString();
-        return s.intern();
-    }
+    public static final String[] ALL_TAGS = new String[]{CALL, STATEMENT, START_FUNCTION, LOOP, DEBUG_CALL, DEBUG_HALT};
 
     /**
      * Returns the existing set of tags or {@code null} if none.
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/ConvertBooleanNodeWrapperFactory.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/ConvertBooleanNodeWrapperFactory.java
deleted file mode 100644
index f661262ec5..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/ConvertBooleanNodeWrapperFactory.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrumentation.wrappers;
-
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrumentation.InstrumentableFactory;
-import com.oracle.truffle.api.instrumentation.ProbeNode;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.NodeCost;
-import com.oracle.truffle.api.nodes.NodeInfo;
-import com.oracle.truffle.r.nodes.unary.ConvertBooleanNode;
-import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
-
-public class ConvertBooleanNodeWrapperFactory implements InstrumentableFactory<ConvertBooleanNode> {
-    @NodeInfo(cost = NodeCost.NONE)
-    public static final class ConvertBooleanNodeWrapper extends ConvertBooleanNode implements InstrumentableFactory.WrapperNode {
-        @Child private ConvertBooleanNode delegate;
-        @Child private ProbeNode probeNode;
-
-        public ConvertBooleanNodeWrapper(ConvertBooleanNode delegate, ProbeNode probeNode) {
-            assert delegate != null;
-            assert !(delegate instanceof ConvertBooleanNodeWrapper);
-            this.delegate = delegate;
-            this.probeNode = probeNode;
-        }
-
-        @Override
-        public Node getDelegateNode() {
-            return delegate;
-        }
-
-        @Override
-        public ProbeNode getProbeNode() {
-            return probeNode;
-        }
-
-        @Override
-        public byte executeByte(VirtualFrame frame) {
-            try {
-                probeNode.onEnter(frame);
-                byte returnValue = delegate.executeByte(frame);
-                probeNode.onReturnValue(frame, returnValue);
-                return returnValue;
-            } catch (Throwable t) {
-                probeNode.onReturnExceptional(frame, t);
-                throw t;
-            }
-        }
-
-        @Override
-        public byte executeByte(VirtualFrame frame, Object value) {
-            try {
-                probeNode.onEnter(frame);
-                byte returnValue = delegate.executeByte(frame, value);
-                probeNode.onReturnValue(frame, returnValue);
-                return returnValue;
-            } catch (Throwable t) {
-                probeNode.onReturnExceptional(frame, t);
-                throw t;
-            }
-        }
-
-        @Override
-        public RSyntaxNode getRSyntaxNode() {
-            return delegate.asRSyntaxNode();
-        }
-
-        @Override
-        public boolean isRInstrumentable() {
-            return false;
-        }
-
-        @Override
-        public com.oracle.truffle.r.runtime.nodes.RNode getOperand() {
-            return delegate.getOperand();
-        }
-
-    }
-
-    public com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode createWrapper(ConvertBooleanNode node, ProbeNode probe) {
-        return new ConvertBooleanNodeWrapper(node, probe);
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/ReadArgumentNodeWrapperFactory.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/ReadArgumentNodeWrapperFactory.java
deleted file mode 100644
index bda9416bb3..0000000000
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/ReadArgumentNodeWrapperFactory.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.nodes.instrumentation.wrappers;
-
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrumentation.InstrumentableFactory;
-import com.oracle.truffle.api.instrumentation.ProbeNode;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.NodeCost;
-import com.oracle.truffle.api.nodes.NodeInfo;
-import com.oracle.truffle.r.nodes.access.ReadArgumentNode;
-import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
-
-public class ReadArgumentNodeWrapperFactory implements InstrumentableFactory<ReadArgumentNode> {
-
-    @NodeInfo(cost = NodeCost.NONE)
-    public static final class ReadArgumentNodeWrapper extends ReadArgumentNode implements InstrumentableFactory.WrapperNode {
-        @Child private ReadArgumentNode delegate;
-        @Child private ProbeNode probeNode;
-
-        public ReadArgumentNodeWrapper(ReadArgumentNode delegate, ProbeNode probeNode) {
-            assert delegate != null;
-            assert !(delegate instanceof ReadArgumentNodeWrapper);
-            this.delegate = delegate;
-            this.probeNode = probeNode;
-        }
-
-        @Override
-        public Node getDelegateNode() {
-            return delegate;
-        }
-
-        @Override
-        public ProbeNode getProbeNode() {
-            return probeNode;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            try {
-                probeNode.onEnter(frame);
-                Object returnValue = delegate.execute(frame);
-                probeNode.onReturnValue(frame, returnValue);
-                return returnValue;
-            } catch (Throwable t) {
-                probeNode.onReturnExceptional(frame, t);
-                throw t;
-            }
-        }
-
-        @Override
-        public RSyntaxNode getRSyntaxNode() {
-            return delegate.asRSyntaxNode();
-        }
-
-        @Override
-        public boolean isRInstrumentable() {
-            return false;
-        }
-    }
-
-    public com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode createWrapper(ReadArgumentNode node, ProbeNode probe) {
-        return new ReadArgumentNodeWrapper(node, probe);
-    }
-
-}
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/WriteCurrentVariableNodeWrapperFactory.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/WriteCurrentVariableNodeWrapperFactory.java
index 16193d9eac..512398c4e4 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/WriteCurrentVariableNodeWrapperFactory.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/WriteCurrentVariableNodeWrapperFactory.java
@@ -84,11 +84,6 @@ public class WriteCurrentVariableNodeWrapperFactory implements InstrumentableFac
             return delegate.asRSyntaxNode();
         }
 
-        @Override
-        public boolean isRInstrumentable() {
-            return false;
-        }
-
         @Override
         public com.oracle.truffle.r.runtime.nodes.RNode getRhs() {
             return delegate.getRhs();
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/WriteSuperVariableNodeFactory.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/WriteSuperVariableNodeFactory.java
index e52b5af117..5e419ccffb 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/WriteSuperVariableNodeFactory.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/wrappers/WriteSuperVariableNodeFactory.java
@@ -84,11 +84,6 @@ public class WriteSuperVariableNodeFactory implements InstrumentableFactory<Writ
             return delegate.asRSyntaxNode();
         }
 
-        @Override
-        public boolean isRInstrumentable() {
-            return false;
-        }
-
         @Override
         public com.oracle.truffle.r.runtime.nodes.RNode getRhs() {
             return delegate.getRhs();
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertBooleanNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertBooleanNode.java
index e310e91fb3..7fc2d7930d 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertBooleanNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertBooleanNode.java
@@ -24,17 +24,13 @@ package com.oracle.truffle.r.nodes.unary;
 
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.r.nodes.instrument.wrappers.*;
-import com.oracle.truffle.api.instrument.WrapperNode;
 import com.oracle.truffle.api.profiles.*;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.*;
 import com.oracle.truffle.r.runtime.data.model.*;
 import com.oracle.truffle.r.runtime.nodes.*;
-import com.oracle.truffle.r.runtime.nodes.instrument.NeedsWrapper;
 import com.oracle.truffle.r.runtime.ops.na.*;
 
-@NeedsWrapper
 @NodeChildren({@NodeChild("operand")})
 public abstract class ConvertBooleanNode extends RNode {
 
@@ -172,8 +168,4 @@ public abstract class ConvertBooleanNode extends RNode {
         return getOperand().asRSyntaxNode();
     }
 
-    @Override
-    public WrapperNode createRWrapperNode() {
-        return new ConvertBooleanNodeWrapper(this);
-    }
 }
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java
index 0f0dc1bc10..4125c2d893 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java
@@ -55,7 +55,6 @@ public enum FastROptions {
     NewStateTransition("Experimental state transition implementation", true),
     RefCountIncrementOnly("Disable reference count decrements for experimental state transition implementation", false),
     UseInternalGraphics("Whether the internal (Java) graphics subsystem should be used", false),
-    UseOldInstrument("Use old instrumentation framework", false),
 
     // Promises optimizations
     EagerEval("If enabled, overrides all other EagerEval switches (see EagerEvalHelper)", false),
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RNode.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RNode.java
index aa85c77137..6686ae76c8 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RNode.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RNode.java
@@ -199,14 +199,6 @@ public abstract class RNode extends RBaseNode implements RInstrumentableNode {
         return a.getLength() == b.getLength();
     }
 
-    public com.oracle.truffle.api.instrument.WrapperNode createRWrapperNode() {
-        return new com.oracle.truffle.r.runtime.nodes.instrument.RNodeWrapper(this);
-    }
-
-    public boolean isRInstrumentable() {
-        return true;
-    }
-
     private static final long WORK_SCALE_FACTOR = 100;
 
     /**
@@ -219,15 +211,18 @@ public abstract class RNode extends RBaseNode implements RInstrumentableNode {
         reportWork(this, amount);
     }
 
+    @SuppressWarnings("unused")
     public static void reportWork(Node base, long amount) {
         if (CompilerDirectives.inInterpreter()) {
             if (amount >= WORK_SCALE_FACTOR) {
                 int scaledAmount = (int) (amount / WORK_SCALE_FACTOR);
                 if (amount > 0) {
                     RootNode root = base.getRootNode();
-                    if (root != null && root.getCallTarget() instanceof LoopCountReceiver) {
-                        ((LoopCountReceiver) root.getCallTarget()).reportLoopCount(scaledAmount);
-                    }
+                    /*
+                     * TODO Is there a replacement for this now deprecated interface?? if (root !=
+                     * null && root.getCallTarget() instanceof LoopCountReceiver) {
+                     * ((LoopCountReceiver) root.getCallTarget()).reportLoopCount(scaledAmount); }
+                     */
                 }
             }
         }
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrument/NeedsWrapper.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrument/NeedsWrapper.java
deleted file mode 100644
index 2332395589..0000000000
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrument/NeedsWrapper.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.runtime.nodes.instrument;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.Node.Child;
-import com.oracle.truffle.r.runtime.nodes.RNode;
-
-/**
- * Denotes that a class requires a custom {@link WrapperNode} because a {@link Child} node typed as
- * this class (rather than plain {@link RNode}) exists in some other node class. Without the custom
- * wrapper, the assignment of the child will fail the runtime type check when the node is inserted.
- * Can also be used on a method of the class to indicate that the method needs special treatment in
- * the wrapper.
- *
- */
-@Retention(RetentionPolicy.CLASS)
-@Target({ElementType.TYPE, ElementType.METHOD})
-public @interface NeedsWrapper {
-
-}
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrument/RNodeWrapper.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrument/RNodeWrapper.java
deleted file mode 100644
index 6edb5c7002..0000000000
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrument/RNodeWrapper.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.truffle.r.runtime.nodes.instrument;
-
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.EventHandlerNode;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.r.runtime.nodes.RNode;
-import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
-
-@NodeInfo(cost = NodeCost.NONE)
-public final class RNodeWrapper extends RNode implements WrapperNode {
-    @Child com.oracle.truffle.r.runtime.nodes.RNode child;
-    @Child private EventHandlerNode eventHandlerNode;
-
-    public RNodeWrapper(com.oracle.truffle.r.runtime.nodes.RNode child) {
-        assert child != null;
-        assert !(child instanceof RNodeWrapper);
-        this.child = child;
-    }
-
-    public String instrumentationInfo() {
-        return "Wrapper node for com.oracle.truffle.r.nodes.RNode";
-    }
-
-    public Node getChild() {
-        return child;
-    }
-
-    public Probe getProbe() {
-        try {
-            return eventHandlerNode.getProbe();
-        } catch (IllegalStateException e) {
-            throw new IllegalStateException("A lite-Probed wrapper has no explicit Probe");
-        }
-    }
-
-    @Override
-    public java.lang.Object execute(com.oracle.truffle.api.frame.VirtualFrame frame) {
-        eventHandlerNode.enter(child, frame);
-
-        java.lang.Object result;
-        try {
-            result = child.execute(frame);
-            eventHandlerNode.returnValue(child, frame, result);
-            return result;
-        } catch (Exception e) {
-            eventHandlerNode.returnExceptional(child, frame, e);
-            throw (e);
-        }
-    }
-
-    @Override
-    public RSyntaxNode getRSyntaxNode() {
-        return child.asRSyntaxNode();
-    }
-
-    @Override
-    public boolean isRInstrumentable() {
-        return false;
-    }
-
-    public void insertEventHandlerNode(EventHandlerNode n) {
-        this.eventHandlerNode = n;
-    }
-
-}
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrumentation/RNodeWrapperFactory.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrumentation/RNodeWrapperFactory.java
index 8d8290b3c1..6237026c6a 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrumentation/RNodeWrapperFactory.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrumentation/RNodeWrapperFactory.java
@@ -71,10 +71,6 @@ public final class RNodeWrapperFactory implements InstrumentableFactory<RNode> {
             return delegate.asRSyntaxNode();
         }
 
-        @Override
-        public boolean isRInstrumentable() {
-            return false;
-        }
     }
 
     public com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode createWrapper(RNode node, ProbeNode probe) {
diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py
index d328ebedcf..317f38c848 100644
--- a/mx.fastr/suite.py
+++ b/mx.fastr/suite.py
@@ -25,6 +25,14 @@ suite = {
   "name" : "fastr",
   "imports" : {
     "suites" : [
+            {
+               "name" : "truffle",
+               "version" : "946de8ed59266b2c5cf7ab101c62a5d8c22853d7",
+               "urls" : [
+                    {"url" : "https://github.com/graalvm/truffle.git", "kind" : "git"},
+                    {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},
+                ]
+            },
             {
                "name" : "graal-core",
                "version" : "a0e54263b5001f68e25e329f9ebc9f3444a880c7",
@@ -32,7 +40,8 @@ suite = {
                     {"url" : "https://github.com/graalvm/graal-core", "kind" : "git"},
                     {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},
                 ]
-            }
+            },
+
         ],
    },
 
@@ -219,6 +228,7 @@ suite = {
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.truffle.r.parser",
+        "truffle:TRUFFLE_DEBUG",
       ],
       "checkstyle" : "com.oracle.truffle.r.runtime",
       "javaCompliance" : "1.8",
-- 
GitLab