# HG changeset patch # User Roland Schatz # Date 1443797390 -7200 # Node ID d634e615b00da9c6a7553654cec3029a1fa2c872 # Parent 8ed4037e828628c8a957ed1ec9cdfdd694c64d91 Lazily initialize compiler on first compilation request. diff -r 8ed4037e8286 -r d634e615b00d jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime.java --- 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.")) { 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 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)); } /**