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 e343e52ff66e7b26db4353a73881efad020312f3..921e6b763a09c3382814df79a335406a8b2c3b23 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 0ca769eaa5f61d79ae53d718546f80371122e906..3fff34c2ad43ad22a05ba966c305c843cb4c8bfc 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 90e5649085cbc0b8717a5aa7c1d454462b6a2679..70bda866deda77c3008f5519f9c85339645824ce 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 2bfa09ae8d6570b1fe0e5df1b21f91527c6ec625..2d2ff936bc88918e43e503817ddc5e9a77538703 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 7a8ffc3795c5d8b0b2d4a18ca4e7ead80dca0a6a..ed58d2311b2c90105134cad2a1fd45e97ce7c9cd 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 cc5a512ce2d6e324aeb8f00b5fbe3ace18c80135..f6a7f0db7d59992d0a2e306febecd6b53d6d05b5 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 3b6ea6ba9905dfe5e19850e8b53ca7c302252a8e..ea2338c9a7d20826f15ec688fc402e797e9f7b27 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 a3b54e872e40f1b8ba9ae3a81d7c5c6fad7f5fd6..350a11e0c34249a4d56842ae2594f96395677357 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 7f5b694b06537f899f0304c8765607aed29d9f80..75e32fd0802a978710322964a28bb756e54b5277 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 3237a99b260e4bb22c8ab79d99a8e7e38f1c1110..9d3ea450bc17547d7f86ed6c4e782e227e6e8558 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 b5ca21981bfe53d4b6a49a9e5651c54fe5a52bd6..c42a6dbd1eece79cc3d085fc7fbb8901d62a8ed8 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 063887490c149cf79700490b6a29fe3796f5754e..333fbe9f21a37cc6b34b24ee6b7d8d5bce7b3fa2 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 76d4203238bc32d70b2ea1fa11c66df3a36834e4..d83341908bdaa4d8ee5d261dca922591fb793da4 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 fcc303d1a5dc57b82b70640a6330428418a5b24c..480ebdc9806675e95088920f9fd0f4b953fe1065 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 d3b790160193fc0f5e3a94d2849209ec7f9d7f90..e83bac692d6eff3c9784b117838ac20a6aa7e46c 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"},