Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SimpleLanguage.java @ 13455:69d2e4baa215
Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Tue, 17 Dec 2013 20:22:45 -0800 |
parents | 71991b7a0f14 |
children |
comparison
equal
deleted
inserted
replaced
13306:dfb780080923 | 13455:69d2e4baa215 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2012, 2013, 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 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
33 | 33 |
34 public class SimpleLanguage { | 34 public class SimpleLanguage { |
35 | 35 |
36 private static final Object[] NO_ARGUMENTS = new Object[0]; | 36 private static final Object[] NO_ARGUMENTS = new Object[0]; |
37 | 37 |
38 public static void main(String[] args) throws IOException { | 38 public static void main(String[] args) { |
39 run(new FileInputStream(args[0]), System.out, 10, true); | 39 run(args[0], System.out, 10, true); |
40 } | 40 } |
41 | 41 |
42 public static void run(InputStream input, PrintStream printOutput, int repeats, boolean log) { | 42 public static void run(String name, String input, PrintStream printOutput, int repeats, boolean log) { |
43 if (log) { | 43 if (log) { |
44 // CheckStyle: stop system..print check | 44 // CheckStyle: stop system..print check |
45 System.out.printf("== running on %s\n", Truffle.getRuntime().getName()); | 45 System.out.printf("== running on %s\n", Truffle.getRuntime().getName()); |
46 // CheckStyle: resume system..print check | 46 // CheckStyle: resume system..print check |
47 } | 47 } |
48 | 48 |
49 SLContext context = new SLContext(printOutput); | 49 final SLContext context = new SLContext(printOutput); |
50 final Source source = context.getSourceManager().get(name, input); | |
51 | |
52 run(context, source, printOutput, repeats, log); | |
53 } | |
54 | |
55 public static void run(String fileName, PrintStream printOutput, int repeats, boolean log) { | |
56 if (log) { | |
57 // CheckStyle: stop system..print check | |
58 System.out.printf("== running on %s\n", Truffle.getRuntime().getName()); | |
59 // CheckStyle: resume system..print check | |
60 } | |
61 | |
62 final SLContext context = new SLContext(printOutput); | |
63 final Source source = context.getSourceManager().get(fileName); | |
64 | |
65 run(context, source, printOutput, repeats, log); | |
66 } | |
67 | |
68 public static void run(SLContext context, Source source, PrintStream printOutput, int repeats, boolean log) { | |
69 | |
50 SLScript script; | 70 SLScript script; |
51 try { | 71 try { |
52 script = SLScript.create(context, input); | 72 script = SLScript.create(context, source); |
53 } catch (ScriptException e) { | 73 } catch (ScriptException e) { |
54 // TODO temporary hack | 74 // TODO temporary hack |
55 throw new RuntimeException(e); | 75 throw new RuntimeException(e); |
56 } | 76 } |
57 | 77 |