Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ImplicitExplicitExportTest.java @ 22226:c896a8e70777
Truffle/Instrumentation:
Redesign instrumentation node classes to reduce the public API exposure.
- ProbeNode is no longer public
- Public interface InstrumentationNode.TruffleEvents is now abstract class EventHandlerNode with package private constructor
- Interface ProbeNode.WrapperNode is no longer inside ProbeNode and has been expanded slightly so ProbeNode can be package private
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Sun, 20 Sep 2015 15:51:39 -0700 |
parents | 20380d1d41f2 |
children | 3c73d029b651 |
rev | line source |
---|---|
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
1 /* |
21948
f0fe6f0cbccc
Chris pointed out the copyright should reflect the year of file's creation.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21890
diff
changeset
|
2 * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
4 * |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
8 * |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
14 * |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
18 * |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
21 * questions. |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
22 */ |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.api.test.vm; |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@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:
22121
diff
changeset
|
25 import static org.junit.Assert.assertEquals; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
26 import static org.junit.Assert.assertNotEquals; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
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:
22121
diff
changeset
|
28 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
29 import java.io.IOException; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
30 import java.io.Reader; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
31 import java.util.Enumeration; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
32 import java.util.HashMap; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
33 import java.util.Map; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
34 import java.util.Properties; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
35 import java.util.concurrent.Executors; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
36 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
37 import org.junit.After; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
38 import org.junit.Before; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
39 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:
22121
diff
changeset
|
40 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
41 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:
22121
diff
changeset
|
42 import com.oracle.truffle.api.RootCallTarget; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
43 import com.oracle.truffle.api.TruffleLanguage; |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
44 import com.oracle.truffle.api.TruffleLanguage.Env; |
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:
22121
diff
changeset
|
45 import com.oracle.truffle.api.debug.DebugSupportProvider; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
46 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:
22121
diff
changeset
|
47 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:
22121
diff
changeset
|
48 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:
22121
diff
changeset
|
49 import com.oracle.truffle.api.instrument.AdvancedInstrumentRootFactory; |
22226
c896a8e70777
Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22220
diff
changeset
|
50 import com.oracle.truffle.api.instrument.WrapperNode; |
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:
22121
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:
22121
diff
changeset
|
52 import com.oracle.truffle.api.instrument.Visualizer; |
22046
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
53 import com.oracle.truffle.api.nodes.Node; |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
54 import com.oracle.truffle.api.nodes.RootNode; |
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:
22121
diff
changeset
|
55 import com.oracle.truffle.api.source.Source; |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
56 import com.oracle.truffle.api.vm.TruffleVM; |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
57 |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
58 public class ImplicitExplicitExportTest { |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
59 private static Thread mainThread; |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
60 private TruffleVM vm; |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
61 |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
62 @Before |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
63 public void initializeVM() { |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
64 mainThread = Thread.currentThread(); |
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
65 vm = TruffleVM.newVM().executor(Executors.newSingleThreadExecutor()).build(); |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
66 assertTrue("Found " + L1 + " language", vm.getLanguages().containsKey(L1)); |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
67 assertTrue("Found " + L2 + " language", vm.getLanguages().containsKey(L2)); |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
68 assertTrue("Found " + L3 + " language", vm.getLanguages().containsKey(L3)); |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
69 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
70 |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
71 @After |
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
72 public void cleanThread() { |
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
73 mainThread = null; |
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
74 } |
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
75 |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
76 @Test |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
77 public void explicitExportFound() throws IOException { |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
78 // @formatter:off |
22104
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
79 vm.eval(Source.fromText("explicit.ahoj=42", "Fourty two").withMimeType(L1)); |
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
80 Object ret = vm.eval( |
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
81 Source.fromText("return=ahoj", "Return").withMimeType(L3) |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
82 ).get(); |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
83 // @formatter:on |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
84 assertEquals("42", ret); |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
85 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
86 |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
87 @Test |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
88 public void implicitExportFound() throws IOException { |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
89 // @formatter:off |
22104
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
90 vm.eval( |
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
91 Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L1) |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
92 ); |
22104
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
93 Object ret = vm.eval( |
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
94 Source.fromText("return=ahoj", "Return").withMimeType(L3) |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
95 ).get(); |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
96 // @formatter:on |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
97 assertEquals("42", ret); |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
98 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
99 |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
100 @Test |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
101 public void explicitExportPreferred2() throws IOException { |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
102 // @formatter:off |
22104
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
103 vm.eval( |
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
104 Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L1) |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
105 ); |
22104
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
106 vm.eval( |
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
107 Source.fromText("explicit.ahoj=43", "Fourty three").withMimeType(L2) |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
108 ); |
22104
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
109 Object ret = vm.eval( |
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
110 Source.fromText("return=ahoj", "Return").withMimeType(L3) |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
111 ).get(); |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
112 // @formatter:on |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
113 assertEquals("Explicit import from L2 is used", "43", ret); |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
114 assertEquals("Global symbol is also 43", "43", vm.findGlobalSymbol("ahoj").get()); |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
115 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
116 |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
117 @Test |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
118 public void explicitExportPreferred1() throws IOException { |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
119 // @formatter:off |
22104
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
120 vm.eval( |
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
121 Source.fromText("explicit.ahoj=43", "Fourty three").withMimeType(L1) |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
122 ); |
22104
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
123 vm.eval( |
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
124 Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L2) |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
125 ); |
22104
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
126 Object ret = vm.eval( |
cf19259edf87
TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22096
diff
changeset
|
127 Source.fromText("return=ahoj", "Return").withMimeType(L3) |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
128 ).get(); |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
129 // @formatter:on |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
130 assertEquals("Explicit import from L2 is used", "43", ret); |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
131 assertEquals("Global symbol is also 43", "43", vm.findGlobalSymbol("ahoj").invoke(null).get()); |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
132 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
133 |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
134 private static final class Ctx { |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
135 final Map<String, String> explicit = new HashMap<>(); |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
136 final Map<String, String> implicit = new HashMap<>(); |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
137 final Env env; |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
138 |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
139 public Ctx(Env env) { |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
140 this.env = env; |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
141 } |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
142 } |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
143 |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
144 private abstract static class AbstractExportImportLanguage extends TruffleLanguage<Ctx> { |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
145 |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
146 @Override |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
147 protected Ctx createContext(Env env) { |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
148 if (mainThread != null) { |
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
149 assertNotEquals("Should run asynchronously", Thread.currentThread(), mainThread); |
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
150 } |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
151 return new Ctx(env); |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
152 } |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
153 |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
154 @Override |
22046
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
155 protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException { |
22081
ff531952a91c
Making sure IOException from TruffleLanguage.parse method is correctly propagated to TruffleVM.eval caller.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22070
diff
changeset
|
156 if (code.getCode().startsWith("parse=")) { |
ff531952a91c
Making sure IOException from TruffleLanguage.parse method is correctly propagated to TruffleVM.eval caller.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22070
diff
changeset
|
157 throw new IOException(code.getCode().substring(6)); |
ff531952a91c
Making sure IOException from TruffleLanguage.parse method is correctly propagated to TruffleVM.eval caller.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22070
diff
changeset
|
158 } |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
159 return new ValueCallTarget(code, this); |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
160 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
161 |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
162 @Override |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
163 protected Object findExportedSymbol(Ctx context, String globalName, boolean onlyExplicit) { |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
164 if (context.explicit.containsKey(globalName)) { |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
165 return context.explicit.get(globalName); |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
166 } |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
167 if (!onlyExplicit && context.implicit.containsKey(globalName)) { |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
168 return context.implicit.get(globalName); |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
169 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
170 return null; |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
171 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
172 |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
173 @Override |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
174 protected Object getLanguageGlobal(Ctx context) { |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
175 return null; |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
176 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
177 |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
178 @Override |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
179 protected boolean isObjectOfLanguage(Object object) { |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
180 return false; |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
181 } |
21890
894f82515e38
Truffle/APIs and Debugging: Evolutionary steps to integrating debugging and tool support with TruffleVM APIs
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21889
diff
changeset
|
182 |
894f82515e38
Truffle/APIs and Debugging: Evolutionary steps to integrating debugging and tool support with TruffleVM APIs
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21889
diff
changeset
|
183 @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:
22121
diff
changeset
|
184 protected Visualizer getVisualizer() { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
185 return 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:
22121
diff
changeset
|
186 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
187 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
188 @Override |
22220
20380d1d41f2
Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22219
diff
changeset
|
189 protected boolean isInstrumentable(Node node) { |
20380d1d41f2
Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22219
diff
changeset
|
190 return false; |
20380d1d41f2
Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22219
diff
changeset
|
191 } |
20380d1d41f2
Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22219
diff
changeset
|
192 |
20380d1d41f2
Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22219
diff
changeset
|
193 @Override |
20380d1d41f2
Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22219
diff
changeset
|
194 protected WrapperNode createWrapperNode(Node node) { |
20380d1d41f2
Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22219
diff
changeset
|
195 return null; |
20380d1d41f2
Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22219
diff
changeset
|
196 } |
20380d1d41f2
Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22219
diff
changeset
|
197 |
20380d1d41f2
Truffle/Instrumentation: second merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22219
diff
changeset
|
198 @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
|
199 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
|
200 return null; |
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:
22121
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:
22121
diff
changeset
|
202 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
203 @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:
22121
diff
changeset
|
204 protected Object evalInContext(Source source, Node node, MaterializedFrame mFrame) throws IOException { |
21890
894f82515e38
Truffle/APIs and Debugging: Evolutionary steps to integrating debugging and tool support with TruffleVM APIs
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21889
diff
changeset
|
205 return null; |
894f82515e38
Truffle/APIs and Debugging: Evolutionary steps to integrating debugging and tool support with TruffleVM APIs
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21889
diff
changeset
|
206 } |
894f82515e38
Truffle/APIs and Debugging: Evolutionary steps to integrating debugging and tool support with TruffleVM APIs
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21889
diff
changeset
|
207 |
894f82515e38
Truffle/APIs and Debugging: Evolutionary steps to integrating debugging and tool support with TruffleVM APIs
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21889
diff
changeset
|
208 @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:
22121
diff
changeset
|
209 protected AdvancedInstrumentRootFactory createAdvancedInstrumentRootFactory(String expr, AdvancedInstrumentResultListener resultListener) throws IOException { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
210 return 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:
22121
diff
changeset
|
211 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
212 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
213 @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:
22121
diff
changeset
|
214 @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:
22121
diff
changeset
|
215 protected ToolSupportProvider getToolSupport() { |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
216 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:
22121
diff
changeset
|
217 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
218 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
219 @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:
22121
diff
changeset
|
220 @Override |
21890
894f82515e38
Truffle/APIs and Debugging: Evolutionary steps to integrating debugging and tool support with TruffleVM APIs
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21889
diff
changeset
|
221 protected DebugSupportProvider getDebugSupport() { |
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:
22121
diff
changeset
|
222 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:
22121
diff
changeset
|
223 } |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
224 |
3aad794eec0e
Truffle/Instrumentation: first large merge of instrumentation code into the TruffleVM framework
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
22121
diff
changeset
|
225 @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:
22121
diff
changeset
|
226 @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:
22121
diff
changeset
|
227 protected void enableASTProbing(ASTProber 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:
22121
diff
changeset
|
228 throw new UnsupportedOperationException(); |
21890
894f82515e38
Truffle/APIs and Debugging: Evolutionary steps to integrating debugging and tool support with TruffleVM APIs
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21889
diff
changeset
|
229 } |
22046
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
230 |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
231 private Object importExport(Source code) { |
22121
d045a505c2b3
Asynchronous TruffleVM can be created by providing own Executor when configuring the TruffleVM.Builder
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22104
diff
changeset
|
232 assertNotEquals("Should run asynchronously", Thread.currentThread(), mainThread); |
22068
fec8f8a61f6c
Introducing FindContextNode
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22066
diff
changeset
|
233 final Node node = createFindContextNode(); |
22070
a7ca9e9a1d51
Removing VirtualFrame parameter. Documenting.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22068
diff
changeset
|
234 Ctx ctx = findContext(node); |
22046
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
235 Properties p = new Properties(); |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
236 try (Reader r = code.getReader()) { |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
237 p.load(r); |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
238 } catch (IOException ex) { |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
239 throw new IllegalStateException(ex); |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
240 } |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
241 Enumeration<Object> en = p.keys(); |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
242 while (en.hasMoreElements()) { |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
243 Object n = en.nextElement(); |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
244 if (n instanceof String) { |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
245 String k = (String) n; |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
246 if (k.startsWith("explicit.")) { |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
247 ctx.explicit.put(k.substring(9), p.getProperty(k)); |
22046
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
248 } |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
249 if (k.startsWith("implicit.")) { |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
250 ctx.implicit.put(k.substring(9), p.getProperty(k)); |
22046
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
251 } |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
252 if (k.equals("return")) { |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
253 return ctx.env.importSymbol(p.getProperty(k)); |
22046
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
254 } |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
255 } |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
256 } |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
257 return null; |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
258 } |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
259 } |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
260 |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
261 private static final class ValueCallTarget implements RootCallTarget { |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
262 private final Source code; |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
263 private final AbstractExportImportLanguage language; |
22046
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
264 |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
265 private ValueCallTarget(Source code, AbstractExportImportLanguage language) { |
22046
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
266 this.code = code; |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
267 this.language = language; |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
268 } |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
269 |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
270 @Override |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
271 public RootNode getRootNode() { |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
272 throw new UnsupportedOperationException(); |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
273 } |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
274 |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
275 @Override |
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
276 public Object call(Object... arguments) { |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
277 return language.importExport(code); |
22046
e7c2d36daf72
TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22012
diff
changeset
|
278 } |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
279 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
280 |
22012
09531c471176
Making sure the accessor can really find the TruffleLanguage instance by its class
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
281 static final String L1 = "application/x-test-import-export-1"; |
22095
643d53cb3147
TruffleVM.Builder.globalSymbol for a way to pass initial configuration parameters to languages
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22070
diff
changeset
|
282 static final String L2 = "application/x-test-import-export-2"; |
643d53cb3147
TruffleVM.Builder.globalSymbol for a way to pass initial configuration parameters to languages
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22070
diff
changeset
|
283 static final String L3 = "application/x-test-import-export-3"; |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
284 |
21889
45083be8a812
Truffle: add a version string to the information provided with Language registration
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21716
diff
changeset
|
285 @TruffleLanguage.Registration(mimeType = L1, name = "ImportExport1", version = "0") |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
286 public static final class ExportImportLanguage1 extends AbstractExportImportLanguage { |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
287 public static final AbstractExportImportLanguage INSTANCE = new ExportImportLanguage1(); |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
288 |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
289 public ExportImportLanguage1() { |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
290 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
291 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
292 |
21889
45083be8a812
Truffle: add a version string to the information provided with Language registration
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21716
diff
changeset
|
293 @TruffleLanguage.Registration(mimeType = L2, name = "ImportExport2", version = "0") |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
294 public static final class ExportImportLanguage2 extends AbstractExportImportLanguage { |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
295 public static final AbstractExportImportLanguage INSTANCE = new ExportImportLanguage2(); |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
296 |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
297 public ExportImportLanguage2() { |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
298 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
299 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
300 |
21889
45083be8a812
Truffle: add a version string to the information provided with Language registration
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21716
diff
changeset
|
301 @TruffleLanguage.Registration(mimeType = L3, name = "ImportExport3", version = "0") |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
302 public static final class ExportImportLanguage3 extends AbstractExportImportLanguage { |
22066
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
303 public static final AbstractExportImportLanguage INSTANCE = new ExportImportLanguage3(); |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
304 |
78c3d3d8d86e
Clearly separating the TruffleLanguage definition from context used during its execution. TruffleLanguage now has to have public static field INSTANCE and override createContext method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22046
diff
changeset
|
305 private ExportImportLanguage3() { |
21716
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
306 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
307 } |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
308 |
2f9e4d984d16
Give languages a chance to do implicit exports. Prefer explicit exports over implicit ones.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
309 } |