diff graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java @ 21616:4c146c9367b6

recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Sun, 31 May 2015 23:57:31 +0200
parents 93f282187d90
children 2e8c01def9a5
line wrap: on
line diff
--- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java	Sun May 31 14:30:13 2015 +0200
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java	Sun May 31 23:57:31 2015 +0200
@@ -197,6 +197,8 @@
 
     private final Map<Class<? extends Architecture>, JVMCIBackend> backends = new HashMap<>();
 
+    private final HotSpotVMEventListener vmEventListener;
+
     private HotSpotJVMCIRuntime() {
         CompilerToVM toVM = new CompilerToVMImpl();
         compilerToVm = toVM;
@@ -217,6 +219,8 @@
         try (InitTimer t = timer("create JVMCI backend:", hostArchitecture)) {
             hostBackend = registerBackend(factory.createJVMCIBackend(this, null));
         }
+
+        vmEventListener = Services.loadSingle(HotSpotVMEventListener.class, true);
     }
 
     private JVMCIBackend registerBackend(JVMCIBackend backend) {
@@ -288,11 +292,17 @@
     /**
      * Called from the VM.
      */
-    @SuppressWarnings({"unused", "static-method"})
+    @SuppressWarnings({"unused"})
+    private void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long jvmciEnv, int id) {
+        vmEventListener.compileMetaspaceMethod(metaspaceMethod, entryBCI, jvmciEnv, id);
+    }
+
+    /**
+     * Called from the VM.
+     */
+    @SuppressWarnings({"unused"})
     private void compileTheWorld() throws Throwable {
-        for (HotSpotVMEventListener l : Services.load(HotSpotVMEventListener.class)) {
-            l.notifyCompileTheWorld();
-        }
+        vmEventListener.notifyCompileTheWorld();
     }
 
     /**
@@ -300,10 +310,8 @@
      *
      * Called from the VM.
      */
-    @SuppressWarnings({"unused", "static-method"})
+    @SuppressWarnings({"unused"})
     private void shutdown() throws Exception {
-        for (HotSpotVMEventListener l : Services.load(HotSpotVMEventListener.class)) {
-            l.notifyShutdown();
-        }
+        vmEventListener.notifyShutdown();
     }
 }