comparison truffle/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/processor/LanguageRegistrationTest.java @ 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.
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Thu, 30 Jul 2015 17:36:34 +0200
parents 9c8c0937da41
children 78c3d3d8d86e
comparison
equal deleted inserted replaced
22045:ffbc7f472438 22046:e7c2d36daf72
26 26
27 import com.oracle.truffle.api.*; 27 import com.oracle.truffle.api.*;
28 import com.oracle.truffle.api.debug.*; 28 import com.oracle.truffle.api.debug.*;
29 import com.oracle.truffle.api.dsl.test.*; 29 import com.oracle.truffle.api.dsl.test.*;
30 import com.oracle.truffle.api.instrument.*; 30 import com.oracle.truffle.api.instrument.*;
31 import com.oracle.truffle.api.nodes.Node;
31 import com.oracle.truffle.api.source.*; 32 import com.oracle.truffle.api.source.*;
32 33
33 public class LanguageRegistrationTest { 34 public class LanguageRegistrationTest {
34 35
35 @ExpectError("Registered language class must be public") 36 @ExpectError("Registered language class must be public")
53 private MyLangWrongConstr() { 54 private MyLangWrongConstr() {
54 super(null); 55 super(null);
55 } 56 }
56 57
57 @Override 58 @Override
58 protected Object eval(Source code) throws IOException { 59 protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException {
59 return null; 60 throw new IOException();
60 } 61 }
61 62
62 @Override 63 @Override
63 protected Object findExportedSymbol(String globalName, boolean onlyExplicit) { 64 protected Object findExportedSymbol(String globalName, boolean onlyExplicit) {
64 return null; 65 return null;
92 public MyLangNoConstr() { 93 public MyLangNoConstr() {
93 super(null); 94 super(null);
94 } 95 }
95 96
96 @Override 97 @Override
97 protected Object eval(Source code) throws IOException { 98 protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException {
98 return null; 99 throw new IOException();
99 } 100 }
100 101
101 @Override 102 @Override
102 protected Object findExportedSymbol(String globalName, boolean onlyExplicit) { 103 protected Object findExportedSymbol(String globalName, boolean onlyExplicit) {
103 return null; 104 return null;
130 public MyLangGood(TruffleLanguage.Env env) { 131 public MyLangGood(TruffleLanguage.Env env) {
131 super(env); 132 super(env);
132 } 133 }
133 134
134 @Override 135 @Override
135 protected Object eval(Source code) throws IOException {
136 return null;
137 }
138
139 @Override
140 protected Object findExportedSymbol(String globalName, boolean onlyExplicit) { 136 protected Object findExportedSymbol(String globalName, boolean onlyExplicit) {
141 return null; 137 return null;
142 } 138 }
143 139
144 @Override 140 @Override
159 @Override 155 @Override
160 protected DebugSupportProvider getDebugSupport() { 156 protected DebugSupportProvider getDebugSupport() {
161 return null; 157 return null;
162 } 158 }
163 159
160 @Override
161 protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException {
162 throw new IOException();
163 }
164
164 } 165 }
165 } 166 }