changeset 20880:9d58a4cda922

improved ImmutableCode invariant checking
author Doug Simon <doug.simon@oracle.com>
date Thu, 09 Apr 2015 23:09:12 +0200
parents 550e422e5483
children f5c3284db6f2
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsUtil.java
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java	Thu Apr 09 22:03:39 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java	Thu Apr 09 23:09:12 2015 +0200
@@ -137,7 +137,7 @@
     public void checkNewNodes(GraphBuilderContext b, InvocationPlugin plugin, NodeIterable<Node> newNodes) {
         if (GraalOptions.ImmutableCode.getValue()) {
             for (Node node : newNodes) {
-                if (node instanceof ConstantNode) {
+                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);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsUtil.java	Thu Apr 09 22:03:39 2015 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsUtil.java	Thu Apr 09 23:09:12 2015 +0200
@@ -22,6 +22,7 @@
  */
 package com.oracle.graal.replacements;
 
+import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.replacements.nodes.*;
 
 // JaCoCo Exclude
@@ -35,7 +36,7 @@
     static {
         boolean assertionsEnabled = false;
         assert (assertionsEnabled = true) != false;
-        REPLACEMENTS_ASSERTIONS_ENABLED = assertionsEnabled;
+        REPLACEMENTS_ASSERTIONS_ENABLED = assertionsEnabled && GraalOptions.ImmutableCode.getValue() == null;
     }
 
     /**