Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.tck/src/com/oracle/truffle/tck/TckLanguage.java @ 22376:72545ac338eb
Adding also the TckLanguage class
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Mon, 16 Nov 2015 15:51:36 +0100 |
parents | |
children | 06bdf4a43126 |
comparison
equal
deleted
inserted
replaced
22375:78594d342228 | 22376:72545ac338eb |
---|---|
1 /* | |
2 * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. Oracle designates this | |
8 * particular file as subject to the "Classpath" exception as provided | |
9 * by Oracle in the LICENSE file that accompanied this code. | |
10 * | |
11 * This code is distributed in the hope that it will be useful, but WITHOUT | |
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 * version 2 for more details (a copy is included in the LICENSE file that | |
15 * accompanied this code). | |
16 * | |
17 * You should have received a copy of the GNU General Public License version | |
18 * 2 along with this work; if not, write to the Free Software Foundation, | |
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
20 * | |
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
22 * or visit www.oracle.com if you need additional information or have any | |
23 * questions. | |
24 */ | |
25 package com.oracle.truffle.tck; | |
26 | |
27 import com.oracle.truffle.api.CallTarget; | |
28 import com.oracle.truffle.api.Truffle; | |
29 import com.oracle.truffle.api.TruffleLanguage; | |
30 import com.oracle.truffle.api.TruffleLanguage.Env; | |
31 import com.oracle.truffle.api.frame.MaterializedFrame; | |
32 import com.oracle.truffle.api.instrument.Visualizer; | |
33 import com.oracle.truffle.api.instrument.WrapperNode; | |
34 import com.oracle.truffle.api.nodes.Node; | |
35 import com.oracle.truffle.api.nodes.RootNode; | |
36 import com.oracle.truffle.api.source.Source; | |
37 import java.io.IOException; | |
38 | |
39 @TruffleLanguage.Registration(mimeType = "x-application/tck", name = "TCK", version = "1.0") | |
40 public final class TckLanguage extends TruffleLanguage<Env> { | |
41 public static final TckLanguage INSTANCE = new TckLanguage(); | |
42 | |
43 @Override | |
44 protected Env createContext(Env env) { | |
45 return env; | |
46 } | |
47 | |
48 @Override | |
49 protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException { | |
50 final double value = Double.parseDouble(code.getCode()); | |
51 return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(value)); | |
52 } | |
53 | |
54 @Override | |
55 protected Object findExportedSymbol(Env context, String globalName, boolean onlyExplicit) { | |
56 return null; | |
57 } | |
58 | |
59 @Override | |
60 protected Object getLanguageGlobal(Env context) { | |
61 return null; | |
62 } | |
63 | |
64 @Override | |
65 protected boolean isObjectOfLanguage(Object object) { | |
66 return false; | |
67 } | |
68 | |
69 @Override | |
70 protected Visualizer getVisualizer() { | |
71 return null; | |
72 } | |
73 | |
74 @Override | |
75 protected boolean isInstrumentable(Node node) { | |
76 return false; | |
77 } | |
78 | |
79 @Override | |
80 protected WrapperNode createWrapperNode(Node node) { | |
81 throw new UnsupportedOperationException(); | |
82 } | |
83 | |
84 @Override | |
85 protected Object evalInContext(Source source, Node node, MaterializedFrame mFrame) throws IOException { | |
86 throw new IOException(); | |
87 } | |
88 } |