changeset 7670:fca53a04eabc

Do not call inferStamp when it is already known that a node is a Word. When the input operand is already rewritten, this could cause an exception. Example: CheckCastNode.inferStamp expect that the input has an objectStamp, but at the point of inferStamp it would already be a primitive stamp.
author Christian Wimmer <christian.wimmer@oracle.com>
date Mon, 04 Feb 2013 05:45:28 -0800
parents fae0b2f0279e
children 8beb61af377a
files graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java	Mon Feb 04 05:41:14 2013 -0800
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java	Mon Feb 04 05:45:28 2013 -0800
@@ -284,7 +284,19 @@
     }
 
     public boolean isWord(ValueNode node) {
+        /*
+         * If we already know that we have a word type, we do not need to infer the stamp. This
+         * avoids exceptions in inferStamp when the inputs have already been rewritten to word,
+         * i.e., when the expected input is no longer an object.
+         */
+        if (isWord0(node)) {
+            return true;
+        }
         node.inferStamp();
+        return isWord0(node);
+    }
+
+    private boolean isWord0(ValueNode node) {
         if (node.stamp() == StampFactory.forWord()) {
             return true;
         }