changeset 4549:2bab0e314b5c

Fixed a bug in the canonicalizer of the UnboxNode (brought up by Truffle).
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 09 Feb 2012 23:54:33 +0100
parents f55914bc1d67
children e065aa86d077 0c392b1bd7cc
files graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnboxNode.java
diffstat 1 files changed, 21 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnboxNode.java	Thu Feb 09 21:26:26 2012 +0100
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnboxNode.java	Thu Feb 09 23:54:33 2012 +0100
@@ -62,25 +62,27 @@
         if (source.isConstant()) {
             CiConstant constant = source.asConstant();
             Object o = constant.asObject();
-            switch (kind()) {
-                case Boolean:
-                    return ConstantNode.forBoolean((Boolean) o, graph());
-                case Byte:
-                    return ConstantNode.forByte((Byte) o, graph());
-                case Char:
-                    return ConstantNode.forChar((Character) o, graph());
-                case Short:
-                    return ConstantNode.forShort((Short) o, graph());
-                case Int:
-                    return ConstantNode.forInt((Integer) o, graph());
-                case Long:
-                    return ConstantNode.forLong((Long) o, graph());
-                case Float:
-                    return ConstantNode.forFloat((Long) o, graph());
-                case Double:
-                    return ConstantNode.forDouble((Long) o, graph());
-                default:
-                    assert false;
+            if (o != null) {
+                switch (kind()) {
+                    case Boolean:
+                        return ConstantNode.forBoolean((Boolean) o, graph());
+                    case Byte:
+                        return ConstantNode.forByte((Byte) o, graph());
+                    case Char:
+                        return ConstantNode.forChar((Character) o, graph());
+                    case Short:
+                        return ConstantNode.forShort((Short) o, graph());
+                    case Int:
+                        return ConstantNode.forInt((Integer) o, graph());
+                    case Long:
+                        return ConstantNode.forLong((Long) o, graph());
+                    case Float:
+                        return ConstantNode.forFloat((Long) o, graph());
+                    case Double:
+                        return ConstantNode.forDouble((Long) o, graph());
+                    default:
+                        assert false;
+                }
             }
         }
         return this;