# HG changeset patch # User Roland Schatz # Date 1397480821 -7200 # Node ID 3028c310ad42402ce87d594ff85e720c7ba9d818 # Parent 2bcd277b3e6d20372826d5b85f9c06d3b34b3394 Don't drop metadata annotation in ConstantNode smart constructors. diff -r 2bcd277b3e6d -r 3028c310ad42 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Mon Apr 14 15:02:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Mon Apr 14 15:07:01 2014 +0200 @@ -175,7 +175,8 @@ public static ConstantNode forPrimitive(Stamp stamp, Constant constant, StructuredGraph graph) { if (stamp instanceof IntegerStamp) { assert constant.getKind().isNumericInteger() && stamp.getStackKind() == constant.getKind().getStackKind(); - return forIntegerStamp(stamp, constant.asLong(), graph); + IntegerStamp istamp = (IntegerStamp) stamp; + return forIntegerBits(istamp.getBits(), istamp.isUnsigned(), constant, graph); } else { assert constant.getKind().isNumericFloat() && stamp.getStackKind() == constant.getKind(); return forPrimitive(constant, graph); @@ -266,12 +267,8 @@ return graph.unique(node); } - /** - * Returns a node for a constant integer that's not directly representable as Java primitive - * (e.g. short). - */ - public static ConstantNode forIntegerBits(int bits, boolean unsigned, long value, StructuredGraph graph) { - Constant constant = Constant.forPrimitiveInt(bits, value); + private static ConstantNode forIntegerBits(int bits, boolean unsigned, Constant constant, StructuredGraph graph) { + long value = constant.asLong(); long bounds; if (unsigned) { bounds = ZeroExtendNode.zeroExtend(value, bits); @@ -282,6 +279,14 @@ } /** + * Returns a node for a constant integer that's not directly representable as Java primitive + * (e.g. short). + */ + public static ConstantNode forIntegerBits(int bits, boolean unsigned, long value, StructuredGraph graph) { + return forIntegerBits(bits, unsigned, Constant.forPrimitiveInt(bits, value), graph); + } + + /** * Returns a node for a constant integer that's compatible to a given stamp. */ public static ConstantNode forIntegerStamp(Stamp stamp, long value, StructuredGraph graph) {