Mercurial > hg > truffle
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/Truffle.java @ 15603:b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 May 2014 23:27:07 +0200 |
parents | 51b2999299bc |
children | e52ad0d3b7d6 |
comparison
equal
deleted
inserted
replaced
15602:c73df62cbaee | 15603:b7fb36e57da8 |
---|---|
31 */ | 31 */ |
32 public class Truffle { | 32 public class Truffle { |
33 | 33 |
34 private static final TruffleRuntime RUNTIME; | 34 private static final TruffleRuntime RUNTIME; |
35 | 35 |
36 private static native TruffleRuntime initializeRuntime(); | 36 /** |
37 * Creates a new {@link TruffleRuntime} instance if the runtime has a specialized | |
38 * implementation. | |
39 * | |
40 * @throws UnsatisfiedLinkError if the runtime does not have a specialized implementation of | |
41 * {@link TruffleRuntime} | |
42 */ | |
43 private static native TruffleRuntime createRuntime(); | |
37 | 44 |
38 public static TruffleRuntime getRuntime() { | 45 public static TruffleRuntime getRuntime() { |
39 return RUNTIME; | 46 return RUNTIME; |
40 } | 47 } |
41 | 48 |
42 static { | 49 static { |
43 TruffleRuntime runtime; | 50 TruffleRuntime runtime; |
44 try { | 51 try { |
45 runtime = initializeRuntime(); | 52 runtime = createRuntime(); |
46 } catch (UnsatisfiedLinkError e) { | 53 } catch (UnsatisfiedLinkError e) { |
47 runtime = new DefaultTruffleRuntime(); | 54 runtime = new DefaultTruffleRuntime(); |
48 } | 55 } |
49 RUNTIME = runtime; | 56 RUNTIME = runtime; |
50 } | 57 } |