Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/InitializationTest.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 d3bdaa91bc82 |
children | 20380d1d41f2 |
rev | line source |
---|---|
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
1 /* |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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. |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
4 * |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
8 * |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
14 * |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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, |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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. |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
18 * |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
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 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
21 * questions. |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
22 */ |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
23 package com.oracle.truffle.api.test.vm; |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
24 |
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:
22110
diff
changeset
|
25 import static org.junit.Assert.assertNotNull; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
26 import static org.junit.Assert.assertNull; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
27 import static org.junit.Assert.assertTrue; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
28 import static org.junit.Assert.fail; |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
29 |
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:
22110
diff
changeset
|
30 import java.io.IOException; |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
31 |
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:
22110
diff
changeset
|
32 import org.junit.Test; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
33 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
34 import com.oracle.truffle.api.CallTarget; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
35 import com.oracle.truffle.api.Truffle; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
36 import com.oracle.truffle.api.TruffleLanguage; |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
37 import com.oracle.truffle.api.TruffleLanguage.Env; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
38 import com.oracle.truffle.api.debug.Breakpoint; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
39 import com.oracle.truffle.api.debug.DebugSupportProvider; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
40 import com.oracle.truffle.api.debug.Debugger; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
41 import com.oracle.truffle.api.debug.ExecutionEvent; |
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:
22110
diff
changeset
|
42 import com.oracle.truffle.api.frame.MaterializedFrame; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
43 import com.oracle.truffle.api.frame.VirtualFrame; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
44 import com.oracle.truffle.api.instrument.ASTProber; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
45 import com.oracle.truffle.api.instrument.AdvancedInstrumentResultListener; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
46 import com.oracle.truffle.api.instrument.AdvancedInstrumentRootFactory; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
47 import com.oracle.truffle.api.instrument.Instrumenter; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
48 import com.oracle.truffle.api.instrument.Probe; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
49 import com.oracle.truffle.api.instrument.ProbeNode; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
50 import com.oracle.truffle.api.instrument.StandardSyntaxTag; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
51 import com.oracle.truffle.api.instrument.ToolSupportProvider; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
52 import com.oracle.truffle.api.instrument.Visualizer; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
53 import com.oracle.truffle.api.nodes.Node; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
54 import com.oracle.truffle.api.nodes.NodeVisitor; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
55 import com.oracle.truffle.api.nodes.RootNode; |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
56 import com.oracle.truffle.api.source.Source; |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
57 import com.oracle.truffle.api.source.SourceSection; |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
58 import com.oracle.truffle.api.vm.EventConsumer; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
59 import com.oracle.truffle.api.vm.TruffleVM; |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
60 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
61 /** |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
62 * Bug report validating test. |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
63 * <p> |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
64 * It has been reported that calling {@link Env#importSymbol(java.lang.String)} in |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
65 * {@link TruffleLanguage TruffleLanguage.createContext(env)} yields a {@link NullPointerException}. |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
66 * <p> |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
67 * The other report was related to specifying an abstract language class in the RootNode and |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
68 * problems with debugging later on. That is what the other part of this test - once it obtains |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
69 * Debugger instance simulates. |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
70 */ |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
71 public class InitializationTest { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
72 @Test |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
73 public void accessProbeForAbstractLanguage() throws IOException { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
74 final Debugger[] arr = {null}; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
75 TruffleVM vm = TruffleVM.newVM().onEvent(new EventConsumer<ExecutionEvent>(ExecutionEvent.class) { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
76 @Override |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
77 protected void on(ExecutionEvent event) { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
78 arr[0] = event.getDebugger(); |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
79 } |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
80 }).build(); |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
81 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
82 Source source = Source.fromText("any text", "any text").withMimeType("application/x-abstrlang"); |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
83 |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
84 vm.eval(source); |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
85 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
86 assertNotNull("Debugger found", arr[0]); |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
87 |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
88 try { |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
89 Debugger d = arr[0]; |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
90 Breakpoint b = d.setLineBreakpoint(0, source.createLineLocation(1), true); |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
91 assertTrue(b.isEnabled()); |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
92 b.setCondition("true"); |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
93 |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
94 vm.eval(source); |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
95 } catch (InstrumentOKException ex) { |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
96 // OK |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
97 return; |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
98 } |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
99 fail("We should properly call up to TestLanguage.createAdvancedInstrumentRootFactory"); |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
100 } |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
101 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
102 private static final class MMRootNode extends RootNode { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
103 @Child ANode node; |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
104 |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
105 MMRootNode(SourceSection ss) { |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
106 super(AbstractLanguage.class, ss, null); |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
107 node = new ANode(42); |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
108 adoptChildren(); |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
109 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
110 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
111 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
112 public Object execute(VirtualFrame frame) { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
113 return node.constant(); |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
114 } |
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:
22110
diff
changeset
|
115 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
116 @Override |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
117 public void applyInstrumentation() { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
118 super.applyInstrumentation(node); |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
119 } |
19818
907128d02b31
Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19518
diff
changeset
|
120 } |
907128d02b31
Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19518
diff
changeset
|
121 |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
122 private static class ANode extends Node { |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
123 private final int constant; |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
124 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
125 public ANode(int constant) { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
126 this.constant = constant; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
127 } |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
128 |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
129 @Override |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
130 public SourceSection getSourceSection() { |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
131 return getRootNode().getSourceSection(); |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
132 } |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
133 |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
134 @Override |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
135 public boolean isInstrumentable() { |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
136 return true; |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
137 } |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
138 |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
139 @Override |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
140 public ProbeNode.WrapperNode createWrapperNode() { |
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:
22110
diff
changeset
|
141 return new ANodeWrapper(this); |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
142 } |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
143 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
144 Object constant() { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
145 return constant; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
146 } |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
147 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
148 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
149 |
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:
22110
diff
changeset
|
150 private static class ANodeWrapper extends ANode implements ProbeNode.WrapperNode { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
151 @Child ANode child; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
152 private ProbeNode probeNode; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
153 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
154 ANodeWrapper(ANode node) { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
155 super(1); // dummy |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
156 this.child = node; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
157 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
158 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
159 @Override |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
160 public Node getChild() { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
161 return child; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
162 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
163 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
164 @Override |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
165 public Probe getProbe() { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
166 return probeNode.getProbe(); |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
167 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
168 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
169 @Override |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
170 public void insertProbe(ProbeNode pn) { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
171 this.probeNode = pn; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
172 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
173 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
174 @Override |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
175 public String instrumentationInfo() { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
176 throw new UnsupportedOperationException(); |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
177 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
178 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
179 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
180 private abstract static class AbstractLanguage extends TruffleLanguage<Object> { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
181 } |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
182 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
183 @TruffleLanguage.Registration(mimeType = "application/x-abstrlang", name = "AbstrLang", version = "0.1") |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
184 public static final class TestLanguage extends AbstractLanguage implements DebugSupportProvider { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
185 public static final TestLanguage INSTANCE = new TestLanguage(); |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
186 |
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:
22110
diff
changeset
|
187 private final ASTProber prober = new ASTProber() { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
188 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
189 public void probeAST(final Instrumenter instrumenter, Node startNode) { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
190 startNode.accept(new NodeVisitor() { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
191 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
192 public boolean visit(Node node) { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
193 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
194 if (node instanceof ANode) { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
195 instrumenter.probe(node).tagAs(StandardSyntaxTag.STATEMENT, null); |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
196 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
197 return true; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
198 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
199 }); |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
200 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
201 }; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
202 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
203 @Override |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
204 protected Object createContext(Env env) { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
205 assertNull("Not defined symbol", env.importSymbol("unknown")); |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
206 return env; |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
207 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
208 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
209 @Override |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
210 protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException { |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
211 return Truffle.getRuntime().createCallTarget(new MMRootNode(code.createSection("1st line", 1))); |
19818
907128d02b31
Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19518
diff
changeset
|
212 } |
907128d02b31
Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19518
diff
changeset
|
213 |
20885
e7ece52e1ff3
Truffle/Instrumentation: remove two helper classes not adding enough value.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20106
diff
changeset
|
214 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
215 protected Object findExportedSymbol(Object context, String globalName, boolean onlyExplicit) { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
216 return null; |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
217 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
218 |
20885
e7ece52e1ff3
Truffle/Instrumentation: remove two helper classes not adding enough value.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20106
diff
changeset
|
219 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
220 protected Object getLanguageGlobal(Object context) { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
221 throw new UnsupportedOperationException(); |
19818
907128d02b31
Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19518
diff
changeset
|
222 } |
907128d02b31
Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19518
diff
changeset
|
223 |
20885
e7ece52e1ff3
Truffle/Instrumentation: remove two helper classes not adding enough value.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20106
diff
changeset
|
224 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
225 protected boolean isObjectOfLanguage(Object object) { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
226 throw new UnsupportedOperationException(); |
19818
907128d02b31
Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19518
diff
changeset
|
227 } |
907128d02b31
Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19518
diff
changeset
|
228 |
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:
22110
diff
changeset
|
229 @SuppressWarnings("deprecation") |
20885
e7ece52e1ff3
Truffle/Instrumentation: remove two helper classes not adding enough value.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20106
diff
changeset
|
230 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
231 protected ToolSupportProvider getToolSupport() { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
232 throw new UnsupportedOperationException(); |
19818
907128d02b31
Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19518
diff
changeset
|
233 } |
907128d02b31
Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19518
diff
changeset
|
234 |
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:
22110
diff
changeset
|
235 @SuppressWarnings("deprecation") |
20885
e7ece52e1ff3
Truffle/Instrumentation: remove two helper classes not adding enough value.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20106
diff
changeset
|
236 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
237 protected DebugSupportProvider getDebugSupport() { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
238 throw new UnsupportedOperationException(); |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
239 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
240 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
241 @Override |
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:
22110
diff
changeset
|
242 public Object evalInContext(Source source, Node node, MaterializedFrame mFrame) { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
243 throw new UnsupportedOperationException(); |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
244 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
245 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
246 @Override |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
247 public AdvancedInstrumentRootFactory createAdvancedInstrumentRootFactory(String expr, AdvancedInstrumentResultListener resultListener) { |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
248 throw new InstrumentOKException(); |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
249 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
250 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
251 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
252 public Visualizer getVisualizer() { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
253 throw new UnsupportedOperationException(); |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
254 } |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
255 |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
256 @Override |
22215
d3bdaa91bc82
Truffle/Instrumentation: method signature on TruffleLanguage for getting each language's "default" ASTProber
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22214
diff
changeset
|
257 protected ASTProber getDefaultASTProber() { |
d3bdaa91bc82
Truffle/Instrumentation: method signature on TruffleLanguage for getting each language's "default" ASTProber
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22214
diff
changeset
|
258 return prober; |
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:
22110
diff
changeset
|
259 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
260 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
261 @SuppressWarnings("deprecation") |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22110
diff
changeset
|
262 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
263 public void enableASTProbing(ASTProber astProber) { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
264 throw new UnsupportedOperationException(); |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
265 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
266 } |
22110
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
267 |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
268 private static final class InstrumentOKException extends RuntimeException { |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
269 static final long serialVersionUID = 1L; |
c2cb9f1c8688
Replacing the langClass.newInstance() hack in Debugger with proper way to obtain the language instance
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22109
diff
changeset
|
270 } |
18989
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
271 } |