diff graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/AdvancedInstrumentTest.java @ 21355:442b57a7f208

Truffle/Instrumentation: change the signature for creation of Advanced instruments, refactor how the callback listener is managed.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 12 May 2015 16:06:00 -0700
parents 575032310b2c
children e34bc00733d1
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/AdvancedInstrumentTest.java	Tue May 12 14:48:33 2015 -0700
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/AdvancedInstrumentTest.java	Tue May 12 16:06:00 2015 -0700
@@ -41,7 +41,7 @@
 public class AdvancedInstrumentTest {
 
     @Test
-    public void testSpliceInstrumentListener() {
+    public void testAdvancedInstrumentListener() {
         // Create a simple addition AST
         final TruffleRuntime runtime = Truffle.getRuntime();
         final TestValueNode leftValueNode = new TestValueNode(6);
@@ -59,13 +59,12 @@
         assertEquals(13, callTarget1.call());
 
         // Attach a null factory; it never actually attaches a node.
-        final Instrument instrument = Instrument.create(new AdvancedInstrumentRootFactory(null) {
+        final Instrument instrument = Instrument.create(null, new AdvancedInstrumentRootFactory() {
 
-            @Override
             public AdvancedInstrumentRoot createInstrumentRoot(Probe p, Node n) {
                 return null;
             }
-        }, null);
+        }, "test AdvancedInstrument");
         probe.attach(instrument);
 
         assertEquals(13, callTarget1.call());
@@ -73,19 +72,16 @@
         final TestAdvancedInstrumentCounterRoot counter = new TestAdvancedInstrumentCounterRoot();
 
         // Attach a factory that splices an execution counter into the AST.
-        probe.attach(Instrument.create(new AdvancedInstrumentRootFactory(null) {
+        probe.attach(Instrument.create(null, new AdvancedInstrumentRootFactory() {
 
-            @Override
             public AdvancedInstrumentRoot createInstrumentRoot(Probe p, Node n) {
                 return counter;
             }
-        }, null));
+        }, "test AdvancedInstrument"));
         assertEquals(0, counter.getCount());
 
         assertEquals(13, callTarget1.call());
 
         assertEquals(1, counter.getCount());
-
     }
-
 }