Mercurial > hg > graal-compiler
changeset 22761:f46cada70621
Don't initialize Graal runtime on shutdown if no compilations happened.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 06 Oct 2015 15:52:06 +0200 |
parents | 82f29fdcb1ce |
children | 8523434db559 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompilerFactory.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java |
diffstat | 2 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompilerFactory.java Tue Oct 06 15:16:00 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompilerFactory.java Tue Oct 06 15:52:06 2015 +0200 @@ -56,6 +56,7 @@ HotSpotJVMCIRuntime jvmciRuntime = (HotSpotJVMCIRuntime) runtime; try (InitTimer t = timer("HotSpotGraalRuntime.<init>")) { HotSpotGraalRuntime graalRuntime = new HotSpotGraalRuntime(jvmciRuntime, this); + HotSpotGraalVMEventListener.addRuntime(graalRuntime); return new HotSpotGraalCompiler(jvmciRuntime, graalRuntime); } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java Tue Oct 06 15:16:00 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java Tue Oct 06 15:52:06 2015 +0200 @@ -22,10 +22,11 @@ */ package com.oracle.graal.hotspot; +import java.util.ArrayList; + import jdk.internal.jvmci.code.CompilationResult; import jdk.internal.jvmci.code.InstalledCode; import jdk.internal.jvmci.hotspot.HotSpotCodeCacheProvider; -import jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime; import jdk.internal.jvmci.hotspot.HotSpotVMEventListener; import jdk.internal.jvmci.service.ServiceProvider; @@ -34,11 +35,17 @@ @ServiceProvider(HotSpotVMEventListener.class) public class HotSpotGraalVMEventListener implements HotSpotVMEventListener { + private static final ArrayList<HotSpotGraalRuntime> runtimes = new ArrayList<>(); + + static void addRuntime(HotSpotGraalRuntime runtime) { + runtimes.add(runtime); + } + @Override public void notifyShutdown() { - HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) HotSpotJVMCIRuntime.runtime().getCompiler(); - HotSpotGraalRuntime graalRuntime = (HotSpotGraalRuntime) compiler.getGraalRuntime(); - graalRuntime.shutdown(); + for (HotSpotGraalRuntime runtime : runtimes) { + runtime.shutdown(); + } } @Override