# HG changeset patch # User Thomas Wuerthinger # Date 1328828073 -3600 # Node ID 2bab0e314b5c7ce69a5839b276a4408c38e67499 # Parent f55914bc1d6724dc7a4ec05c4c0aa9e4e9f76834 Fixed a bug in the canonicalizer of the UnboxNode (brought up by Truffle). diff -r f55914bc1d67 -r 2bab0e314b5c graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnboxNode.java --- 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;