From 253bb9bb95aa8e66a9397ddd78d0c73ee7b78c24 Mon Sep 17 00:00:00 2001
From: stepan <stepan.sindelar@oracle.com>
Date: Thu, 1 Mar 2018 10:30:20 +0100
Subject: [PATCH] Migrate uses of deprecated @Instrumentable to
 InstrumentableNode

---
 .../oracle/truffle/r/library/utils/Rprof.java |  4 ++--
 .../nodes/builtin/fastr/FastRSyntaxTree.java  |  7 +++---
 .../nodes/builtin/helpers/DebugHandling.java  | 12 +++++-----
 .../nodes/builtin/helpers/TraceHandling.java  |  6 ++---
 .../com/oracle/truffle/r/nodes/RASTUtils.java |  2 +-
 .../r/nodes/control/AbstractLoopNode.java     |  4 ++--
 .../r/nodes/function/RCallBaseNode.java       |  9 +++++--
 .../function/RCallBaseNodeWrapperFactory.java | 11 +++------
 .../r/nodes/instrumentation/RSyntaxTags.java  |  8 ++++---
 .../memprof/MemAllocProfilerInstrument.java   |  4 ++--
 .../truffle/r/runtime/nodes/RBaseNode.java    |  9 +++----
 .../r/runtime/nodes/RInstrumentableNode.java  | 10 +++++---
 .../oracle/truffle/r/runtime/nodes/RNode.java | 24 +++++++++++++++----
 .../instrumentation/RNodeWrapperFactory.java  | 11 +++------
 mx.fastr/suite.py                             |  2 +-
 15 files changed, 71 insertions(+), 52 deletions(-)

diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java
index e343e52ff6..921e6b763a 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -208,7 +208,7 @@ public abstract class Rprof extends RExternalBuiltinNode.Arg8 implements MemoryC
             SourceSectionFilter.Builder builder = SourceSectionFilter.newBuilder();
             builder.tagIs(StandardTags.StatementTag.class);
             SourceSectionFilter filter = builder.build();
-            RInstrumentation.getInstrumenter().attachListener(filter, this);
+            RInstrumentation.getInstrumenter().attachExecutionEventListener(filter, this);
         }
 
         private void intervalElapsed() {
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java
index 0ca769eaa5..3fff34c2ad 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -32,6 +32,7 @@ import java.io.IOException;
 
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.Specialization;
+import com.oracle.truffle.api.instrumentation.Tag;
 import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.NodeVisitor;
 import com.oracle.truffle.api.source.SourceSection;
@@ -226,8 +227,8 @@ public abstract class FastRSyntaxTree extends RBuiltinNode.Arg4 {
     private static void printTags(RNode node) {
         writeString(" # tags [ ", false);
         for (int i = 0; i < RSyntaxTags.ALL_TAGS.length; i++) {
-            Class<?> tag = RSyntaxTags.ALL_TAGS[i];
-            if (node.isTaggedWith(tag)) {
+            Class<? extends Tag> tag = RSyntaxTags.ALL_TAGS[i];
+            if (node.hasTag(tag)) {
                 writeString(tag.getSimpleName(), false);
                 writeString(" ", false);
             }
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java
index 90e5649085..70bda866de 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java
@@ -169,7 +169,7 @@ public class DebugHandling {
         SourceSection lineSourceSection = fdn.createSection(line);
         SourceSectionFilter.Builder functionBuilder = RInstrumentation.createLineFilter(fdn, line, StandardTags.StatementTag.class);
         LineBreakpointEventListener listener = new LineBreakpointEventListener(lineSourceSection);
-        listener.setBinding(instrumenter.attachListener(functionBuilder.build(), listener));
+        listener.setBinding(instrumenter.attachExecutionEventListener(functionBuilder.build(), listener));
         RContext.getInstance().stateInstrumentation.putDebugListener(lineSourceSection, listener);
     }
 
@@ -317,7 +317,7 @@ public class DebugHandling {
         @TruffleBoundary
         private void attachStepInto() {
             FunctionStatementsEventListener parentListener = getFunctionStatementsEventListener(functionDefinitionNode);
-            parentListener.stepIntoInstrument = RInstrumentation.getInstrumenter().attachListener(SourceSectionFilter.newBuilder().tagIs(StandardTags.RootTag.class).build(),
+            parentListener.stepIntoInstrument = RInstrumentation.getInstrumenter().attachExecutionEventListener(SourceSectionFilter.newBuilder().tagIs(StandardTags.RootTag.class).build(),
                             new StepIntoInstrumentListener(parentListener));
 
         }
@@ -400,7 +400,7 @@ public class DebugHandling {
                 SourceSectionFilter.Builder statementBuilder = RInstrumentation.createFunctionStatementFilter(functionDefinitionNode);
                 statementBuilder.tagIsNot(RSyntaxTags.LoopTag.class);
                 Instrumenter instrumenter = RInstrumentation.getInstrumenter();
-                statementListener.setBinding(instrumenter.attachListener(statementBuilder.build(), statementListener));
+                statementListener.setBinding(instrumenter.attachExecutionEventListener(statementBuilder.build(), statementListener));
             }
         }
 
@@ -408,7 +408,7 @@ public class DebugHandling {
             LoopStatementEventListener lser = new LoopStatementEventListener(functionDefinitionNode, text, condition, loopNode, this);
             loopStatementListeners.add(lser);
             Instrumenter instrumenter = RInstrumentation.getInstrumenter();
-            lser.setBinding(instrumenter.attachListener(ssf, lser));
+            lser.setBinding(instrumenter.attachExecutionEventListener(ssf, lser));
             return lser;
         }
 
@@ -432,7 +432,7 @@ public class DebugHandling {
 
             Instrumenter instrumenter = RInstrumentation.getInstrumenter();
             SourceSectionFilter.Builder functionBuilder = RInstrumentation.createFunctionFilter(functionDefinitionNode, StandardTags.RootTag.class);
-            setBinding(instrumenter.attachListener(functionBuilder.build(), this));
+            setBinding(instrumenter.attachExecutionEventListener(functionBuilder.build(), this));
 
             // Next attach statement handler to all STATEMENTs except LOOPs
             attachStatementListener();
@@ -621,7 +621,7 @@ public class DebugHandling {
                 // in case we did a step into that never called a function
                 clearStepInstrument();
                 RBaseNode node = (RBaseNode) context.getInstrumentedNode();
-                if (node.isTaggedWith(StandardTags.RootTag.class)) {
+                if (node.hasTag(StandardTags.RootTag.class)) {
                     // already handled
                     return;
                 }
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/TraceHandling.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/TraceHandling.java
index 2bfa09ae8d..2d2ff936bc 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/TraceHandling.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/TraceHandling.java
@@ -90,7 +90,7 @@ public class TraceHandling {
             SourceSectionFilter.Builder builder = SourceSectionFilter.newBuilder();
             builder.tagIs(StandardTags.RootTag.class);
             SourceSectionFilter filter = builder.build();
-            RInstrumentation.getInstrumenter().attachListener(filter, fser);
+            RInstrumentation.getInstrumenter().attachExecutionEventListener(filter, fser);
             setOutputHandler();
         }
     }
@@ -105,7 +105,7 @@ public class TraceHandling {
         if (at == RMissing.instance) {
             // simple case
             TracerFunctionEntryEventListener listener = new TracerFunctionEntryEventListener(tracer, print);
-            binding = RInstrumentation.getInstrumenter().attachListener(RInstrumentation.createFunctionStartFilter(func).build(), listener);
+            binding = RInstrumentation.getInstrumenter().attachExecutionEventListener(RInstrumentation.createFunctionStartFilter(func).build(), listener);
             setOutputHandler();
             RContext.getInstance().stateInstrumentation.putTraceBinding(RInstrumentation.getSourceSection(func), binding);
         }
@@ -114,7 +114,7 @@ public class TraceHandling {
 
     private static void attachPrimitiveTraceHandler(RFunction func) {
         PrimitiveFunctionEntryEventListener fser = new PrimitiveFunctionEntryEventListener();
-        EventBinding<TraceEventListener> binding = RInstrumentation.getInstrumenter().attachListener(RInstrumentation.createFunctionStartFilter(func).build(), fser);
+        EventBinding<TraceEventListener> binding = RInstrumentation.getInstrumenter().attachExecutionEventListener(RInstrumentation.createFunctionStartFilter(func).build(), fser);
         setOutputHandler();
         RContext.getInstance().stateInstrumentation.putTraceBinding(RInstrumentation.getSourceSection(func), binding);
     }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTUtils.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTUtils.java
index 7a8ffc3795..ed58d2311b 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTUtils.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTUtils.java
@@ -27,7 +27,7 @@ import com.oracle.truffle.api.RootCallTarget;
 import com.oracle.truffle.api.Truffle;
 import com.oracle.truffle.api.frame.FrameDescriptor;
 import com.oracle.truffle.api.frame.MaterializedFrame;
-import com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode;
+import com.oracle.truffle.api.instrumentation.InstrumentableNode.WrapperNode;
 import com.oracle.truffle.api.interop.TruffleObject;
 import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.NodeUtil;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java
index cc5a512ce2..f6a7f0db7d 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -23,7 +23,7 @@
 package com.oracle.truffle.r.nodes.control;
 
 import com.oracle.truffle.api.CompilerAsserts;
-import com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode;
+import com.oracle.truffle.api.instrumentation.InstrumentableNode.WrapperNode;
 import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.RepeatingNode;
 import com.oracle.truffle.api.nodes.RootNode;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallBaseNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallBaseNode.java
index 3b6ea6ba99..ea2338c9a7 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallBaseNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallBaseNode.java
@@ -24,7 +24,8 @@ package com.oracle.truffle.r.nodes.function;
 
 import com.oracle.truffle.api.dsl.TypeSystemReference;
 import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrumentation.Instrumentable;
+import com.oracle.truffle.api.instrumentation.ProbeNode;
+import com.oracle.truffle.r.nodes.function.RCallBaseNodeWrapperFactory.RCallBaseNodeWrapper;
 import com.oracle.truffle.r.runtime.Arguments;
 import com.oracle.truffle.r.runtime.data.RTypes;
 import com.oracle.truffle.r.runtime.nodes.RInstrumentableNode;
@@ -32,9 +33,13 @@ import com.oracle.truffle.r.runtime.nodes.RNode;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
 
 @TypeSystemReference(RTypes.class)
-@Instrumentable(factory = com.oracle.truffle.r.nodes.function.RCallBaseNodeWrapperFactory.class)
 public abstract class RCallBaseNode extends RNode implements RInstrumentableNode {
 
+    @Override
+    public WrapperNode createWrapper(ProbeNode probe) {
+        return new RCallBaseNodeWrapper(this, probe);
+    }
+
     public abstract Object execute(VirtualFrame frame, Object function);
 
     public abstract Arguments<RSyntaxNode> getArguments();
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallBaseNodeWrapperFactory.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallBaseNodeWrapperFactory.java
index a3b54e872e..350a11e0c3 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallBaseNodeWrapperFactory.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallBaseNodeWrapperFactory.java
@@ -23,7 +23,7 @@
 package com.oracle.truffle.r.nodes.function;
 
 import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrumentation.InstrumentableFactory;
+import com.oracle.truffle.api.instrumentation.InstrumentableNode.WrapperNode;
 import com.oracle.truffle.api.instrumentation.ProbeNode;
 import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.NodeCost;
@@ -33,10 +33,10 @@ import com.oracle.truffle.r.runtime.Arguments;
 import com.oracle.truffle.r.runtime.nodes.RNode;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
 
-public class RCallBaseNodeWrapperFactory implements InstrumentableFactory<RCallBaseNode> {
+public class RCallBaseNodeWrapperFactory {
 
     @NodeInfo(cost = NodeCost.NONE)
-    public static final class RCallBaseNodeWrapper extends RCallBaseNode implements InstrumentableFactory.WrapperNode {
+    public static final class RCallBaseNodeWrapper extends RCallBaseNode implements WrapperNode {
         @Child private RCallBaseNode delegate;
         @Child private ProbeNode probeNode;
 
@@ -151,9 +151,4 @@ public class RCallBaseNodeWrapperFactory implements InstrumentableFactory<RCallB
             return delegate.getSourceSection();
         }
     }
-
-    @Override
-    public InstrumentableFactory.WrapperNode createWrapper(RCallBaseNode node, ProbeNode probe) {
-        return new RCallBaseNodeWrapper(node, probe);
-    }
 }
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 7f5b694b06..75e32fd080 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -23,14 +23,16 @@
 package com.oracle.truffle.r.nodes.instrumentation;
 
 import com.oracle.truffle.api.instrumentation.StandardTags;
+import com.oracle.truffle.api.instrumentation.Tag;
 
 public class RSyntaxTags {
 
-    public final class LoopTag {
+    public final class LoopTag extends Tag {
         private LoopTag() {
 
         }
     }
 
-    public static final Class<?>[] ALL_TAGS = new Class<?>[]{StandardTags.CallTag.class, StandardTags.StatementTag.class, StandardTags.RootTag.class, RSyntaxTags.LoopTag.class};
+    @SuppressWarnings("unchecked") public static final Class<? extends Tag>[] ALL_TAGS = (Class<? extends Tag>[]) new Class<?>[]{StandardTags.CallTag.class, StandardTags.StatementTag.class,
+                    StandardTags.RootTag.class, LoopTag.class};
 }
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/instrument/memprof/MemAllocProfilerInstrument.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/instrument/memprof/MemAllocProfilerInstrument.java
index 3237a99b26..9d3ea450bc 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/instrument/memprof/MemAllocProfilerInstrument.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/instrument/memprof/MemAllocProfilerInstrument.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -53,7 +53,7 @@ public class MemAllocProfilerInstrument extends TruffleInstrument {
         MemAllocEventFactory eventFactory = new MemAllocEventFactory(env);
         SourceSectionFilter.Builder builder = SourceSectionFilter.newBuilder();
         SourceSectionFilter filter = builder.tagIs(StandardTags.StatementTag.class).build();
-        instrumenter.attachFactory(filter, eventFactory);
+        instrumenter.attachExecutionEventFactory(filter, eventFactory);
         allocationEventBinding = instrumenter.attachAllocationListener(AllocationEventFilter.newBuilder().build(), eventFactory);
 
         env.registerService(eventFactory.memAllocStacks);
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RBaseNode.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RBaseNode.java
index b5ca21981b..c42a6dbd1e 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RBaseNode.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RBaseNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.nodes;
 
 import com.oracle.truffle.api.CompilerDirectives;
 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
+import com.oracle.truffle.api.instrumentation.Tag;
 import com.oracle.truffle.api.nodes.LoopNode;
 import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.NodeVisitor;
@@ -184,9 +185,9 @@ public abstract class RBaseNode extends Node {
         return getRSyntaxNode().getSourceSection();
     }
 
-    @Override
-    public boolean isTaggedWith(Class<?> tag) {
-        return RContext.getRRuntimeASTAccess().isTaggedWith(this, tag);
+    public boolean hasTag(Class<? extends Tag> tag) {
+        // RNode, which is instrumentable, overrides this to actually check if the node has the tag
+        return false;
     }
 
     private static final long WORK_SCALE_FACTOR = 100;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RInstrumentableNode.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RInstrumentableNode.java
index 063887490c..333fbe9f21 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RInstrumentableNode.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RInstrumentableNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -22,13 +22,17 @@
  */
 package com.oracle.truffle.r.runtime.nodes;
 
-import com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode;
+import com.oracle.truffle.api.instrumentation.InstrumentableNode.WrapperNode;
+import com.oracle.truffle.api.instrumentation.InstrumentableNode;
+import com.oracle.truffle.api.instrumentation.Tag;
 import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.r.runtime.RRuntimeASTAccess;
+import com.oracle.truffle.r.runtime.context.RContext;
 
 /**
  * Some additional support for instrumentable nodes.
  */
-public interface RInstrumentableNode {
+public interface RInstrumentableNode extends InstrumentableNode {
 
     /**
      * Unwrap a (potentially) wrapped node, returning the child. Since an AST may contain wrapper
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 76d4203238..d83341908b 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -25,17 +25,33 @@ package com.oracle.truffle.r.runtime.nodes;
 import com.oracle.truffle.api.CompilerDirectives;
 import com.oracle.truffle.api.dsl.TypeSystemReference;
 import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrumentation.Instrumentable;
+import com.oracle.truffle.api.instrumentation.ProbeNode;
+import com.oracle.truffle.api.instrumentation.Tag;
 import com.oracle.truffle.api.nodes.UnexpectedResultException;
 import com.oracle.truffle.r.runtime.RInternalError;
+import com.oracle.truffle.r.runtime.context.RContext;
 import com.oracle.truffle.r.runtime.data.RTypes;
 import com.oracle.truffle.r.runtime.data.RTypesGen;
-import com.oracle.truffle.r.runtime.nodes.instrumentation.RNodeWrapperFactory;
+import com.oracle.truffle.r.runtime.nodes.instrumentation.RNodeWrapperFactory.RNodeWrapper;
 
 @TypeSystemReference(RTypes.class)
-@Instrumentable(factory = RNodeWrapperFactory.class)
 public abstract class RNode extends RBaseNode implements RInstrumentableNode {
 
+    @Override
+    public boolean isInstrumentable() {
+        return true;
+    }
+
+    @Override
+    public boolean hasTag(Class<? extends Tag> tag) {
+        return RContext.getRRuntimeASTAccess().isTaggedWith(this, tag);
+    }
+
+    @Override
+    public WrapperNode createWrapper(ProbeNode probe) {
+        return new RNodeWrapper(this, probe);
+    }
+
     /**
      * Normal execute function that is called when the return value, but not its visibility is
      * needed.
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 fcc303d1a5..480ebdc980 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
@@ -23,7 +23,7 @@
 package com.oracle.truffle.r.runtime.nodes.instrumentation;
 
 import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrumentation.InstrumentableFactory;
+import com.oracle.truffle.api.instrumentation.InstrumentableNode;
 import com.oracle.truffle.api.instrumentation.ProbeNode;
 import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.NodeCost;
@@ -32,10 +32,10 @@ import com.oracle.truffle.api.source.SourceSection;
 import com.oracle.truffle.r.runtime.nodes.RNode;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
 
-public final class RNodeWrapperFactory implements InstrumentableFactory<RNode> {
+public final class RNodeWrapperFactory {
 
     @NodeInfo(cost = NodeCost.NONE)
-    public static final class RNodeWrapper extends RNode implements InstrumentableFactory.WrapperNode {
+    public static final class RNodeWrapper extends RNode implements InstrumentableNode.WrapperNode {
         @Child private RNode delegate;
         @Child private ProbeNode probeNode;
 
@@ -138,9 +138,4 @@ public final class RNodeWrapperFactory implements InstrumentableFactory<RNode> {
             return delegate.getSourceSection();
         }
     }
-
-    @Override
-    public com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode createWrapper(RNode node, ProbeNode probe) {
-        return new RNodeWrapper(node, probe);
-    }
 }
diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py
index d3b7901601..e83bac692d 100644
--- a/mx.fastr/suite.py
+++ b/mx.fastr/suite.py
@@ -7,7 +7,7 @@ suite = {
             {
                "name" : "truffle",
                "subdir" : True,
-               "version" : "3e12bec05f7a74f9fbdcd2d2f45f262492fd1306",
+               "version" : "440d89a72cdeb7bc7951e37462cd30bf12fa3ae6",
                "urls" : [
                     {"url" : "https://github.com/graalvm/graal", "kind" : "git"},
                     {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},
-- 
GitLab