Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLLanguage.java @ 22047:227ed03852de
Findbugs complains about the LAST static variable assignment. Remove, as it is not used anyway.
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Thu, 30 Jul 2015 17:52:43 +0200 |
parents | e7c2d36daf72 |
children | 8519aaa39caf |
comparison
equal
deleted
inserted
replaced
22046:e7c2d36daf72 | 22047:227ed03852de |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * The Universal Permissive License (UPL), Version 1.0 | 5 * The Universal Permissive License (UPL), Version 1.0 |
6 * | 6 * |
7 * Subject to the condition set forth below, permission is hereby granted to any | 7 * Subject to the condition set forth below, permission is hereby granted to any |
8 * person obtaining a copy of this software, associated documentation and/or | 8 * person obtaining a copy of this software, associated documentation and/or |
9 * data (collectively the "Software"), free of charge and under any and all | 9 * data (collectively the "Software"), free of charge and under any and all |
10 * copyright rights in the Software, and any and all patent rights owned or | 10 * copyright rights in the Software, and any and all patent rights owned or |
11 * freely licensable by each licensor hereunder covering either (i) the | 11 * freely licensable by each licensor hereunder covering either (i) the |
12 * unmodified Software as contributed to or provided by such licensor, or (ii) | 12 * unmodified Software as contributed to or provided by such licensor, or (ii) |
13 * the Larger Works (as defined below), to deal in both | 13 * the Larger Works (as defined below), to deal in both |
14 * | 14 * |
15 * (a) the Software, and | 15 * (a) the Software, and |
16 * | 16 * |
17 * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if | 17 * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if |
18 * one is included with the Software each a "Larger Work" to which the Software | 18 * one is included with the Software each a "Larger Work" to which the Software |
19 * is contributed by such licensors), | 19 * is contributed by such licensors), |
20 * | 20 * |
21 * without restriction, including without limitation the rights to copy, create | 21 * without restriction, including without limitation the rights to copy, create |
22 * derivative works of, display, perform, and distribute the Software and make, | 22 * derivative works of, display, perform, and distribute the Software and make, |
23 * use, sell, offer for sale, import, export, have made, and have sold the | 23 * use, sell, offer for sale, import, export, have made, and have sold the |
24 * Software and the Larger Work(s), and to sublicense the foregoing rights on | 24 * Software and the Larger Work(s), and to sublicense the foregoing rights on |
25 * either these or other terms. | 25 * either these or other terms. |
26 * | 26 * |
27 * This license is subject to the following condition: | 27 * This license is subject to the following condition: |
28 * | 28 * |
29 * The above copyright notice and either this complete permission notice or at a | 29 * The above copyright notice and either this complete permission notice or at a |
30 * minimum a reference to the UPL must be included in all copies or substantial | 30 * minimum a reference to the UPL must be included in all copies or substantial |
31 * portions of the Software. | 31 * portions of the Software. |
32 * | 32 * |
33 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 33 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
34 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 34 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
35 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 35 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
36 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 36 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
37 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 37 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
152 * <em>default printer</em>. | 152 * <em>default printer</em>. |
153 * | 153 * |
154 */ | 154 */ |
155 @TruffleLanguage.Registration(name = "SL", version = "0.5", mimeType = "application/x-sl") | 155 @TruffleLanguage.Registration(name = "SL", version = "0.5", mimeType = "application/x-sl") |
156 public class SLLanguage extends TruffleLanguage { | 156 public class SLLanguage extends TruffleLanguage { |
157 private static SLLanguage LAST; | |
158 private static List<NodeFactory<? extends SLBuiltinNode>> builtins = Collections.emptyList(); | 157 private static List<NodeFactory<? extends SLBuiltinNode>> builtins = Collections.emptyList(); |
159 private static Visualizer visualizer = new SLDefaultVisualizer(); | 158 private static Visualizer visualizer = new SLDefaultVisualizer(); |
160 private static ASTProber registeredASTProber; // non-null if prober already registered | 159 private static ASTProber registeredASTProber; // non-null if prober already registered |
161 private final SLContext context; | 160 private final SLContext context; |
162 private DebugSupportProvider debugSupport; | 161 private DebugSupportProvider debugSupport; |
163 | 162 |
164 public SLLanguage(Env env) { | 163 public SLLanguage(Env env) { |
165 super(env); | 164 super(env); |
166 context = new SLContext(this, new BufferedReader(env().stdIn()), new PrintWriter(env().stdOut(), true)); | 165 context = new SLContext(this, new BufferedReader(env().stdIn()), new PrintWriter(env().stdOut(), true)); |
167 LAST = this; | |
168 for (NodeFactory<? extends SLBuiltinNode> builtin : builtins) { | 166 for (NodeFactory<? extends SLBuiltinNode> builtin : builtins) { |
169 context.installBuiltin(builtin, true); | 167 context.installBuiltin(builtin, true); |
170 } | 168 } |
171 } | 169 } |
172 | 170 |
255 /* Change to true if you want to see source attribution for the AST to the console */ | 253 /* Change to true if you want to see source attribution for the AST to the console */ |
256 boolean printSourceAttributionToLog = false; | 254 boolean printSourceAttributionToLog = false; |
257 /* Change to dump the AST to IGV over the network. */ | 255 /* Change to dump the AST to IGV over the network. */ |
258 boolean dumpASTToIGV = false; | 256 boolean dumpASTToIGV = false; |
259 | 257 |
260 printScript("before execution", LAST.context, logOutput, printASTToLog, printSourceAttributionToLog, dumpASTToIGV); | 258 printScript("before execution", null, logOutput, printASTToLog, printSourceAttributionToLog, dumpASTToIGV); |
261 long totalRuntime = 0; | 259 long totalRuntime = 0; |
262 try { | 260 try { |
263 for (int i = 0; i < repeats; i++) { | 261 for (int i = 0; i < repeats; i++) { |
264 long start = System.nanoTime(); | 262 long start = System.nanoTime(); |
265 /* Call the main entry point, without any arguments. */ | 263 /* Call the main entry point, without any arguments. */ |
280 logOutput.println("== iteration " + (i + 1) + ": " + ((end - start) / 1000000) + " ms"); | 278 logOutput.println("== iteration " + (i + 1) + ": " + ((end - start) / 1000000) + " ms"); |
281 } | 279 } |
282 } | 280 } |
283 | 281 |
284 } finally { | 282 } finally { |
285 printScript("after execution", LAST.context, logOutput, printASTToLog, printSourceAttributionToLog, dumpASTToIGV); | 283 printScript("after execution", null, logOutput, printASTToLog, printSourceAttributionToLog, dumpASTToIGV); |
286 } | 284 } |
287 return totalRuntime; | 285 return totalRuntime; |
288 } | 286 } |
289 | 287 |
290 /** | 288 /** |