Mercurial > hg > graal-compiler
changeset 15084:3028c310ad42
Don't drop metadata annotation in ConstantNode smart constructors.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 14 Apr 2014 15:07:01 +0200 |
parents | 2bcd277b3e6d |
children | 9f1995f6d9a3 |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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) {