Mercurial > hg > graal-jvmci-8
changeset 22656:d634e615b00d
Lazily initialize compiler on first compilation request.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Fri, 02 Oct 2015 16:49:50 +0200 |
parents | 8ed4037e8286 |
children | 9203f93ffeb0 |
files | jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime.java |
diffstat | 1 files changed, 7 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime.java Fri Oct 02 08:16:04 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime.java Fri Oct 02 16:49:50 2015 +0200 @@ -90,10 +90,6 @@ try (InitTimer t = timer("HotSpotJVMCIRuntime.<init>")) { instance = new HotSpotJVMCIRuntime(); } - - try (InitTimer t = timer("HotSpotJVMCIRuntime.completeInitialization")) { - instance.completeInitialization(); - } } } } @@ -105,14 +101,6 @@ return DelayedInit.instance; } - /** - * Do deferred initialization. - */ - public void completeInitialization() { - compiler = HotSpotJVMCICompilerConfig.getCompilerFactory().createCompiler(this); - trivialPrefixes = HotSpotJVMCICompilerConfig.getCompilerFactory().getTrivialPrefixes(); - } - public static HotSpotJVMCIBackendFactory findFactory(String architecture) { for (HotSpotJVMCIBackendFactory factory : Services.load(HotSpotJVMCIBackendFactory.class)) { if (factory.getArchitecture().equalsIgnoreCase(architecture)) { @@ -142,7 +130,7 @@ private final Iterable<HotSpotVMEventListener> vmEventListeners; - @SuppressWarnings("unused") private String[] trivialPrefixes; + @SuppressWarnings("unused") private final String[] trivialPrefixes; @SuppressWarnings("try") private HotSpotJVMCIRuntime() { @@ -180,6 +168,8 @@ if (Boolean.valueOf(System.getProperty("jvmci.printconfig"))) { printConfig(config, compilerToVm); } + + trivialPrefixes = HotSpotJVMCICompilerConfig.getCompilerFactory().getTrivialPrefixes(); } private JVMCIBackend registerBackend(JVMCIBackend backend) { @@ -206,6 +196,9 @@ } public Compiler getCompiler() { + if (compiler == null) { + compiler = HotSpotJVMCICompilerConfig.getCompilerFactory().createCompiler(this); + } return compiler; } @@ -246,7 +239,7 @@ */ @SuppressWarnings({"unused"}) private void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) { - compiler.compileMethod(new HotSpotCompilationRequest(method, entryBCI, jvmciEnv, id)); + getCompiler().compileMethod(new HotSpotCompilationRequest(method, entryBCI, jvmciEnv, id)); } /**