Mercurial > hg > truffle
diff graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java @ 21780:3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Wed, 03 Jun 2015 15:47:54 +0200 |
parents | 2e8c01def9a5 |
children |
line wrap: on
line diff
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java Mon Jun 08 13:20:02 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java Wed Jun 03 15:47:54 2015 +0200 @@ -197,7 +197,7 @@ private final Map<Class<? extends Architecture>, JVMCIBackend> backends = new HashMap<>(); - private final HotSpotVMEventListener vmEventListener; + private final Iterable<HotSpotVMEventListener> vmEventListeners; private HotSpotJVMCIRuntime() { CompilerToVM toVM = new CompilerToVMImpl(); @@ -220,12 +220,12 @@ hostBackend = registerBackend(factory.createJVMCIBackend(this, null)); } - HotSpotVMEventListener listener = Services.loadSingle(HotSpotVMEventListener.class, false); - if (listener == null) { - listener = new HotSpotVMEventListener() { - }; + Iterable<HotSpotVMEventListener> listeners = Services.load(HotSpotVMEventListener.class); + if (!listeners.iterator().hasNext()) { + listeners = Arrays.asList(new HotSpotVMEventListener() { + }); } - vmEventListener = listener; + vmEventListeners = listeners; } private JVMCIBackend registerBackend(JVMCIBackend backend) { @@ -299,7 +299,9 @@ */ @SuppressWarnings({"unused"}) private void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long jvmciEnv, int id) { - vmEventListener.compileMetaspaceMethod(metaspaceMethod, entryBCI, jvmciEnv, id); + for (HotSpotVMEventListener vmEventListener : vmEventListeners) { + vmEventListener.compileMetaspaceMethod(metaspaceMethod, entryBCI, jvmciEnv, id); + } } /** @@ -307,7 +309,9 @@ */ @SuppressWarnings({"unused"}) private void compileTheWorld() throws Throwable { - vmEventListener.notifyCompileTheWorld(); + for (HotSpotVMEventListener vmEventListener : vmEventListeners) { + vmEventListener.notifyCompileTheWorld(); + } } /** @@ -317,6 +321,8 @@ */ @SuppressWarnings({"unused"}) private void shutdown() throws Exception { - vmEventListener.notifyShutdown(); + for (HotSpotVMEventListener vmEventListener : vmEventListeners) { + vmEventListener.notifyShutdown(); + } } }