annotate truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/AdvancedInstrumentTest.java @ 22219:1c0f490984d5

Merge with f47b601edbc626dcfe8b3636933b4834c89f7779
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Wed, 16 Sep 2015 15:36:22 -0700
parents dc83cc1f94f2 3aad794eec0e
children 20380d1d41f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
1 /*
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
4 *
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
8 *
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
13 * accompanied this code).
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
14 *
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
18 *
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
21 * questions.
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
22 */
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
23 package com.oracle.truffle.api.test.instrument;
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
24
22219
1c0f490984d5 Merge with f47b601edbc626dcfe8b3636933b4834c89f7779
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157 22214
diff changeset
25 import static org.junit.Assert.assertEquals;
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
26
22219
1c0f490984d5 Merge with f47b601edbc626dcfe8b3636933b4834c89f7779
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157 22214
diff changeset
27 import org.junit.Test;
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
28
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
29 import com.oracle.truffle.api.CallTarget;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
30 import com.oracle.truffle.api.Truffle;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
31 import com.oracle.truffle.api.TruffleRuntime;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
32 import com.oracle.truffle.api.instrument.AdvancedInstrumentRoot;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
33 import com.oracle.truffle.api.instrument.AdvancedInstrumentRootFactory;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
34 import com.oracle.truffle.api.instrument.Instrument;
22219
1c0f490984d5 Merge with f47b601edbc626dcfe8b3636933b4834c89f7779
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157 22214
diff changeset
35 import com.oracle.truffle.api.instrument.Instrumenter;
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
36 import com.oracle.truffle.api.instrument.Probe;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
37 import com.oracle.truffle.api.nodes.Node;
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
38 import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestAdditionNode;
21554
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21356
diff changeset
39 import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestAdvancedInstrumentCounterRoot;
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
40 import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestRootNode;
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
41 import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestValueNode;
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
42
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
43 /**
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
44 * Tests the kind of instrumentation where a client can provide an AST fragment to be
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
45 * <em>spliced</em> directly into the AST.
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
46 */
21353
876e710523c5 Truffle/Instrumentation: rename "Tool Eval" Instrument kind to "Advanced" Instrument kind
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21181
diff changeset
47 public class AdvancedInstrumentTest {
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
48
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
49 @Test
22214
3aad794eec0e Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21951
diff changeset
50 public void testAdvancedInstrumentListener() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
3aad794eec0e Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21951
diff changeset
51 final Instrumenter instrumenter = InstrumentationTestNodes.createInstrumenter();
3aad794eec0e Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21951
diff changeset
52
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
53 // Create a simple addition AST
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
54 final TruffleRuntime runtime = Truffle.getRuntime();
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
55 final TestValueNode leftValueNode = new TestValueNode(6);
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
56 final TestValueNode rightValueNode = new TestValueNode(7);
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
57 final TestAdditionNode addNode = new TestAdditionNode(leftValueNode, rightValueNode);
22214
3aad794eec0e Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21951
diff changeset
58 final TestRootNode rootNode = new TestRootNode(addNode, instrumenter);
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
59 final CallTarget callTarget1 = runtime.createCallTarget(rootNode);
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
60
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
61 // Ensure it executes correctly
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
62 assertEquals(13, callTarget1.call());
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
63
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
64 // Probe the addition node
22214
3aad794eec0e Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21951
diff changeset
65 final Probe probe = instrumenter.probe(addNode);
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
66
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
67 assertEquals(13, callTarget1.call());
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
68
21354
575032310b2c Truffle/Instrumentation: runtime failures executing an AdvancedInstrument root are now reported automatically via a new mehtod onAdvancedInstrumentResultListener.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21353
diff changeset
69 // Attach a null factory; it never actually attaches a node.
21355
442b57a7f208 Truffle/Instrumentation: change the signature for creation of Advanced instruments, refactor how the callback listener is managed.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21354
diff changeset
70 final Instrument instrument = Instrument.create(null, new AdvancedInstrumentRootFactory() {
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
71
21353
876e710523c5 Truffle/Instrumentation: rename "Tool Eval" Instrument kind to "Advanced" Instrument kind
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21181
diff changeset
72 public AdvancedInstrumentRoot createInstrumentRoot(Probe p, Node n) {
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
73 return null;
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
74 }
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
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21355
diff changeset
75 }, null, "test AdvancedInstrument");
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
76 probe.attach(instrument);
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
77
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
78 assertEquals(13, callTarget1.call());
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
79
21353
876e710523c5 Truffle/Instrumentation: rename "Tool Eval" Instrument kind to "Advanced" Instrument kind
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21181
diff changeset
80 final TestAdvancedInstrumentCounterRoot counter = new TestAdvancedInstrumentCounterRoot();
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
81
21354
575032310b2c Truffle/Instrumentation: runtime failures executing an AdvancedInstrument root are now reported automatically via a new mehtod onAdvancedInstrumentResultListener.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21353
diff changeset
82 // Attach a factory that splices an execution counter into the AST.
21355
442b57a7f208 Truffle/Instrumentation: change the signature for creation of Advanced instruments, refactor how the callback listener is managed.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21354
diff changeset
83 probe.attach(Instrument.create(null, new AdvancedInstrumentRootFactory() {
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
84
21353
876e710523c5 Truffle/Instrumentation: rename "Tool Eval" Instrument kind to "Advanced" Instrument kind
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21181
diff changeset
85 public AdvancedInstrumentRoot createInstrumentRoot(Probe p, Node n) {
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
86 return counter;
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
87 }
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
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21355
diff changeset
88 }, null, "test AdvancedInstrument"));
21181
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
89 assertEquals(0, counter.getCount());
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
90
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
91 assertEquals(13, callTarget1.call());
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
92
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
93 assertEquals(1, counter.getCount());
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
94 }
78a4b44420cf Truffle/Instrumentation: rename the "SplicedNode" Instrument kind to the "ToolEval" instrument kind, along with some redesign based on earlier feedback.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
95 }