diff truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/InitializationTest.java @ 22220:20380d1d41f2

Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework - deprecate Node.isInstrumentable() and Node.createWrapperNode(), now Instrumenter methods - Instrumenter uses new Accessor methods to delegate implementation to TruffleLanguage implementations - rework many instrumentation-related tests
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Thu, 17 Sep 2015 21:23:57 -0700
parents 1c0f490984d5
children c896a8e70777
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/InitializationTest.java	Wed Sep 16 15:36:22 2015 -0700
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/InitializationTest.java	Thu Sep 17 21:23:57 2015 -0700
@@ -47,6 +47,7 @@
 import com.oracle.truffle.api.instrument.Instrumenter;
 import com.oracle.truffle.api.instrument.Probe;
 import com.oracle.truffle.api.instrument.ProbeNode;
+import com.oracle.truffle.api.instrument.ProbeNode.WrapperNode;
 import com.oracle.truffle.api.instrument.StandardSyntaxTag;
 import com.oracle.truffle.api.instrument.ToolSupportProvider;
 import com.oracle.truffle.api.instrument.Visualizer;
@@ -79,7 +80,7 @@
             }
         }).build();
 
-        Source source = Source.fromText("any text", "any text").withMimeType("application/x-abstrlang");
+        Source source = Source.fromText("accessProbeForAbstractLanguage text", "accessProbeForAbstractLanguage").withMimeType("application/x-abstrlang");
 
         vm.eval(source);
 
@@ -131,14 +132,16 @@
             return getRootNode().getSourceSection();
         }
 
+        @SuppressWarnings("deprecation")
         @Override
         public boolean isInstrumentable() {
             return true;
         }
 
+        @SuppressWarnings("deprecation")
         @Override
         public ProbeNode.WrapperNode createWrapperNode() {
-            return new ANodeWrapper(this);
+            throw new UnsupportedOperationException();
         }
 
         Object constant() {
@@ -181,7 +184,7 @@
     }
 
     @TruffleLanguage.Registration(mimeType = "application/x-abstrlang", name = "AbstrLang", version = "0.1")
-    public static final class TestLanguage extends AbstractLanguage implements DebugSupportProvider {
+    public static final class TestLanguage extends AbstractLanguage {
         public static final TestLanguage INSTANCE = new TestLanguage();
 
         private final ASTProber prober = new ASTProber() {
@@ -254,6 +257,16 @@
         }
 
         @Override
+        protected boolean isInstrumentable(Node node) {
+            return node instanceof ANode;
+        }
+
+        @Override
+        protected WrapperNode createWrapperNode(Node node) {
+            return node instanceof ANode ? new ANodeWrapper((ANode) node) : null;
+        }
+
+        @Override
         protected ASTProber getDefaultASTProber() {
             return prober;
         }