diff graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/jvmci/HotSpotProfilingInfo.java @ 21545:a04dfbf81bc4

removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Tue, 26 May 2015 00:31:30 +0200
parents graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java@082417ac43e4
children
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/jvmci/HotSpotProfilingInfo.java	Mon May 25 23:44:59 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/jvmci/HotSpotProfilingInfo.java	Tue May 26 00:31:30 2015 +0200
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
-import com.oracle.graal.nodes.*;
 
 public final class HotSpotProfilingInfo implements ProfilingInfo, HotSpotProxified {
 
@@ -205,19 +204,33 @@
         isMature = true;
     }
 
+    /**
+     * {@code MethodData::_jvmci_ir_size} (currently) supports at most one JVMCI compiler IR type
+     * which will be determined by the first JVMCI compiler that calls
+     * {@link #setCompilerIRSize(Class, int)}.
+     */
+    private static volatile Class<?> supportedCompilerIRType;
+
     @Override
     public boolean setCompilerIRSize(Class<?> irType, int size) {
-        if (irType == StructuredGraph.class) {
-            methodData.setCompiledGraphSize(size);
-            return true;
+        if (supportedCompilerIRType == null) {
+            synchronized (HotSpotProfilingInfo.class) {
+                if (supportedCompilerIRType == null) {
+                    supportedCompilerIRType = irType;
+                }
+            }
         }
-        return false;
+        if (supportedCompilerIRType != irType) {
+            return false;
+        }
+        methodData.setCompiledIRSize(size);
+        return true;
     }
 
     @Override
     public int getCompilerIRSize(Class<?> irType) {
-        if (irType == StructuredGraph.class) {
-            return methodData.getCompiledGraphSize();
+        if (irType == supportedCompilerIRType) {
+            return methodData.getCompiledIRSize();
         }
         return -1;
     }