Mercurial > hg > graal-jvmci-8
diff 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 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SimpleLanguage.java Thu Dec 12 14:56:52 2013 -0800 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SimpleLanguage.java Tue Dec 17 20:22:45 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,21 +35,41 @@ private static final Object[] NO_ARGUMENTS = new Object[0]; - public static void main(String[] args) throws IOException { - run(new FileInputStream(args[0]), System.out, 10, true); + public static void main(String[] args) { + run(args[0], System.out, 10, true); } - public static void run(InputStream input, PrintStream printOutput, int repeats, boolean log) { + public static void run(String name, String input, PrintStream printOutput, int repeats, boolean log) { if (log) { // CheckStyle: stop system..print check System.out.printf("== running on %s\n", Truffle.getRuntime().getName()); // CheckStyle: resume system..print check } - SLContext context = new SLContext(printOutput); + final SLContext context = new SLContext(printOutput); + final Source source = context.getSourceManager().get(name, input); + + run(context, source, printOutput, repeats, log); + } + + public static void run(String fileName, PrintStream printOutput, int repeats, boolean log) { + if (log) { + // CheckStyle: stop system..print check + System.out.printf("== running on %s\n", Truffle.getRuntime().getName()); + // CheckStyle: resume system..print check + } + + final SLContext context = new SLContext(printOutput); + final Source source = context.getSourceManager().get(fileName); + + run(context, source, printOutput, repeats, log); + } + + public static void run(SLContext context, Source source, PrintStream printOutput, int repeats, boolean log) { + SLScript script; try { - script = SLScript.create(context, input); + script = SLScript.create(context, source); } catch (ScriptException e) { // TODO temporary hack throw new RuntimeException(e);