comparison graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/AdvancedInstrumentTest.java @ 21356:e34bc00733d1

Truffle/Instrumentation: an Advanced Instrument can now be created that requires the evaluation result be of a specified type, reporting a failure if not
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 12 May 2015 17:29:49 -0700
parents 442b57a7f208
children 28cbfacd0518 b1530a6cce8c
comparison
equal deleted inserted replaced
21355:442b57a7f208 21356:e34bc00733d1
62 final Instrument instrument = Instrument.create(null, new AdvancedInstrumentRootFactory() { 62 final Instrument instrument = Instrument.create(null, new AdvancedInstrumentRootFactory() {
63 63
64 public AdvancedInstrumentRoot createInstrumentRoot(Probe p, Node n) { 64 public AdvancedInstrumentRoot createInstrumentRoot(Probe p, Node n) {
65 return null; 65 return null;
66 } 66 }
67 }, "test AdvancedInstrument"); 67 }, null, "test AdvancedInstrument");
68 probe.attach(instrument); 68 probe.attach(instrument);
69 69
70 assertEquals(13, callTarget1.call()); 70 assertEquals(13, callTarget1.call());
71 71
72 final TestAdvancedInstrumentCounterRoot counter = new TestAdvancedInstrumentCounterRoot(); 72 final TestAdvancedInstrumentCounterRoot counter = new TestAdvancedInstrumentCounterRoot();
75 probe.attach(Instrument.create(null, new AdvancedInstrumentRootFactory() { 75 probe.attach(Instrument.create(null, new AdvancedInstrumentRootFactory() {
76 76
77 public AdvancedInstrumentRoot createInstrumentRoot(Probe p, Node n) { 77 public AdvancedInstrumentRoot createInstrumentRoot(Probe p, Node n) {
78 return counter; 78 return counter;
79 } 79 }
80 }, "test AdvancedInstrument")); 80 }, null, "test AdvancedInstrument"));
81 assertEquals(0, counter.getCount()); 81 assertEquals(0, counter.getCount());
82 82
83 assertEquals(13, callTarget1.call()); 83 assertEquals(13, callTarget1.call());
84 84
85 assertEquals(1, counter.getCount()); 85 assertEquals(1, counter.getCount());