Mercurial > hg > truffle
diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLMain.java @ 21573:ffdd2ec86f42
Truffle/Debugging: temporary patches so the DebugEngine will work (partially) with the new TruffleVM framework.
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Wed, 27 May 2015 20:52:21 -0700 |
parents | fc376e0b80ba |
children | a880844225e4 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLMain.java Wed May 27 20:49:09 2015 -0700 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLMain.java Wed May 27 20:52:21 2015 -0700 @@ -181,6 +181,17 @@ } } + public static void run(Source source) throws IOException { + TruffleVM vm = TruffleVM.newVM().build(); + assert vm.getLanguages().containsKey("application/x-sl"); + vm.eval(new File(source.getPath()).toURI()); + Symbol main = vm.findGlobalSymbol("main"); + if (main == null) { + throw new SLException("No function main() defined in SL source file."); + } + main.invoke(null); + } + /** * Parse and run the specified SL source. Factored out in a separate method so that it can also * be used by the unit test harness.