Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/InitializationTest.java @ 22157:dc83cc1f94f2
Using fully qualified imports
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Wed, 16 Sep 2015 11:33:22 +0200 |
parents | c2cb9f1c8688 |
children | dcb70d90c11d 1c0f490984d5 |
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 |
22157
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
25 import com.oracle.truffle.api.CallTarget; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
26 import com.oracle.truffle.api.Truffle; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
27 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
|
28 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
|
29 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
|
30 import com.oracle.truffle.api.debug.DebugSupportException; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
31 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
|
32 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
|
33 import com.oracle.truffle.api.debug.ExecutionEvent; |
22157
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
34 import com.oracle.truffle.api.frame.MaterializedFrame; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
35 import com.oracle.truffle.api.frame.VirtualFrame; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
36 import com.oracle.truffle.api.instrument.ASTProber; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
37 import com.oracle.truffle.api.instrument.AdvancedInstrumentResultListener; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
38 import com.oracle.truffle.api.instrument.AdvancedInstrumentRootFactory; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
39 import com.oracle.truffle.api.instrument.Probe; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
40 import com.oracle.truffle.api.instrument.ProbeNode; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
41 import com.oracle.truffle.api.instrument.StandardSyntaxTag; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
42 import com.oracle.truffle.api.instrument.ToolSupportProvider; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
43 import com.oracle.truffle.api.instrument.Visualizer; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
44 import com.oracle.truffle.api.nodes.Node; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
45 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
|
46 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
|
47 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
|
48 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
|
49 import com.oracle.truffle.api.vm.TruffleVM; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
50 import java.io.IOException; |
22157
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
51 import static org.junit.Assert.assertNotNull; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
52 import static org.junit.Assert.assertNull; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
53 import static org.junit.Assert.assertTrue; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
54 import static org.junit.Assert.fail; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22110
diff
changeset
|
55 import org.junit.Test; |
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
|
56 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
57 /** |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
58 * Bug report validating test. |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
59 * <p> |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
60 * 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
|
61 * {@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
|
62 * <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
|
63 * 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
|
64 * 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
|
65 * 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
|
66 */ |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
67 public class InitializationTest { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
68 @Test |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
69 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
|
70 final Debugger[] arr = {null}; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
71 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
|
72 @Override |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
73 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
|
74 arr[0] = event.getDebugger(); |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
75 } |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
76 }).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
|
77 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
78 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
|
79 |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
80 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
|
81 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
82 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
|
83 |
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
|
84 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
|
85 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
|
86 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
|
87 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
|
88 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
|
89 |
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
|
90 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
|
91 } 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
|
92 // 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
|
93 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
|
94 } |
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 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
|
96 } |
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
|
97 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
98 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
|
99 @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
|
100 |
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
|
101 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
|
102 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
|
103 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
|
104 adoptChildren(); |
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 node.probe().tagAs(StandardSyntaxTag.STATEMENT, this); |
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
|
106 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
107 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
108 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
109 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
|
110 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
|
111 } |
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
|
112 } |
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
|
113 |
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
|
114 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
|
115 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
|
116 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
117 public ANode(int constant) { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
118 this.constant = constant; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
119 } |
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
|
120 |
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
|
121 @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
|
122 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
|
123 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
|
124 } |
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
|
125 |
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
|
126 @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
|
127 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
|
128 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
|
129 } |
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 |
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 @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
|
132 public ProbeNode.WrapperNode createWrapperNode() { |
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 class WN extends ANode implements ProbeNode.WrapperNode { |
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 private ProbeNode probeNode; |
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 |
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 public WN(int constant) { |
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 super(constant); |
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 |
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 @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
|
141 public Node getChild() { |
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 return ANode.this; |
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 } |
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
|
144 |
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
|
145 @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
|
146 public Probe getProbe() { |
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
|
147 return probeNode.getProbe(); |
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
|
148 } |
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
|
149 |
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
|
150 @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
|
151 public void insertProbe(ProbeNode pn) { |
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
|
152 this.probeNode = pn; |
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
|
153 } |
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
|
154 |
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
|
155 @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
|
156 public String instrumentationInfo() { |
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
|
157 throw new UnsupportedOperationException(); |
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
|
158 } |
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
|
159 } |
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
|
160 return new WN(constant); |
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
|
161 } |
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
|
162 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
163 Object constant() { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
164 return constant; |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
165 } |
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
|
166 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
167 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
168 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
169 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
|
170 } |
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
|
171 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
172 @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
|
173 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
|
174 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
|
175 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
176 @Override |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
177 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
|
178 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
|
179 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
|
180 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
181 |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
182 @Override |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
183 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
|
184 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
|
185 } |
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
|
186 |
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
|
187 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
188 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
|
189 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
|
190 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
191 |
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
|
192 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
193 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
|
194 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
|
195 } |
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
|
196 |
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
|
197 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
198 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
|
199 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
|
200 } |
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
|
201 |
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
|
202 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
203 protected ToolSupportProvider getToolSupport() { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
204 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
|
205 } |
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
|
206 |
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
|
207 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
208 protected DebugSupportProvider getDebugSupport() { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
209 return this; |
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
|
210 } |
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
|
211 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
212 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
213 public Object evalInContext(Source source, Node node, MaterializedFrame mFrame) throws DebugSupportException { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
214 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
|
215 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
216 |
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 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
218 public AdvancedInstrumentRootFactory createAdvancedInstrumentRootFactory(String expr, AdvancedInstrumentResultListener resultListener) throws DebugSupportException { |
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
|
219 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
|
220 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
221 |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
222 @Override |
22109
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
223 public Visualizer getVisualizer() { |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
224 throw new UnsupportedOperationException(); |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
225 } |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
226 |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
227 @Override |
b5eaddcdf86a
Calling Env.importSymbol from TruffleLanguage.createContext should be possible
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
228 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
|
229 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
|
230 } |
acd822f17ef5
Truffle/Instrumentation: clean up and repair some old unit tests
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
231 } |
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
|
232 |
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
|
233 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
|
234 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
|
235 } |
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
|
236 } |