changeset 21064:28117ede7606

fixed ImmutableCode related regression
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Apr 2015 10:32:52 +0200
parents ae5710f20011
children 986f1c0d6f55
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java	Tue Apr 21 09:51:03 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java	Tue Apr 21 10:32:52 2015 +0200
@@ -39,6 +39,7 @@
 import com.oracle.graal.hotspot.replacements.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
+import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.replacements.StandardGraphBuilderPlugins.BoxPlugin;
 import com.oracle.graal.replacements.nodes.*;
 
@@ -149,12 +150,21 @@
             for (Node node : newNodes) {
                 if (node.hasUsages() && node instanceof ConstantNode) {
                     ConstantNode c = (ConstantNode) node;
-                    if (c.getKind() == Kind.Object && !AheadOfTimeVerificationPhase.isLegalObjectConstant(c)) {
-                        throw new AssertionError("illegal constant node in AOT: " + node);
+                    if (c.getKind() == Kind.Object && AheadOfTimeVerificationPhase.isIllegalObjectConstant(c)) {
+                        if (isClass(c)) {
+                            // This will be handled later by LoadJavaMirrorWithKlassPhase
+                        } else {
+                            throw new AssertionError("illegal constant node in AOT: " + node);
+                        }
                     }
                 }
             }
         }
         super.checkNewNodes(b, plugin, newNodes);
     }
+
+    private static boolean isClass(ConstantNode node) {
+        ResolvedJavaType typeOrNull = StampTool.typeOrNull(node);
+        return typeOrNull != null && "Ljava/lang/Class;".equals(typeOrNull.getName());
+    }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java	Tue Apr 21 09:51:03 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java	Tue Apr 21 10:32:52 2015 +0200
@@ -32,7 +32,7 @@
 import com.oracle.graal.phases.tiers.*;
 
 /**
- * Checks for {@link #isLegalObjectConstant(ConstantNode) illegal} object constants in a graph
+ * Checks for {@link #isIllegalObjectConstant(ConstantNode) illegal} object constants in a graph
  * processed for AOT compilation.
  *
  * @see LoadJavaMirrorWithKlassPhase
@@ -42,14 +42,14 @@
     @Override
     protected boolean verify(StructuredGraph graph, PhaseContext context) {
         for (ConstantNode node : getConstantNodes(graph)) {
-            if (isLegalObjectConstant(node)) {
+            if (isIllegalObjectConstant(node)) {
                 throw new VerificationError("illegal object constant: " + node);
             }
         }
         return true;
     }
 
-    public static boolean isLegalObjectConstant(ConstantNode node) {
+    public static boolean isIllegalObjectConstant(ConstantNode node) {
         return isObject(node) && !isNullReference(node) && !isInternedString(node) && !isDirectMethodHandle(node) && !isBoundMethodHandle(node);
     }