# HG changeset patch # User Christian Wimmer # Date 1453765803 28800 # Node ID 93349d4b852e9a486cb8ca15940c9656450f3800 # Parent 3bc2598ce1e0003be30686a33c5909b0401156d1 Fix formatting errors that the gate complained about diff -r 3bc2598ce1e0 -r 93349d4b852e graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/FloatStamp.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/FloatStamp.java Mon Jan 25 15:03:43 2016 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/FloatStamp.java Mon Jan 25 15:50:03 2016 -0800 @@ -297,526 +297,526 @@ private static final ArithmeticOpTable OPS = new ArithmeticOpTable( - new UnaryOp.Neg() { + new UnaryOp.Neg() { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - switch (value.getJavaKind()) { - case Float: - return JavaConstant.forFloat(-value.asFloat()); - case Double: - return JavaConstant.forDouble(-value.asDouble()); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + switch (value.getJavaKind()) { + case Float: + return JavaConstant.forFloat(-value.asFloat()); + case Double: + return JavaConstant.forDouble(-value.asDouble()); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp s) { - FloatStamp stamp = (FloatStamp) s; - return new FloatStamp(stamp.getBits(), -stamp.upperBound(), -stamp.lowerBound(), stamp.isNonNaN()); - } - }, + @Override + public Stamp foldStamp(Stamp s) { + FloatStamp stamp = (FloatStamp) s; + return new FloatStamp(stamp.getBits(), -stamp.upperBound(), -stamp.lowerBound(), stamp.isNonNaN()); + } + }, - new BinaryOp.Add(false, true) { + new BinaryOp.Add(false, true) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - switch (a.getJavaKind()) { - case Float: - return JavaConstant.forFloat(a.asFloat() + b.asFloat()); - case Double: - return JavaConstant.forDouble(a.asDouble() + b.asDouble()); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + switch (a.getJavaKind()) { + case Float: + return JavaConstant.forFloat(a.asFloat() + b.asFloat()); + case Double: + return JavaConstant.forDouble(a.asDouble() + b.asDouble()); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - // TODO - return stamp1.unrestricted(); - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + // TODO + return stamp1.unrestricted(); + } - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - switch (n.getJavaKind()) { - case Float: - return Float.compare(n.asFloat(), -0.0f) == 0; - case Double: - return Double.compare(n.asDouble(), -0.0) == 0; - default: - throw JVMCIError.shouldNotReachHere(); - } - } - }, + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + switch (n.getJavaKind()) { + case Float: + return Float.compare(n.asFloat(), -0.0f) == 0; + case Double: + return Double.compare(n.asDouble(), -0.0) == 0; + default: + throw JVMCIError.shouldNotReachHere(); + } + } + }, - new BinaryOp.Sub(false, false) { + new BinaryOp.Sub(false, false) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - switch (a.getJavaKind()) { - case Float: - return JavaConstant.forFloat(a.asFloat() - b.asFloat()); - case Double: - return JavaConstant.forDouble(a.asDouble() - b.asDouble()); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + switch (a.getJavaKind()) { + case Float: + return JavaConstant.forFloat(a.asFloat() - b.asFloat()); + case Double: + return JavaConstant.forDouble(a.asDouble() - b.asDouble()); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - // TODO - return stamp1.unrestricted(); - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + // TODO + return stamp1.unrestricted(); + } - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - switch (n.getJavaKind()) { - case Float: - return Float.compare(n.asFloat(), 0.0f) == 0; - case Double: - return Double.compare(n.asDouble(), 0.0) == 0; - default: - throw JVMCIError.shouldNotReachHere(); - } - } - }, + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + switch (n.getJavaKind()) { + case Float: + return Float.compare(n.asFloat(), 0.0f) == 0; + case Double: + return Double.compare(n.asDouble(), 0.0) == 0; + default: + throw JVMCIError.shouldNotReachHere(); + } + } + }, - new BinaryOp.Mul(false, true) { + new BinaryOp.Mul(false, true) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - switch (a.getJavaKind()) { - case Float: - return JavaConstant.forFloat(a.asFloat() * b.asFloat()); - case Double: - return JavaConstant.forDouble(a.asDouble() * b.asDouble()); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + switch (a.getJavaKind()) { + case Float: + return JavaConstant.forFloat(a.asFloat() * b.asFloat()); + case Double: + return JavaConstant.forDouble(a.asDouble() * b.asDouble()); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp a, Stamp b) { - // TODO - return a.unrestricted(); - } + @Override + public Stamp foldStamp(Stamp a, Stamp b) { + // TODO + return a.unrestricted(); + } - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - switch (n.getJavaKind()) { - case Float: - return Float.compare(n.asFloat(), 1.0f) == 0; - case Double: - return Double.compare(n.asDouble(), 1.0) == 0; - default: - throw JVMCIError.shouldNotReachHere(); - } - } - }, + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + switch (n.getJavaKind()) { + case Float: + return Float.compare(n.asFloat(), 1.0f) == 0; + case Double: + return Double.compare(n.asDouble(), 1.0) == 0; + default: + throw JVMCIError.shouldNotReachHere(); + } + } + }, - new BinaryOp.Div(false, false) { + new BinaryOp.Div(false, false) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - switch (a.getJavaKind()) { - case Float: - return JavaConstant.forFloat(a.asFloat() / b.asFloat()); - case Double: - return JavaConstant.forDouble(a.asDouble() / b.asDouble()); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + switch (a.getJavaKind()) { + case Float: + return JavaConstant.forFloat(a.asFloat() / b.asFloat()); + case Double: + return JavaConstant.forDouble(a.asDouble() / b.asDouble()); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - // TODO - return stamp1.unrestricted(); - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + // TODO + return stamp1.unrestricted(); + } - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - switch (n.getJavaKind()) { - case Float: - return Float.compare(n.asFloat(), 1.0f) == 0; - case Double: - return Double.compare(n.asDouble(), 1.0) == 0; - default: - throw JVMCIError.shouldNotReachHere(); - } - } - }, + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + switch (n.getJavaKind()) { + case Float: + return Float.compare(n.asFloat(), 1.0f) == 0; + case Double: + return Double.compare(n.asDouble(), 1.0) == 0; + default: + throw JVMCIError.shouldNotReachHere(); + } + } + }, - new BinaryOp.Rem(false, false) { + new BinaryOp.Rem(false, false) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - switch (a.getJavaKind()) { - case Float: - return JavaConstant.forFloat(a.asFloat() % b.asFloat()); - case Double: - return JavaConstant.forDouble(a.asDouble() % b.asDouble()); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + switch (a.getJavaKind()) { + case Float: + return JavaConstant.forFloat(a.asFloat() % b.asFloat()); + case Double: + return JavaConstant.forDouble(a.asDouble() % b.asDouble()); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - // TODO - return stamp1.unrestricted(); - } - }, + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + // TODO + return stamp1.unrestricted(); + } + }, - new UnaryOp.Not() { + new UnaryOp.Not() { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - switch (value.getJavaKind()) { - case Float: - int f = Float.floatToRawIntBits(value.asFloat()); - return JavaConstant.forFloat(Float.intBitsToFloat(~f)); - case Double: - long d = Double.doubleToRawLongBits(value.asDouble()); - return JavaConstant.forDouble(Double.longBitsToDouble(~d)); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + switch (value.getJavaKind()) { + case Float: + int f = Float.floatToRawIntBits(value.asFloat()); + return JavaConstant.forFloat(Float.intBitsToFloat(~f)); + case Double: + long d = Double.doubleToRawLongBits(value.asDouble()); + return JavaConstant.forDouble(Double.longBitsToDouble(~d)); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp s) { - return s.unrestricted(); - } - }, + @Override + public Stamp foldStamp(Stamp s) { + return s.unrestricted(); + } + }, - new BinaryOp.And(true, true) { + new BinaryOp.And(true, true) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - switch (a.getJavaKind()) { - case Float: - int fa = Float.floatToRawIntBits(a.asFloat()); - int fb = Float.floatToRawIntBits(b.asFloat()); - return JavaConstant.forFloat(Float.intBitsToFloat(fa & fb)); - case Double: - long da = Double.doubleToRawLongBits(a.asDouble()); - long db = Double.doubleToRawLongBits(b.asDouble()); - return JavaConstant.forDouble(Double.longBitsToDouble(da & db)); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + switch (a.getJavaKind()) { + case Float: + int fa = Float.floatToRawIntBits(a.asFloat()); + int fb = Float.floatToRawIntBits(b.asFloat()); + return JavaConstant.forFloat(Float.intBitsToFloat(fa & fb)); + case Double: + long da = Double.doubleToRawLongBits(a.asDouble()); + long db = Double.doubleToRawLongBits(b.asDouble()); + return JavaConstant.forDouble(Double.longBitsToDouble(da & db)); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - return stamp1.unrestricted(); - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + return stamp1.unrestricted(); + } - @Override - public boolean isNeutral(Constant n) { - PrimitiveConstant value = (PrimitiveConstant) n; - switch (value.getJavaKind()) { - case Float: - return Float.floatToRawIntBits(value.asFloat()) == 0xFFFFFFFF; - case Double: - return Double.doubleToRawLongBits(value.asDouble()) == 0xFFFFFFFFFFFFFFFFL; - default: - throw JVMCIError.shouldNotReachHere(); - } - } - }, + @Override + public boolean isNeutral(Constant n) { + PrimitiveConstant value = (PrimitiveConstant) n; + switch (value.getJavaKind()) { + case Float: + return Float.floatToRawIntBits(value.asFloat()) == 0xFFFFFFFF; + case Double: + return Double.doubleToRawLongBits(value.asDouble()) == 0xFFFFFFFFFFFFFFFFL; + default: + throw JVMCIError.shouldNotReachHere(); + } + } + }, - new BinaryOp.Or(true, true) { + new BinaryOp.Or(true, true) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - switch (a.getJavaKind()) { - case Float: - int fa = Float.floatToRawIntBits(a.asFloat()); - int fb = Float.floatToRawIntBits(b.asFloat()); - return JavaConstant.forFloat(Float.intBitsToFloat(fa | fb)); - case Double: - long da = Double.doubleToRawLongBits(a.asDouble()); - long db = Double.doubleToRawLongBits(b.asDouble()); - return JavaConstant.forDouble(Double.longBitsToDouble(da | db)); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + switch (a.getJavaKind()) { + case Float: + int fa = Float.floatToRawIntBits(a.asFloat()); + int fb = Float.floatToRawIntBits(b.asFloat()); + return JavaConstant.forFloat(Float.intBitsToFloat(fa | fb)); + case Double: + long da = Double.doubleToRawLongBits(a.asDouble()); + long db = Double.doubleToRawLongBits(b.asDouble()); + return JavaConstant.forDouble(Double.longBitsToDouble(da | db)); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - return stamp1.unrestricted(); - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + return stamp1.unrestricted(); + } - @Override - public boolean isNeutral(Constant n) { - PrimitiveConstant value = (PrimitiveConstant) n; - switch (value.getJavaKind()) { - case Float: - return Float.floatToRawIntBits(value.asFloat()) == 0; - case Double: - return Double.doubleToRawLongBits(value.asDouble()) == 0L; - default: - throw JVMCIError.shouldNotReachHere(); - } - } - }, + @Override + public boolean isNeutral(Constant n) { + PrimitiveConstant value = (PrimitiveConstant) n; + switch (value.getJavaKind()) { + case Float: + return Float.floatToRawIntBits(value.asFloat()) == 0; + case Double: + return Double.doubleToRawLongBits(value.asDouble()) == 0L; + default: + throw JVMCIError.shouldNotReachHere(); + } + } + }, - new BinaryOp.Xor(true, true) { + new BinaryOp.Xor(true, true) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - switch (a.getJavaKind()) { - case Float: - int fa = Float.floatToRawIntBits(a.asFloat()); - int fb = Float.floatToRawIntBits(b.asFloat()); - return JavaConstant.forFloat(Float.intBitsToFloat(fa ^ fb)); - case Double: - long da = Double.doubleToRawLongBits(a.asDouble()); - long db = Double.doubleToRawLongBits(b.asDouble()); - return JavaConstant.forDouble(Double.longBitsToDouble(da ^ db)); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + switch (a.getJavaKind()) { + case Float: + int fa = Float.floatToRawIntBits(a.asFloat()); + int fb = Float.floatToRawIntBits(b.asFloat()); + return JavaConstant.forFloat(Float.intBitsToFloat(fa ^ fb)); + case Double: + long da = Double.doubleToRawLongBits(a.asDouble()); + long db = Double.doubleToRawLongBits(b.asDouble()); + return JavaConstant.forDouble(Double.longBitsToDouble(da ^ db)); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - return stamp1.unrestricted(); - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + return stamp1.unrestricted(); + } - @Override - public boolean isNeutral(Constant n) { - PrimitiveConstant value = (PrimitiveConstant) n; - switch (value.getJavaKind()) { - case Float: - return Float.floatToRawIntBits(value.asFloat()) == 0; - case Double: - return Double.doubleToRawLongBits(value.asDouble()) == 0L; - default: - throw JVMCIError.shouldNotReachHere(); - } - } - }, + @Override + public boolean isNeutral(Constant n) { + PrimitiveConstant value = (PrimitiveConstant) n; + switch (value.getJavaKind()) { + case Float: + return Float.floatToRawIntBits(value.asFloat()) == 0; + case Double: + return Double.doubleToRawLongBits(value.asDouble()) == 0L; + default: + throw JVMCIError.shouldNotReachHere(); + } + } + }, - null, null, null, + null, null, null, - new UnaryOp.Abs() { + new UnaryOp.Abs() { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - switch (value.getJavaKind()) { - case Float: - return JavaConstant.forFloat(Math.abs(value.asFloat())); - case Double: - return JavaConstant.forDouble(Math.abs(value.asDouble())); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + switch (value.getJavaKind()) { + case Float: + return JavaConstant.forFloat(Math.abs(value.asFloat())); + case Double: + return JavaConstant.forDouble(Math.abs(value.asDouble())); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp s) { - FloatStamp stamp = (FloatStamp) s; - if (stamp.isNaN()) { - return stamp; - } - return new FloatStamp(stamp.getBits(), 0, Math.max(-stamp.lowerBound(), stamp.upperBound()), stamp.isNonNaN()); - } - }, + @Override + public Stamp foldStamp(Stamp s) { + FloatStamp stamp = (FloatStamp) s; + if (stamp.isNaN()) { + return stamp; + } + return new FloatStamp(stamp.getBits(), 0, Math.max(-stamp.lowerBound(), stamp.upperBound()), stamp.isNonNaN()); + } + }, - new UnaryOp.Sqrt() { + new UnaryOp.Sqrt() { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - switch (value.getJavaKind()) { - case Float: - return JavaConstant.forFloat((float) Math.sqrt(value.asFloat())); - case Double: - return JavaConstant.forDouble(Math.sqrt(value.asDouble())); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + switch (value.getJavaKind()) { + case Float: + return JavaConstant.forFloat((float) Math.sqrt(value.asFloat())); + case Double: + return JavaConstant.forDouble(Math.sqrt(value.asDouble())); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Stamp foldStamp(Stamp s) { - return s.unrestricted(); - } - }, + @Override + public Stamp foldStamp(Stamp s) { + return s.unrestricted(); + } + }, - null, null, null, + null, null, null, - new FloatConvertOp(F2I) { + new FloatConvertOp(F2I) { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forInt((int) value.asFloat()); - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forInt((int) value.asFloat()); + } - @Override - public Stamp foldStamp(Stamp stamp) { - FloatStamp floatStamp = (FloatStamp) stamp; - assert floatStamp.getBits() == 32; - boolean mustHaveZero = !floatStamp.isNonNaN(); - int lowerBound = (int) floatStamp.lowerBound(); - int upperBound = (int) floatStamp.upperBound(); - if (mustHaveZero) { - if (lowerBound > 0) { - lowerBound = 0; - } else if (upperBound < 0) { - upperBound = 0; - } - } - return StampFactory.forInteger(JavaKind.Int, lowerBound, upperBound); - } - }, + @Override + public Stamp foldStamp(Stamp stamp) { + FloatStamp floatStamp = (FloatStamp) stamp; + assert floatStamp.getBits() == 32; + boolean mustHaveZero = !floatStamp.isNonNaN(); + int lowerBound = (int) floatStamp.lowerBound(); + int upperBound = (int) floatStamp.upperBound(); + if (mustHaveZero) { + if (lowerBound > 0) { + lowerBound = 0; + } else if (upperBound < 0) { + upperBound = 0; + } + } + return StampFactory.forInteger(JavaKind.Int, lowerBound, upperBound); + } + }, - new FloatConvertOp(F2L) { + new FloatConvertOp(F2L) { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forLong((long) value.asFloat()); - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forLong((long) value.asFloat()); + } - @Override - public Stamp foldStamp(Stamp stamp) { - FloatStamp floatStamp = (FloatStamp) stamp; - assert floatStamp.getBits() == 32; - boolean mustHaveZero = !floatStamp.isNonNaN(); - long lowerBound = (long) floatStamp.lowerBound(); - long upperBound = (long) floatStamp.upperBound(); - if (mustHaveZero) { - if (lowerBound > 0) { - lowerBound = 0; - } else if (upperBound < 0) { - upperBound = 0; - } - } - return StampFactory.forInteger(JavaKind.Long, lowerBound, upperBound); - } - }, + @Override + public Stamp foldStamp(Stamp stamp) { + FloatStamp floatStamp = (FloatStamp) stamp; + assert floatStamp.getBits() == 32; + boolean mustHaveZero = !floatStamp.isNonNaN(); + long lowerBound = (long) floatStamp.lowerBound(); + long upperBound = (long) floatStamp.upperBound(); + if (mustHaveZero) { + if (lowerBound > 0) { + lowerBound = 0; + } else if (upperBound < 0) { + upperBound = 0; + } + } + return StampFactory.forInteger(JavaKind.Long, lowerBound, upperBound); + } + }, - new FloatConvertOp(D2I) { + new FloatConvertOp(D2I) { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forInt((int) value.asDouble()); - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forInt((int) value.asDouble()); + } - @Override - public Stamp foldStamp(Stamp stamp) { - FloatStamp floatStamp = (FloatStamp) stamp; - assert floatStamp.getBits() == 64; - boolean mustHaveZero = !floatStamp.isNonNaN(); - int lowerBound = (int) floatStamp.lowerBound(); - int upperBound = (int) floatStamp.upperBound(); - if (mustHaveZero) { - if (lowerBound > 0) { - lowerBound = 0; - } else if (upperBound < 0) { - upperBound = 0; - } - } - return StampFactory.forInteger(JavaKind.Int, lowerBound, upperBound); - } - }, + @Override + public Stamp foldStamp(Stamp stamp) { + FloatStamp floatStamp = (FloatStamp) stamp; + assert floatStamp.getBits() == 64; + boolean mustHaveZero = !floatStamp.isNonNaN(); + int lowerBound = (int) floatStamp.lowerBound(); + int upperBound = (int) floatStamp.upperBound(); + if (mustHaveZero) { + if (lowerBound > 0) { + lowerBound = 0; + } else if (upperBound < 0) { + upperBound = 0; + } + } + return StampFactory.forInteger(JavaKind.Int, lowerBound, upperBound); + } + }, - new FloatConvertOp(D2L) { + new FloatConvertOp(D2L) { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forLong((long) value.asDouble()); - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forLong((long) value.asDouble()); + } - @Override - public Stamp foldStamp(Stamp stamp) { - FloatStamp floatStamp = (FloatStamp) stamp; - assert floatStamp.getBits() == 64; - boolean mustHaveZero = !floatStamp.isNonNaN(); - long lowerBound = (long) floatStamp.lowerBound(); - long upperBound = (long) floatStamp.upperBound(); - if (mustHaveZero) { - if (lowerBound > 0) { - lowerBound = 0; - } else if (upperBound < 0) { - upperBound = 0; - } - } - return StampFactory.forInteger(JavaKind.Long, lowerBound, upperBound); - } - }, + @Override + public Stamp foldStamp(Stamp stamp) { + FloatStamp floatStamp = (FloatStamp) stamp; + assert floatStamp.getBits() == 64; + boolean mustHaveZero = !floatStamp.isNonNaN(); + long lowerBound = (long) floatStamp.lowerBound(); + long upperBound = (long) floatStamp.upperBound(); + if (mustHaveZero) { + if (lowerBound > 0) { + lowerBound = 0; + } else if (upperBound < 0) { + upperBound = 0; + } + } + return StampFactory.forInteger(JavaKind.Long, lowerBound, upperBound); + } + }, - new FloatConvertOp(F2D) { + new FloatConvertOp(F2D) { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forDouble(value.asFloat()); - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forDouble(value.asFloat()); + } - @Override - public Stamp foldStamp(Stamp stamp) { - FloatStamp floatStamp = (FloatStamp) stamp; - assert floatStamp.getBits() == 32; - return StampFactory.forFloat(JavaKind.Double, floatStamp.lowerBound(), floatStamp.upperBound(), floatStamp.isNonNaN()); - } - }, + @Override + public Stamp foldStamp(Stamp stamp) { + FloatStamp floatStamp = (FloatStamp) stamp; + assert floatStamp.getBits() == 32; + return StampFactory.forFloat(JavaKind.Double, floatStamp.lowerBound(), floatStamp.upperBound(), floatStamp.isNonNaN()); + } + }, - new FloatConvertOp(D2F) { + new FloatConvertOp(D2F) { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forFloat((float) value.asDouble()); - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forFloat((float) value.asDouble()); + } - @Override - public Stamp foldStamp(Stamp stamp) { - FloatStamp floatStamp = (FloatStamp) stamp; - assert floatStamp.getBits() == 64; - return StampFactory.forFloat(JavaKind.Float, (float) floatStamp.lowerBound(), (float) floatStamp.upperBound(), floatStamp.isNonNaN()); - } - }); + @Override + public Stamp foldStamp(Stamp stamp) { + FloatStamp floatStamp = (FloatStamp) stamp; + assert floatStamp.getBits() == 64; + return StampFactory.forFloat(JavaKind.Float, (float) floatStamp.lowerBound(), (float) floatStamp.upperBound(), floatStamp.isNonNaN()); + } + }); } diff -r 3bc2598ce1e0 -r 93349d4b852e graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/IntegerStamp.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/IntegerStamp.java Mon Jan 25 15:03:43 2016 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/IntegerStamp.java Mon Jan 25 15:50:03 2016 -0800 @@ -407,646 +407,653 @@ public static final ArithmeticOpTable OPS = new ArithmeticOpTable( - new UnaryOp.Neg() { + new UnaryOp.Neg() { - @Override - public Constant foldConstant(Constant value) { - PrimitiveConstant c = (PrimitiveConstant) value; - return JavaConstant.forIntegerKind(c.getJavaKind(), -c.asLong()); - } + @Override + public Constant foldConstant(Constant value) { + PrimitiveConstant c = (PrimitiveConstant) value; + return JavaConstant.forIntegerKind(c.getJavaKind(), -c.asLong()); + } - @Override - public Stamp foldStamp(Stamp s) { - IntegerStamp stamp = (IntegerStamp) s; - int bits = stamp.getBits(); - if (stamp.lowerBound() != CodeUtil.minValue(bits)) { - // TODO(ls) check if the mask calculation is correct... - return StampFactory.forInteger(bits, -stamp.upperBound(), -stamp.lowerBound()); - } else { - return stamp.unrestricted(); - } - } - }, + @Override + public Stamp foldStamp(Stamp s) { + IntegerStamp stamp = (IntegerStamp) s; + int bits = stamp.getBits(); + if (stamp.lowerBound() != CodeUtil.minValue(bits)) { + // TODO(ls) check if the mask calculation is correct... + return StampFactory.forInteger(bits, -stamp.upperBound(), -stamp.lowerBound()); + } else { + return stamp.unrestricted(); + } + } + }, - new BinaryOp.Add(true, true) { + new BinaryOp.Add(true, true) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() + b.asLong()); - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() + b.asLong()); + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - IntegerStamp a = (IntegerStamp) stamp1; - IntegerStamp b = (IntegerStamp) stamp2; + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + IntegerStamp a = (IntegerStamp) stamp1; + IntegerStamp b = (IntegerStamp) stamp2; - int bits = a.getBits(); - assert bits == b.getBits(); + int bits = a.getBits(); + assert bits == b.getBits(); - if (a.isUnrestricted()) { - return a; - } else if (b.isUnrestricted()) { - return b; - } - long defaultMask = CodeUtil.mask(bits); - long variableBits = (a.downMask() ^ a.upMask()) | (b.downMask() ^ b.upMask()); - long variableBitsWithCarry = variableBits | (carryBits(a.downMask(), b.downMask()) ^ carryBits(a.upMask(), b.upMask())); - long newDownMask = (a.downMask() + b.downMask()) & ~variableBitsWithCarry; - long newUpMask = (a.downMask() + b.downMask()) | variableBitsWithCarry; + if (a.isUnrestricted()) { + return a; + } else if (b.isUnrestricted()) { + return b; + } + long defaultMask = CodeUtil.mask(bits); + long variableBits = (a.downMask() ^ a.upMask()) | (b.downMask() ^ b.upMask()); + long variableBitsWithCarry = variableBits | (carryBits(a.downMask(), b.downMask()) ^ carryBits(a.upMask(), b.upMask())); + long newDownMask = (a.downMask() + b.downMask()) & ~variableBitsWithCarry; + long newUpMask = (a.downMask() + b.downMask()) | variableBitsWithCarry; - newDownMask &= defaultMask; - newUpMask &= defaultMask; + newDownMask &= defaultMask; + newUpMask &= defaultMask; - long newLowerBound; - long newUpperBound; - boolean lowerOverflowsPositively = addOverflowsPositively(a.lowerBound(), b.lowerBound(), bits); - boolean upperOverflowsPositively = addOverflowsPositively(a.upperBound(), b.upperBound(), bits); - boolean lowerOverflowsNegatively = addOverflowsNegatively(a.lowerBound(), b.lowerBound(), bits); - boolean upperOverflowsNegatively = addOverflowsNegatively(a.upperBound(), b.upperBound(), bits); - if ((lowerOverflowsNegatively && !upperOverflowsNegatively) || (!lowerOverflowsPositively && upperOverflowsPositively)) { - newLowerBound = CodeUtil.minValue(bits); - newUpperBound = CodeUtil.maxValue(bits); - } else { - newLowerBound = CodeUtil.signExtend((a.lowerBound() + b.lowerBound()) & defaultMask, bits); - newUpperBound = CodeUtil.signExtend((a.upperBound() + b.upperBound()) & defaultMask, bits); - } - IntegerStamp limit = StampFactory.forInteger(bits, newLowerBound, newUpperBound); - newUpMask &= limit.upMask(); - newUpperBound = CodeUtil.signExtend(newUpperBound & newUpMask, bits); - newDownMask |= limit.downMask(); - newLowerBound |= newDownMask; - return new IntegerStamp(bits, newLowerBound, newUpperBound, newDownMask, newUpMask); - } + long newLowerBound; + long newUpperBound; + boolean lowerOverflowsPositively = addOverflowsPositively(a.lowerBound(), b.lowerBound(), bits); + boolean upperOverflowsPositively = addOverflowsPositively(a.upperBound(), b.upperBound(), bits); + boolean lowerOverflowsNegatively = addOverflowsNegatively(a.lowerBound(), b.lowerBound(), bits); + boolean upperOverflowsNegatively = addOverflowsNegatively(a.upperBound(), b.upperBound(), bits); + if ((lowerOverflowsNegatively && !upperOverflowsNegatively) || (!lowerOverflowsPositively && upperOverflowsPositively)) { + newLowerBound = CodeUtil.minValue(bits); + newUpperBound = CodeUtil.maxValue(bits); + } else { + newLowerBound = CodeUtil.signExtend((a.lowerBound() + b.lowerBound()) & defaultMask, bits); + newUpperBound = CodeUtil.signExtend((a.upperBound() + b.upperBound()) & defaultMask, bits); + } + IntegerStamp limit = StampFactory.forInteger(bits, newLowerBound, newUpperBound); + newUpMask &= limit.upMask(); + newUpperBound = CodeUtil.signExtend(newUpperBound & newUpMask, bits); + newDownMask |= limit.downMask(); + newLowerBound |= newDownMask; + return new IntegerStamp(bits, newLowerBound, newUpperBound, newDownMask, newUpMask); + } - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - return n.asLong() == 0; - } - }, + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + return n.asLong() == 0; + } + }, - new BinaryOp.Sub(true, false) { + new BinaryOp.Sub(true, false) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() - b.asLong()); - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() - b.asLong()); + } - @Override - public Stamp foldStamp(Stamp a, Stamp b) { - return OPS.getAdd().foldStamp(a, OPS.getNeg().foldStamp(b)); - } + @Override + public Stamp foldStamp(Stamp a, Stamp b) { + return OPS.getAdd().foldStamp(a, OPS.getNeg().foldStamp(b)); + } - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - return n.asLong() == 0; - } + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + return n.asLong() == 0; + } - @Override - public Constant getZero(Stamp s) { - IntegerStamp stamp = (IntegerStamp) s; - return JavaConstant.forPrimitiveInt(stamp.getBits(), 0); - } - }, + @Override + public Constant getZero(Stamp s) { + IntegerStamp stamp = (IntegerStamp) s; + return JavaConstant.forPrimitiveInt(stamp.getBits(), 0); + } + }, - new BinaryOp.Mul(true, true) { + new BinaryOp.Mul(true, true) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() * b.asLong()); - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() * b.asLong()); + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - IntegerStamp a = (IntegerStamp) stamp1; - IntegerStamp b = (IntegerStamp) stamp2; - if (a.upMask() == 0) { - return a; - } else if (b.upMask() == 0) { - return b; - } else { - // TODO - return a.unrestricted(); - } - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + IntegerStamp a = (IntegerStamp) stamp1; + IntegerStamp b = (IntegerStamp) stamp2; + if (a.upMask() == 0) { + return a; + } else if (b.upMask() == 0) { + return b; + } else { + // TODO + return a.unrestricted(); + } + } - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - return n.asLong() == 1; - } - }, + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + return n.asLong() == 1; + } + }, - new BinaryOp.Div(true, false) { + new BinaryOp.Div(true, false) { - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() / b.asLong()); - } + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() / b.asLong()); + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - IntegerStamp a = (IntegerStamp) stamp1; - IntegerStamp b = (IntegerStamp) stamp2; - assert a.getBits() == b.getBits(); - if (b.isStrictlyPositive()) { - long newLowerBound = a.lowerBound() / b.lowerBound(); - long newUpperBound = a.upperBound() / b.lowerBound(); - return StampFactory.forInteger(a.getBits(), newLowerBound, newUpperBound); - } else { - return a.unrestricted(); - } - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + IntegerStamp a = (IntegerStamp) stamp1; + IntegerStamp b = (IntegerStamp) stamp2; + assert a.getBits() == b.getBits(); + if (b.isStrictlyPositive()) { + long newLowerBound = a.lowerBound() / b.lowerBound(); + long newUpperBound = a.upperBound() / b.lowerBound(); + return StampFactory.forInteger(a.getBits(), newLowerBound, newUpperBound); + } else { + return a.unrestricted(); + } + } - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - return n.asLong() == 1; - } - }, + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + return n.asLong() == 1; + } + }, + + new BinaryOp.Rem(false, false) { - new BinaryOp.Rem(false, false) { + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() % b.asLong()); + } - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() % b.asLong()); - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + IntegerStamp a = (IntegerStamp) stamp1; + IntegerStamp b = (IntegerStamp) stamp2; + assert a.getBits() == b.getBits(); + // zero is always possible + long newLowerBound = Math.min(a.lowerBound(), 0); + long newUpperBound = Math.max(a.upperBound(), 0); - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - IntegerStamp a = (IntegerStamp) stamp1; - IntegerStamp b = (IntegerStamp) stamp2; - assert a.getBits() == b.getBits(); - // zero is always possible - long newLowerBound = Math.min(a.lowerBound(), 0); - long newUpperBound = Math.max(a.upperBound(), 0); + /* the maximum absolute value of the result, derived from b */ + long magnitude; + if (b.lowerBound() == CodeUtil.minValue(b.getBits())) { + // Math.abs(...) - 1 does not work in a case + magnitude = CodeUtil.maxValue(b.getBits()); + } else { + magnitude = Math.max(Math.abs(b.lowerBound()), Math.abs(b.upperBound())) - 1; + } + newLowerBound = Math.max(newLowerBound, -magnitude); + newUpperBound = Math.min(newUpperBound, magnitude); - long magnitude; // the maximum absolute value of the result, derived from b - if (b.lowerBound() == CodeUtil.minValue(b.getBits())) { - // Math.abs(...) - 1 does not work in a case - magnitude = CodeUtil.maxValue(b.getBits()); - } else { - magnitude = Math.max(Math.abs(b.lowerBound()), Math.abs(b.upperBound())) - 1; - } - newLowerBound = Math.max(newLowerBound, -magnitude); - newUpperBound = Math.min(newUpperBound, magnitude); + return StampFactory.forInteger(a.getBits(), newLowerBound, newUpperBound); + } + }, + + new UnaryOp.Not() { - return StampFactory.forInteger(a.getBits(), newLowerBound, newUpperBound); - } - }, - - new UnaryOp.Not() { + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forIntegerKind(value.getJavaKind(), ~value.asLong()); + } - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forIntegerKind(value.getJavaKind(), ~value.asLong()); - } + @Override + public Stamp foldStamp(Stamp stamp) { + IntegerStamp integerStamp = (IntegerStamp) stamp; + int bits = integerStamp.getBits(); + long defaultMask = CodeUtil.mask(bits); + return new IntegerStamp(bits, ~integerStamp.upperBound(), ~integerStamp.lowerBound(), (~integerStamp.upMask()) & defaultMask, (~integerStamp.downMask()) & defaultMask); + } + }, - @Override - public Stamp foldStamp(Stamp stamp) { - IntegerStamp integerStamp = (IntegerStamp) stamp; - int bits = integerStamp.getBits(); - long defaultMask = CodeUtil.mask(bits); - return new IntegerStamp(bits, ~integerStamp.upperBound(), ~integerStamp.lowerBound(), (~integerStamp.upMask()) & defaultMask, (~integerStamp.downMask()) & defaultMask); - } - }, + new BinaryOp.And(true, true) { - new BinaryOp.And(true, true) { + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() & b.asLong()); + } - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() & b.asLong()); - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + IntegerStamp a = (IntegerStamp) stamp1; + IntegerStamp b = (IntegerStamp) stamp2; + assert a.getBits() == b.getBits(); + return stampForMask(a.getBits(), a.downMask() & b.downMask(), a.upMask() & b.upMask()); + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - IntegerStamp a = (IntegerStamp) stamp1; - IntegerStamp b = (IntegerStamp) stamp2; - assert a.getBits() == b.getBits(); - return stampForMask(a.getBits(), a.downMask() & b.downMask(), a.upMask() & b.upMask()); - } + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + int bits = n.getJavaKind().getBitCount(); + long mask = CodeUtil.mask(bits); + return (n.asLong() & mask) == mask; + } + }, + + new BinaryOp.Or(true, true) { - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - int bits = n.getJavaKind().getBitCount(); - long mask = CodeUtil.mask(bits); - return (n.asLong() & mask) == mask; - } - }, - - new BinaryOp.Or(true, true) { + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() | b.asLong()); + } - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() | b.asLong()); - } + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + IntegerStamp a = (IntegerStamp) stamp1; + IntegerStamp b = (IntegerStamp) stamp2; + assert a.getBits() == b.getBits(); + return stampForMask(a.getBits(), a.downMask() | b.downMask(), a.upMask() | b.upMask()); + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - IntegerStamp a = (IntegerStamp) stamp1; - IntegerStamp b = (IntegerStamp) stamp2; - assert a.getBits() == b.getBits(); - return stampForMask(a.getBits(), a.downMask() | b.downMask(), a.upMask() | b.upMask()); - } + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + return n.asLong() == 0; + } + }, + + new BinaryOp.Xor(true, true) { - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - return n.asLong() == 0; - } - }, + @Override + public Constant foldConstant(Constant const1, Constant const2) { + PrimitiveConstant a = (PrimitiveConstant) const1; + PrimitiveConstant b = (PrimitiveConstant) const2; + assert a.getJavaKind() == b.getJavaKind(); + return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() ^ b.asLong()); + } - new BinaryOp.Xor(true, true) { + @Override + public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { + IntegerStamp a = (IntegerStamp) stamp1; + IntegerStamp b = (IntegerStamp) stamp2; + assert a.getBits() == b.getBits(); - @Override - public Constant foldConstant(Constant const1, Constant const2) { - PrimitiveConstant a = (PrimitiveConstant) const1; - PrimitiveConstant b = (PrimitiveConstant) const2; - assert a.getJavaKind() == b.getJavaKind(); - return JavaConstant.forIntegerKind(a.getJavaKind(), a.asLong() ^ b.asLong()); - } + long variableBits = (a.downMask() ^ a.upMask()) | (b.downMask() ^ b.upMask()); + long newDownMask = (a.downMask() ^ b.downMask()) & ~variableBits; + long newUpMask = (a.downMask() ^ b.downMask()) | variableBits; + return stampForMask(a.getBits(), newDownMask, newUpMask); + } - @Override - public Stamp foldStamp(Stamp stamp1, Stamp stamp2) { - IntegerStamp a = (IntegerStamp) stamp1; - IntegerStamp b = (IntegerStamp) stamp2; - assert a.getBits() == b.getBits(); + @Override + public boolean isNeutral(Constant value) { + PrimitiveConstant n = (PrimitiveConstant) value; + return n.asLong() == 0; + } - long variableBits = (a.downMask() ^ a.upMask()) | (b.downMask() ^ b.upMask()); - long newDownMask = (a.downMask() ^ b.downMask()) & ~variableBits; - long newUpMask = (a.downMask() ^ b.downMask()) | variableBits; - return stampForMask(a.getBits(), newDownMask, newUpMask); - } + @Override + public Constant getZero(Stamp s) { + IntegerStamp stamp = (IntegerStamp) s; + return JavaConstant.forPrimitiveInt(stamp.getBits(), 0); + } + }, - @Override - public boolean isNeutral(Constant value) { - PrimitiveConstant n = (PrimitiveConstant) value; - return n.asLong() == 0; - } + new ShiftOp.Shl() { - @Override - public Constant getZero(Stamp s) { - IntegerStamp stamp = (IntegerStamp) s; - return JavaConstant.forPrimitiveInt(stamp.getBits(), 0); - } - }, - - new ShiftOp.Shl() { + @Override + public Constant foldConstant(Constant value, int amount) { + PrimitiveConstant c = (PrimitiveConstant) value; + switch (c.getJavaKind()) { + case Int: + return JavaConstant.forInt(c.asInt() << amount); + case Long: + return JavaConstant.forLong(c.asLong() << amount); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Constant foldConstant(Constant value, int amount) { - PrimitiveConstant c = (PrimitiveConstant) value; - switch (c.getJavaKind()) { - case Int: - return JavaConstant.forInt(c.asInt() << amount); - case Long: - return JavaConstant.forLong(c.asLong() << amount); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Stamp foldStamp(Stamp stamp, IntegerStamp shift) { + IntegerStamp value = (IntegerStamp) stamp; + int bits = value.getBits(); + long defaultMask = CodeUtil.mask(bits); + if (value.upMask() == 0) { + return value; + } + int shiftMask = getShiftAmountMask(stamp); + int shiftBits = Integer.bitCount(shiftMask); + if (shift.lowerBound() == shift.upperBound()) { + int shiftAmount = (int) (shift.lowerBound() & shiftMask); + if (shiftAmount == 0) { + return value; + } + // the mask of bits that will be lost or shifted into the sign bit + long removedBits = -1L << (bits - shiftAmount - 1); + if ((value.lowerBound() & removedBits) == 0 && (value.upperBound() & removedBits) == 0) { + /* + * use a better stamp if neither lower nor upper bound can lose + * bits + */ + return new IntegerStamp(bits, value.lowerBound() << shiftAmount, value.upperBound() << shiftAmount, value.downMask() << shiftAmount, value.upMask() << shiftAmount); + } + } + if ((shift.lowerBound() >>> shiftBits) == (shift.upperBound() >>> shiftBits)) { + long downMask = defaultMask; + long upMask = 0; + for (long i = shift.lowerBound(); i <= shift.upperBound(); i++) { + if (shift.contains(i)) { + downMask &= value.downMask() << (i & shiftMask); + upMask |= value.upMask() << (i & shiftMask); + } + } + Stamp result = IntegerStamp.stampForMask(bits, downMask, upMask & defaultMask); + return result; + } + return value.unrestricted(); + } - @Override - public Stamp foldStamp(Stamp stamp, IntegerStamp shift) { - IntegerStamp value = (IntegerStamp) stamp; - int bits = value.getBits(); - long defaultMask = CodeUtil.mask(bits); - if (value.upMask() == 0) { - return value; - } - int shiftMask = getShiftAmountMask(stamp); - int shiftBits = Integer.bitCount(shiftMask); - if (shift.lowerBound() == shift.upperBound()) { - int shiftAmount = (int) (shift.lowerBound() & shiftMask); - if (shiftAmount == 0) { - return value; - } - // the mask of bits that will be lost or shifted into the sign bit - long removedBits = -1L << (bits - shiftAmount - 1); - if ((value.lowerBound() & removedBits) == 0 && (value.upperBound() & removedBits) == 0) { - // use a better stamp if neither lower nor upper bound can lose bits - return new IntegerStamp(bits, value.lowerBound() << shiftAmount, value.upperBound() << shiftAmount, value.downMask() << shiftAmount, value.upMask() << shiftAmount); - } - } - if ((shift.lowerBound() >>> shiftBits) == (shift.upperBound() >>> shiftBits)) { - long downMask = defaultMask; - long upMask = 0; - for (long i = shift.lowerBound(); i <= shift.upperBound(); i++) { - if (shift.contains(i)) { - downMask &= value.downMask() << (i & shiftMask); - upMask |= value.upMask() << (i & shiftMask); - } - } - Stamp result = IntegerStamp.stampForMask(bits, downMask, upMask & defaultMask); - return result; - } - return value.unrestricted(); - } + @Override + public int getShiftAmountMask(Stamp s) { + IntegerStamp stamp = (IntegerStamp) s; + assert CodeUtil.isPowerOf2(stamp.getBits()); + return stamp.getBits() - 1; + } + }, + + new ShiftOp.Shr() { - @Override - public int getShiftAmountMask(Stamp s) { - IntegerStamp stamp = (IntegerStamp) s; - assert CodeUtil.isPowerOf2(stamp.getBits()); - return stamp.getBits() - 1; - } - }, - - new ShiftOp.Shr() { + @Override + public Constant foldConstant(Constant value, int amount) { + PrimitiveConstant c = (PrimitiveConstant) value; + switch (c.getJavaKind()) { + case Int: + return JavaConstant.forInt(c.asInt() >> amount); + case Long: + return JavaConstant.forLong(c.asLong() >> amount); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public Constant foldConstant(Constant value, int amount) { - PrimitiveConstant c = (PrimitiveConstant) value; - switch (c.getJavaKind()) { - case Int: - return JavaConstant.forInt(c.asInt() >> amount); - case Long: - return JavaConstant.forLong(c.asLong() >> amount); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + @Override + public Stamp foldStamp(Stamp stamp, IntegerStamp shift) { + IntegerStamp value = (IntegerStamp) stamp; + int bits = value.getBits(); + if (shift.lowerBound() == shift.upperBound()) { + long shiftCount = shift.lowerBound() & getShiftAmountMask(stamp); + if (shiftCount == 0) { + return stamp; + } - @Override - public Stamp foldStamp(Stamp stamp, IntegerStamp shift) { - IntegerStamp value = (IntegerStamp) stamp; - int bits = value.getBits(); - if (shift.lowerBound() == shift.upperBound()) { - long shiftCount = shift.lowerBound() & getShiftAmountMask(stamp); - if (shiftCount == 0) { - return stamp; - } + int extraBits = 64 - bits; + long defaultMask = CodeUtil.mask(bits); + // shifting back and forth performs sign extension + long downMask = (value.downMask() << extraBits) >> (shiftCount + extraBits) & defaultMask; + long upMask = (value.upMask() << extraBits) >> (shiftCount + extraBits) & defaultMask; + return new IntegerStamp(bits, value.lowerBound() >> shiftCount, value.upperBound() >> shiftCount, downMask, upMask); + } + long mask = IntegerStamp.upMaskFor(bits, value.lowerBound(), value.upperBound()); + return IntegerStamp.stampForMask(bits, 0, mask); + } + + @Override + public int getShiftAmountMask(Stamp s) { + IntegerStamp stamp = (IntegerStamp) s; + assert CodeUtil.isPowerOf2(stamp.getBits()); + return stamp.getBits() - 1; + } + }, + + new ShiftOp.UShr() { - int extraBits = 64 - bits; - long defaultMask = CodeUtil.mask(bits); - // shifting back and forth performs sign extension - long downMask = (value.downMask() << extraBits) >> (shiftCount + extraBits) & defaultMask; - long upMask = (value.upMask() << extraBits) >> (shiftCount + extraBits) & defaultMask; - return new IntegerStamp(bits, value.lowerBound() >> shiftCount, value.upperBound() >> shiftCount, downMask, upMask); - } - long mask = IntegerStamp.upMaskFor(bits, value.lowerBound(), value.upperBound()); - return IntegerStamp.stampForMask(bits, 0, mask); - } + @Override + public Constant foldConstant(Constant value, int amount) { + PrimitiveConstant c = (PrimitiveConstant) value; + switch (c.getJavaKind()) { + case Int: + return JavaConstant.forInt(c.asInt() >>> amount); + case Long: + return JavaConstant.forLong(c.asLong() >>> amount); + default: + throw JVMCIError.shouldNotReachHere(); + } + } - @Override - public int getShiftAmountMask(Stamp s) { - IntegerStamp stamp = (IntegerStamp) s; - assert CodeUtil.isPowerOf2(stamp.getBits()); - return stamp.getBits() - 1; - } - }, - - new ShiftOp.UShr() { + @Override + public Stamp foldStamp(Stamp stamp, IntegerStamp shift) { + IntegerStamp value = (IntegerStamp) stamp; + int bits = value.getBits(); + if (shift.lowerBound() == shift.upperBound()) { + long shiftCount = shift.lowerBound() & getShiftAmountMask(stamp); + if (shiftCount == 0) { + return stamp; + } - @Override - public Constant foldConstant(Constant value, int amount) { - PrimitiveConstant c = (PrimitiveConstant) value; - switch (c.getJavaKind()) { - case Int: - return JavaConstant.forInt(c.asInt() >>> amount); - case Long: - return JavaConstant.forLong(c.asLong() >>> amount); - default: - throw JVMCIError.shouldNotReachHere(); - } - } + long downMask = value.downMask() >>> shiftCount; + long upMask = value.upMask() >>> shiftCount; + if (value.lowerBound() < 0) { + return new IntegerStamp(bits, downMask, upMask, downMask, upMask); + } else { + return new IntegerStamp(bits, value.lowerBound() >>> shiftCount, value.upperBound() >>> shiftCount, downMask, upMask); + } + } + long mask = IntegerStamp.upMaskFor(bits, value.lowerBound(), value.upperBound()); + return IntegerStamp.stampForMask(bits, 0, mask); + } - @Override - public Stamp foldStamp(Stamp stamp, IntegerStamp shift) { - IntegerStamp value = (IntegerStamp) stamp; - int bits = value.getBits(); - if (shift.lowerBound() == shift.upperBound()) { - long shiftCount = shift.lowerBound() & getShiftAmountMask(stamp); - if (shiftCount == 0) { - return stamp; - } + @Override + public int getShiftAmountMask(Stamp s) { + IntegerStamp stamp = (IntegerStamp) s; + assert CodeUtil.isPowerOf2(stamp.getBits()); + return stamp.getBits() - 1; + } + }, + + new UnaryOp.Abs() { - long downMask = value.downMask() >>> shiftCount; - long upMask = value.upMask() >>> shiftCount; - if (value.lowerBound() < 0) { - return new IntegerStamp(bits, downMask, upMask, downMask, upMask); - } else { - return new IntegerStamp(bits, value.lowerBound() >>> shiftCount, value.upperBound() >>> shiftCount, downMask, upMask); - } - } - long mask = IntegerStamp.upMaskFor(bits, value.lowerBound(), value.upperBound()); - return IntegerStamp.stampForMask(bits, 0, mask); - } + @Override + public Constant foldConstant(Constant value) { + PrimitiveConstant c = (PrimitiveConstant) value; + return JavaConstant.forIntegerKind(c.getJavaKind(), Math.abs(c.asLong())); + } - @Override - public int getShiftAmountMask(Stamp s) { - IntegerStamp stamp = (IntegerStamp) s; - assert CodeUtil.isPowerOf2(stamp.getBits()); - return stamp.getBits() - 1; - } - }, + @Override + public Stamp foldStamp(Stamp input) { + IntegerStamp stamp = (IntegerStamp) input; + int bits = stamp.getBits(); + if (stamp.lowerBound() == CodeUtil.minValue(bits)) { + return input.unrestricted(); + } else { + long limit = Math.max(-stamp.lowerBound(), stamp.upperBound()); + return StampFactory.forInteger(bits, 0, limit); + } + } + }, - new UnaryOp.Abs() { + null, - @Override - public Constant foldConstant(Constant value) { - PrimitiveConstant c = (PrimitiveConstant) value; - return JavaConstant.forIntegerKind(c.getJavaKind(), Math.abs(c.asLong())); - } + new IntegerConvertOp.ZeroExtend() { - @Override - public Stamp foldStamp(Stamp input) { - IntegerStamp stamp = (IntegerStamp) input; - int bits = stamp.getBits(); - if (stamp.lowerBound() == CodeUtil.minValue(bits)) { - return input.unrestricted(); - } else { - long limit = Math.max(-stamp.lowerBound(), stamp.upperBound()); - return StampFactory.forInteger(bits, 0, limit); - } - } - }, + @Override + public Constant foldConstant(int inputBits, int resultBits, Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forPrimitiveInt(resultBits, CodeUtil.zeroExtend(value.asLong(), inputBits)); + } - null, + @Override + public Stamp foldStamp(int inputBits, int resultBits, Stamp input) { + IntegerStamp stamp = (IntegerStamp) input; + assert inputBits == stamp.getBits(); + assert inputBits <= resultBits; - new IntegerConvertOp.ZeroExtend() { + long downMask = CodeUtil.zeroExtend(stamp.downMask(), inputBits); + long upMask = CodeUtil.zeroExtend(stamp.upMask(), inputBits); - @Override - public Constant foldConstant(int inputBits, int resultBits, Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forPrimitiveInt(resultBits, CodeUtil.zeroExtend(value.asLong(), inputBits)); - } - - @Override - public Stamp foldStamp(int inputBits, int resultBits, Stamp input) { - IntegerStamp stamp = (IntegerStamp) input; - assert inputBits == stamp.getBits(); - assert inputBits <= resultBits; + if (stamp.lowerBound() < 0 && stamp.upperBound() >= 0) { + /* signed range including 0 and -1 */ + /* + * after sign extension, the whole range from 0 to MAX_INT is + * possible + */ + return IntegerStamp.stampForMask(resultBits, downMask, upMask); + } - long downMask = CodeUtil.zeroExtend(stamp.downMask(), inputBits); - long upMask = CodeUtil.zeroExtend(stamp.upMask(), inputBits); + long lowerBound = CodeUtil.zeroExtend(stamp.lowerBound(), inputBits); + long upperBound = CodeUtil.zeroExtend(stamp.upperBound(), inputBits); - if (stamp.lowerBound() < 0 && stamp.upperBound() >= 0) { - // signed range including 0 and -1 - // after sign extension, the whole range from 0 to MAX_INT is possible - return IntegerStamp.stampForMask(resultBits, downMask, upMask); - } + return new IntegerStamp(resultBits, lowerBound, upperBound, downMask, upMask); + } + }, - long lowerBound = CodeUtil.zeroExtend(stamp.lowerBound(), inputBits); - long upperBound = CodeUtil.zeroExtend(stamp.upperBound(), inputBits); + new IntegerConvertOp.SignExtend() { - return new IntegerStamp(resultBits, lowerBound, upperBound, downMask, upMask); - } - }, - - new IntegerConvertOp.SignExtend() { + @Override + public Constant foldConstant(int inputBits, int resultBits, Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forPrimitiveInt(resultBits, CodeUtil.signExtend(value.asLong(), inputBits)); + } - @Override - public Constant foldConstant(int inputBits, int resultBits, Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forPrimitiveInt(resultBits, CodeUtil.signExtend(value.asLong(), inputBits)); - } + @Override + public Stamp foldStamp(int inputBits, int resultBits, Stamp input) { + IntegerStamp stamp = (IntegerStamp) input; + assert inputBits == stamp.getBits(); + assert inputBits <= resultBits; - @Override - public Stamp foldStamp(int inputBits, int resultBits, Stamp input) { - IntegerStamp stamp = (IntegerStamp) input; - assert inputBits == stamp.getBits(); - assert inputBits <= resultBits; + long defaultMask = CodeUtil.mask(resultBits); + long downMask = CodeUtil.signExtend(stamp.downMask(), inputBits) & defaultMask; + long upMask = CodeUtil.signExtend(stamp.upMask(), inputBits) & defaultMask; - long defaultMask = CodeUtil.mask(resultBits); - long downMask = CodeUtil.signExtend(stamp.downMask(), inputBits) & defaultMask; - long upMask = CodeUtil.signExtend(stamp.upMask(), inputBits) & defaultMask; + return new IntegerStamp(resultBits, stamp.lowerBound(), stamp.upperBound(), downMask, upMask); + } + }, - return new IntegerStamp(resultBits, stamp.lowerBound(), stamp.upperBound(), downMask, upMask); - } - }, - - new IntegerConvertOp.Narrow() { + new IntegerConvertOp.Narrow() { - @Override - public Constant foldConstant(int inputBits, int resultBits, Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forPrimitiveInt(resultBits, CodeUtil.narrow(value.asLong(), resultBits)); - } + @Override + public Constant foldConstant(int inputBits, int resultBits, Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forPrimitiveInt(resultBits, CodeUtil.narrow(value.asLong(), resultBits)); + } - @Override - public Stamp foldStamp(int inputBits, int resultBits, Stamp input) { - IntegerStamp stamp = (IntegerStamp) input; - assert inputBits == stamp.getBits(); - assert resultBits <= inputBits; - if (resultBits == inputBits) { - return stamp; - } + @Override + public Stamp foldStamp(int inputBits, int resultBits, Stamp input) { + IntegerStamp stamp = (IntegerStamp) input; + assert inputBits == stamp.getBits(); + assert resultBits <= inputBits; + if (resultBits == inputBits) { + return stamp; + } - final long upperBound; - if (stamp.lowerBound() < CodeUtil.minValue(resultBits)) { - upperBound = CodeUtil.maxValue(resultBits); - } else { - upperBound = saturate(stamp.upperBound(), resultBits); - } - final long lowerBound; - if (stamp.upperBound() > CodeUtil.maxValue(resultBits)) { - lowerBound = CodeUtil.minValue(resultBits); - } else { - lowerBound = saturate(stamp.lowerBound(), resultBits); - } + final long upperBound; + if (stamp.lowerBound() < CodeUtil.minValue(resultBits)) { + upperBound = CodeUtil.maxValue(resultBits); + } else { + upperBound = saturate(stamp.upperBound(), resultBits); + } + final long lowerBound; + if (stamp.upperBound() > CodeUtil.maxValue(resultBits)) { + lowerBound = CodeUtil.minValue(resultBits); + } else { + lowerBound = saturate(stamp.lowerBound(), resultBits); + } - long defaultMask = CodeUtil.mask(resultBits); - long newDownMask = stamp.downMask() & defaultMask; - long newUpMask = stamp.upMask() & defaultMask; - long newLowerBound = CodeUtil.signExtend((lowerBound | newDownMask) & newUpMask, resultBits); - long newUpperBound = CodeUtil.signExtend((upperBound | newDownMask) & newUpMask, resultBits); - return new IntegerStamp(resultBits, newLowerBound, newUpperBound, newDownMask, newUpMask); - } - }, + long defaultMask = CodeUtil.mask(resultBits); + long newDownMask = stamp.downMask() & defaultMask; + long newUpMask = stamp.upMask() & defaultMask; + long newLowerBound = CodeUtil.signExtend((lowerBound | newDownMask) & newUpMask, resultBits); + long newUpperBound = CodeUtil.signExtend((upperBound | newDownMask) & newUpMask, resultBits); + return new IntegerStamp(resultBits, newLowerBound, newUpperBound, newDownMask, newUpMask); + } + }, - new FloatConvertOp(I2F) { + new FloatConvertOp(I2F) { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forFloat(value.asInt()); - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forFloat(value.asInt()); + } - @Override - public Stamp foldStamp(Stamp input) { - IntegerStamp stamp = (IntegerStamp) input; - assert stamp.getBits() == 32; - float lowerBound = stamp.lowerBound(); - float upperBound = stamp.upperBound(); - return StampFactory.forFloat(JavaKind.Float, lowerBound, upperBound, true); - } - }, + @Override + public Stamp foldStamp(Stamp input) { + IntegerStamp stamp = (IntegerStamp) input; + assert stamp.getBits() == 32; + float lowerBound = stamp.lowerBound(); + float upperBound = stamp.upperBound(); + return StampFactory.forFloat(JavaKind.Float, lowerBound, upperBound, true); + } + }, - new FloatConvertOp(L2F) { + new FloatConvertOp(L2F) { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forFloat(value.asLong()); - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forFloat(value.asLong()); + } - @Override - public Stamp foldStamp(Stamp input) { - IntegerStamp stamp = (IntegerStamp) input; - assert stamp.getBits() == 64; - float lowerBound = stamp.lowerBound(); - float upperBound = stamp.upperBound(); - return StampFactory.forFloat(JavaKind.Float, lowerBound, upperBound, true); - } - }, + @Override + public Stamp foldStamp(Stamp input) { + IntegerStamp stamp = (IntegerStamp) input; + assert stamp.getBits() == 64; + float lowerBound = stamp.lowerBound(); + float upperBound = stamp.upperBound(); + return StampFactory.forFloat(JavaKind.Float, lowerBound, upperBound, true); + } + }, - new FloatConvertOp(I2D) { + new FloatConvertOp(I2D) { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forDouble(value.asInt()); - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forDouble(value.asInt()); + } - @Override - public Stamp foldStamp(Stamp input) { - IntegerStamp stamp = (IntegerStamp) input; - assert stamp.getBits() == 32; - double lowerBound = stamp.lowerBound(); - double upperBound = stamp.upperBound(); - return StampFactory.forFloat(JavaKind.Double, lowerBound, upperBound, true); - } - }, + @Override + public Stamp foldStamp(Stamp input) { + IntegerStamp stamp = (IntegerStamp) input; + assert stamp.getBits() == 32; + double lowerBound = stamp.lowerBound(); + double upperBound = stamp.upperBound(); + return StampFactory.forFloat(JavaKind.Double, lowerBound, upperBound, true); + } + }, - new FloatConvertOp(L2D) { + new FloatConvertOp(L2D) { - @Override - public Constant foldConstant(Constant c) { - PrimitiveConstant value = (PrimitiveConstant) c; - return JavaConstant.forDouble(value.asLong()); - } + @Override + public Constant foldConstant(Constant c) { + PrimitiveConstant value = (PrimitiveConstant) c; + return JavaConstant.forDouble(value.asLong()); + } - @Override - public Stamp foldStamp(Stamp input) { - IntegerStamp stamp = (IntegerStamp) input; - assert stamp.getBits() == 64; - double lowerBound = stamp.lowerBound(); - double upperBound = stamp.upperBound(); - return StampFactory.forFloat(JavaKind.Double, lowerBound, upperBound, true); - } - }); + @Override + public Stamp foldStamp(Stamp input) { + IntegerStamp stamp = (IntegerStamp) input; + assert stamp.getBits() == 64; + double lowerBound = stamp.lowerBound(); + double upperBound = stamp.upperBound(); + return StampFactory.forFloat(JavaKind.Double, lowerBound, upperBound, true); + } + }); } diff -r 3bc2598ce1e0 -r 93349d4b852e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_idea.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_idea.java Mon Jan 25 15:03:43 2016 -0800 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_idea.java Mon Jan 25 15:50:03 2016 -0800 @@ -60,7 +60,7 @@ /* * buildTestData - * + * * Builds the data used for the test -- each time the test is run. */ @@ -115,7 +115,7 @@ /* * calcEncryptKey - * + * * Builds the 52 16-bit encryption subkeys Z[] from the user key and stores in 32-bit int array. * The routing corrects an error in the source code in the Schnier book. Basically, the sense of * the 7- and 9-bit shifts are reversed. It still works reversed, but would encrypted code would @@ -151,7 +151,7 @@ j = i % 8; if (j < 6) { Z[i] = ((Z[i - 7] >>> 9) | (Z[i - 6] << 7)) // Shift and combine. - & 0xFFFF; // Just 16 bits. + & 0xFFFF; // Just 16 bits. continue; // Next iteration. } @@ -169,7 +169,7 @@ /* * calcDecryptKey - * + * * Builds the 52 16-bit encryption subkeys DK[] from the encryption- subkeys Z[]. DK[] is a * 32-bit int array holding 16-bit values as unsigned. */ @@ -216,7 +216,7 @@ /* * cipher_idea - * + * * IDEA encryption/decryption algorithm. It processes plaintext in 64-bit blocks, one at a time, * breaking the block into four 16-bit unsigned subblocks. It goes through eight rounds of * processing using 6 new subkeys each time, plus four for last step. The source text is in @@ -359,7 +359,7 @@ /* * mul - * + * * Performs multiplication, modulo (2**16)+1. This code is structured on the assumption that * untaken branches are cheaper than taken branches, and that the compiler doesn't schedule * branches. Java: Must work with 32-bit int and one 64-bit long to keep 16-bit values and their @@ -369,7 +369,7 @@ * zero whenever the result would zero, be 2**16. And if one of the multiplicands is 0, the * result is not zero, but (2**16) + 1 minus the other multiplicand (sort of an additive inverse * mod 0x10001). - * + * * NOTE: The java conversion of this routine works correctly, but is half the speed of using * Java's modulus division function (%) on the multiplication with a 16-bit masking of the * result--running in the Symantec Caje IDE. So it's not called for now; the test uses Java % @@ -380,7 +380,7 @@ * private int mul(int a, int b) throws ArithmeticException { long p; // Large enough to catch * 16-bit multiply // without hitting sign bit. if (a != 0) { if (b != 0) { p = (long) a * b; b * = (int) p & 0xFFFF; // Lower 16 bits. a = (int) p >>> 16; // Upper 16 bits. - * + * * return (b - a + (b < a ? 1 : 0) & 0xFFFF); } else return ((1 - a) & 0xFFFF); // If b = 0, * then same as // 0x10001 - a. } else // If a = 0, then return return((1 - b) & 0xFFFF); // * same as 0x10001 - b. } @@ -388,7 +388,7 @@ /* * inv - * + * * Compute multiplicative inverse of x, modulo (2**16)+1 using extended Euclid's GCD (greatest * common divisor) algorithm. It is unrolled twice to avoid swapping the meaning of the * registers. And some subtracts are changed to adds. Java: Though it uses signed 32-bit ints, @@ -439,7 +439,7 @@ /* * freeTestData - * + * * Nulls arrays and forces garbage collection to free up memory. */ diff -r 3bc2598ce1e0 -r 93349d4b852e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/BigMixedParams04.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/BigMixedParams04.java Mon Jan 25 15:03:43 2016 -0800 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/BigMixedParams04.java Mon Jan 25 15:50:03 2016 -0800 @@ -64,7 +64,7 @@ */ @SuppressWarnings("all") public static double test2(int i1, float f1, double d2, float f3, - // @formatter:off +// @formatter:off double ad1, double ad2, double ad3, @@ -98,7 +98,7 @@ float af15, float af16 // @formatter:on - ) { + ) { // now do something with the locals to make sure the locals don't get optimized away. for (int i = 0; i < i1; i++) { @@ -186,7 +186,7 @@ */ @SuppressWarnings("all") public static double test3(boolean f, int idx, - // @formatter:off +// @formatter:off double ad1, double ad2, double ad3, diff -r 3bc2598ce1e0 -r 93349d4b852e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java Mon Jan 25 15:03:43 2016 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java Mon Jan 25 15:50:03 2016 -0800 @@ -212,9 +212,9 @@ * processed in live sets. Process them only in debug mode so that this can * be checked */ - verifyTemp(liveKill, operand); - } - }; + verifyTemp(liveKill, operand); + } + }; // iterate all instructions of the block for (int j = 0; j < numInst; j++) { @@ -331,7 +331,7 @@ /* * liveIn(block) is the union of liveGen(block) with (liveOut(block) & * !liveKill(block)). - * + * * Note: liveIn has to be computed only in first iteration or if liveOut * has changed! */ @@ -586,19 +586,19 @@ Interval to = allocator.getOrCreateInterval((AllocatableValue) targetValue); /* hints always point from def to use */ - if (hintAtDef) { - to.setLocationHint(from); - } else { - from.setLocationHint(to); - } - if (Debug.isLogEnabled()) { - Debug.log("operation at opId %d: added hint from interval %d to %d", op.id(), from.operandNumber, to.operandNumber); - } + if (hintAtDef) { + to.setLocationHint(from); + } else { + from.setLocationHint(to); + } + if (Debug.isLogEnabled()) { + Debug.log("operation at opId %d: added hint from interval %d to %d", op.id(), from.operandNumber, to.operandNumber); + } - return registerHint; - } - return null; - }); + return registerHint; + } + return null; + }); } } diff -r 3bc2598ce1e0 -r 93349d4b852e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/lsra/TraceLinearScanLifetimeAnalysisPhase.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/lsra/TraceLinearScanLifetimeAnalysisPhase.java Mon Jan 25 15:03:43 2016 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/lsra/TraceLinearScanLifetimeAnalysisPhase.java Mon Jan 25 15:50:03 2016 -0800 @@ -334,22 +334,22 @@ /* * TODO (je): clean up */ - final AllocatableValue fromValue; - final AllocatableValue toValue; - /* hints always point from def to use */ - if (hintAtDef) { - fromValue = (AllocatableValue) registerHint; - toValue = (AllocatableValue) targetValue; - } else { - fromValue = (AllocatableValue) targetValue; - toValue = (AllocatableValue) registerHint; - } - Debug.log("addRegisterHint %s to %s", fromValue, toValue); - final TraceInterval to; - final IntervalHint from; - if (isRegister(toValue)) { - if (isRegister(fromValue)) { - // fixed to fixed move + final AllocatableValue fromValue; + final AllocatableValue toValue; + /* hints always point from def to use */ + if (hintAtDef) { + fromValue = (AllocatableValue) registerHint; + toValue = (AllocatableValue) targetValue; + } else { + fromValue = (AllocatableValue) targetValue; + toValue = (AllocatableValue) registerHint; + } + Debug.log("addRegisterHint %s to %s", fromValue, toValue); + final TraceInterval to; + final IntervalHint from; + if (isRegister(toValue)) { + if (isRegister(fromValue)) { + // fixed to fixed move return null; } from = getIntervalHint(toValue); diff -r 3bc2598ce1e0 -r 93349d4b852e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/FixPointIntervalBuilder.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/FixPointIntervalBuilder.java Mon Jan 25 15:03:43 2016 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/FixPointIntervalBuilder.java Mon Jan 25 15:50:03 2016 -0800 @@ -256,19 +256,19 @@ StackInterval to = getOrCreateInterval(targetValue); /* hints always point from def to use */ - if (hintAtDef) { - to.setLocationHint(from); - } else { - from.setLocationHint(to); - } - if (Debug.isLogEnabled()) { - Debug.log("operation %s at opId %d: added hint from interval %d to %d", op, op.id(), from, to); - } + if (hintAtDef) { + to.setLocationHint(from); + } else { + from.setLocationHint(to); + } + if (Debug.isLogEnabled()) { + Debug.log("operation %s at opId %d: added hint from interval %d to %d", op, op.id(), from, to); + } - return registerHint; - } - return null; - }); + return registerHint; + } + return null; + }); } } diff -r 3bc2598ce1e0 -r 93349d4b852e graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/BytecodeInterpreterPartialEvaluationTest.java --- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/BytecodeInterpreterPartialEvaluationTest.java Mon Jan 25 15:03:43 2016 -0800 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/BytecodeInterpreterPartialEvaluationTest.java Mon Jan 25 15:50:03 2016 -0800 @@ -234,194 +234,194 @@ @Test public void constReturnProgram() { byte[] bytecodes = new byte[]{ - /* 0: */Bytecode.CONST, - /* 1: */42, - /* 2: */Bytecode.RETURN}; + /* 0: */Bytecode.CONST, + /* 1: */42, + /* 2: */Bytecode.RETURN}; assertPartialEvalEqualsAndRunsCorrect(new Program("constReturnProgram", bytecodes, 0, 2)); } @Test public void constAddProgram() { byte[] bytecodes = new byte[]{ - /* 0: */Bytecode.CONST, - /* 1: */40, - /* 2: */Bytecode.CONST, - /* 3: */2, - /* 4: */Bytecode.ADD, - /* 5: */Bytecode.RETURN}; + /* 0: */Bytecode.CONST, + /* 1: */40, + /* 2: */Bytecode.CONST, + /* 3: */2, + /* 4: */Bytecode.ADD, + /* 5: */Bytecode.RETURN}; assertPartialEvalEqualsAndRunsCorrect(new Program("constAddProgram", bytecodes, 0, 2)); } @Test public void simpleIfProgram() { byte[] bytecodes = new byte[]{ - /* 0: */Bytecode.CONST, - /* 1: */40, - /* 2: */Bytecode.CONST, - /* 3: */1, - /* 4: */Bytecode.IFZERO, - /* 5: */8, - /* 6: */Bytecode.CONST, - /* 7: */42, - /* 8: */Bytecode.RETURN}; + /* 0: */Bytecode.CONST, + /* 1: */40, + /* 2: */Bytecode.CONST, + /* 3: */1, + /* 4: */Bytecode.IFZERO, + /* 5: */8, + /* 6: */Bytecode.CONST, + /* 7: */42, + /* 8: */Bytecode.RETURN}; assertPartialEvalEqualsAndRunsCorrect(new Program("simpleIfProgram", bytecodes, 0, 3)); } @Test public void ifAndPopProgram() { byte[] bytecodes = new byte[]{ - /* 0: */Bytecode.CONST, - /* 1: */40, - /* 2: */Bytecode.CONST, - /* 3: */1, - /* 4: */Bytecode.IFZERO, - /* 5: */9, - /* 6: */Bytecode.POP, - /* 7: */Bytecode.CONST, - /* 8: */42, - /* 9: */Bytecode.RETURN}; + /* 0: */Bytecode.CONST, + /* 1: */40, + /* 2: */Bytecode.CONST, + /* 3: */1, + /* 4: */Bytecode.IFZERO, + /* 5: */9, + /* 6: */Bytecode.POP, + /* 7: */Bytecode.CONST, + /* 8: */42, + /* 9: */Bytecode.RETURN}; assertPartialEvalEqualsAndRunsCorrect(new Program("ifAndPopProgram", bytecodes, 0, 3)); } @Test public void simpleLoopProgram() { byte[] bytecodes = new byte[]{ - /* 0: */Bytecode.CONST, - /* 1: */42, - /* 2: */Bytecode.CONST, - /* 3: */-12, - /* 4: */Bytecode.CONST, - /* 5: */1, - /* 6: */Bytecode.ADD, - /* 7: */Bytecode.DUP, - /* 8: */Bytecode.IFZERO, - /* 9: */12, - /* 10: */Bytecode.JMP, - /* 11: */4, - /* 12: */Bytecode.POP, - /* 13: */Bytecode.RETURN}; + /* 0: */Bytecode.CONST, + /* 1: */42, + /* 2: */Bytecode.CONST, + /* 3: */-12, + /* 4: */Bytecode.CONST, + /* 5: */1, + /* 6: */Bytecode.ADD, + /* 7: */Bytecode.DUP, + /* 8: */Bytecode.IFZERO, + /* 9: */12, + /* 10: */Bytecode.JMP, + /* 11: */4, + /* 12: */Bytecode.POP, + /* 13: */Bytecode.RETURN}; assertPartialEvalEqualsAndRunsCorrect(new Program("simpleLoopProgram", bytecodes, 0, 3)); } @Test public void nestedLoopsProgram() { byte[] bytecodes = new byte[]{ - /* 0: */Bytecode.CONST, - /* 1: */42, - /* 2: */Bytecode.CONST, - /* 3: */-2, - /* 4: */Bytecode.CONST, - /* 5: */1, - /* 6: */Bytecode.ADD, - /* 7: */Bytecode.DUP, - /* 8: */Bytecode.CONST, - /* 9: */-2, - /* 10: */Bytecode.CONST, - /* 11: */1, - /* 12: */Bytecode.ADD, - /* 13: */Bytecode.DUP, - /* 14: */Bytecode.IFZERO, - /* 15: */18, - /* 16: */Bytecode.JMP, - /* 17: */10, - /* 18: */Bytecode.POP, - /* 19: */Bytecode.IFZERO, - /* 20: */23, - /* 21: */Bytecode.JMP, - /* 22: */4, - /* 23: */Bytecode.POP, - /* 24: */Bytecode.RETURN}; + /* 0: */Bytecode.CONST, + /* 1: */42, + /* 2: */Bytecode.CONST, + /* 3: */-2, + /* 4: */Bytecode.CONST, + /* 5: */1, + /* 6: */Bytecode.ADD, + /* 7: */Bytecode.DUP, + /* 8: */Bytecode.CONST, + /* 9: */-2, + /* 10: */Bytecode.CONST, + /* 11: */1, + /* 12: */Bytecode.ADD, + /* 13: */Bytecode.DUP, + /* 14: */Bytecode.IFZERO, + /* 15: */18, + /* 16: */Bytecode.JMP, + /* 17: */10, + /* 18: */Bytecode.POP, + /* 19: */Bytecode.IFZERO, + /* 20: */23, + /* 21: */Bytecode.JMP, + /* 22: */4, + /* 23: */Bytecode.POP, + /* 24: */Bytecode.RETURN}; assertPartialEvalEqualsAndRunsCorrect(new Program("nestedLoopsProgram", bytecodes, 0, 6)); } @Test public void nestedLoopsProgram2() { byte[] bytecodes = new byte[]{ - /* 0: */Bytecode.CONST, - /* 1: */42, - /* 2: */Bytecode.CONST, - /* 3: */-2, - /* 4: */Bytecode.CONST, - /* 5: */1, - /* 6: */Bytecode.ADD, - /* 7: */Bytecode.DUP, - /* 8: */Bytecode.CONST, - /* 9: */-2, + /* 0: */Bytecode.CONST, + /* 1: */42, + /* 2: */Bytecode.CONST, + /* 3: */-2, + /* 4: */Bytecode.CONST, + /* 5: */1, + /* 6: */Bytecode.ADD, + /* 7: */Bytecode.DUP, + /* 8: */Bytecode.CONST, + /* 9: */-2, - /* 10: */Bytecode.CONST, - /* 11: */0, - /* 12: */Bytecode.IFZERO, - /* 13: */17, - /* 14: */Bytecode.POP, - /* 15: */Bytecode.JMP, - /* 16: */30, + /* 10: */Bytecode.CONST, + /* 11: */0, + /* 12: */Bytecode.IFZERO, + /* 13: */17, + /* 14: */Bytecode.POP, + /* 15: */Bytecode.JMP, + /* 16: */30, - /* 17: */Bytecode.CONST, - /* 18: */1, - /* 19: */Bytecode.ADD, - /* 10: */Bytecode.DUP, - /* 21: */Bytecode.IFZERO, - /* 22: */25, - /* 23: */Bytecode.JMP, - /* 24: */10, - /* 25: */Bytecode.POP, - /* 26: */Bytecode.IFZERO, - /* 27: */30, - /* 28: */Bytecode.JMP, - /* 29: */4, - /* 30: */Bytecode.POP, - /* 31: */Bytecode.RETURN}; + /* 17: */Bytecode.CONST, + /* 18: */1, + /* 19: */Bytecode.ADD, + /* 10: */Bytecode.DUP, + /* 21: */Bytecode.IFZERO, + /* 22: */25, + /* 23: */Bytecode.JMP, + /* 24: */10, + /* 25: */Bytecode.POP, + /* 26: */Bytecode.IFZERO, + /* 27: */30, + /* 28: */Bytecode.JMP, + /* 29: */4, + /* 30: */Bytecode.POP, + /* 31: */Bytecode.RETURN}; assertPartialEvalEqualsAndRunsCorrect(new Program("nestedLoopsProgram2", bytecodes, 0, 6)); } @Test(timeout = 2000) public void manyIfsProgram() { byte[] bytecodes = new byte[]{ - /* 0: */Bytecode.CONST, - /* 1: */40, - /* 2: */Bytecode.CONST, - /* 3: */1, - /* 4: */Bytecode.IFZERO, - /* 5: */8, - /* 6: */Bytecode.CONST, - /* 7: */1, - /* 8: */Bytecode.IFZERO, - /* 9: */12, - /* 10: */Bytecode.CONST, - /* 11: */1, - /* 12: */Bytecode.IFZERO, - /* 13: */16, - /* 14: */Bytecode.CONST, - /* 15: */1, - /* 16: */Bytecode.IFZERO, - /* 17: */20, - /* 18: */Bytecode.CONST, - /* 19: */1, - /* 20: */Bytecode.IFZERO, - /* 21: */24, - /* 22: */Bytecode.CONST, - /* 23: */1, - /* 24: */Bytecode.IFZERO, - /* 25: */28, - /* 26: */Bytecode.CONST, - /* 27: */1, - /* 28: */Bytecode.IFZERO, - /* 29: */32, - /* 30: */Bytecode.CONST, - /* 31: */1, - /* 32: */Bytecode.IFZERO, - /* 33: */36, - /* 34: */Bytecode.CONST, - /* 35: */1, - /* 36: */Bytecode.IFZERO, - /* 37: */40, - /* 38: */Bytecode.CONST, - /* 39: */1, - /* 40: */Bytecode.IFZERO, - /* 41: */44, - /* 42: */Bytecode.CONST, - /* 43: */42, - /* 44: */Bytecode.RETURN}; + /* 0: */Bytecode.CONST, + /* 1: */40, + /* 2: */Bytecode.CONST, + /* 3: */1, + /* 4: */Bytecode.IFZERO, + /* 5: */8, + /* 6: */Bytecode.CONST, + /* 7: */1, + /* 8: */Bytecode.IFZERO, + /* 9: */12, + /* 10: */Bytecode.CONST, + /* 11: */1, + /* 12: */Bytecode.IFZERO, + /* 13: */16, + /* 14: */Bytecode.CONST, + /* 15: */1, + /* 16: */Bytecode.IFZERO, + /* 17: */20, + /* 18: */Bytecode.CONST, + /* 19: */1, + /* 20: */Bytecode.IFZERO, + /* 21: */24, + /* 22: */Bytecode.CONST, + /* 23: */1, + /* 24: */Bytecode.IFZERO, + /* 25: */28, + /* 26: */Bytecode.CONST, + /* 27: */1, + /* 28: */Bytecode.IFZERO, + /* 29: */32, + /* 30: */Bytecode.CONST, + /* 31: */1, + /* 32: */Bytecode.IFZERO, + /* 33: */36, + /* 34: */Bytecode.CONST, + /* 35: */1, + /* 36: */Bytecode.IFZERO, + /* 37: */40, + /* 38: */Bytecode.CONST, + /* 39: */1, + /* 40: */Bytecode.IFZERO, + /* 41: */44, + /* 42: */Bytecode.CONST, + /* 43: */42, + /* 44: */Bytecode.RETURN}; assertPartialEvalEqualsAndRunsCorrect(new Program("manyIfsProgram", bytecodes, 0, 3)); } @@ -576,12 +576,12 @@ FrameSlot valueSlot = fd.addFrameSlot("value", FrameSlotKind.Int); FrameSlot returnSlot = fd.addFrameSlot("return", FrameSlotKind.Int); Inst[] inst = new Inst[]{ - /* 0: */new Inst.Const(valueSlot, 1, 1), - /* 1: */new Inst.IfZero(valueSlot, 2, 4), - /* 2: */new Inst.Const(returnSlot, 41, 3), - /* 3: */new Inst.Return(), - /* 4: */new Inst.Const(returnSlot, 42, 5), - /* 5: */new Inst.Return()}; + /* 0: */new Inst.Const(valueSlot, 1, 1), + /* 1: */new Inst.IfZero(valueSlot, 2, 4), + /* 2: */new Inst.Const(returnSlot, 41, 3), + /* 3: */new Inst.Return(), + /* 4: */new Inst.Const(returnSlot, 42, 5), + /* 5: */new Inst.Return()}; assertPartialEvalEqualsAndRunsCorrect(new InstArrayProgram("instArraySimpleIfProgram", inst, returnSlot, fd)); } @@ -589,21 +589,21 @@ @SuppressWarnings("try") public void simpleSwitchProgram() { byte[] bytecodes = new byte[]{ - /* 0: */Bytecode.CONST, - /* 1: */1, - /* 2: */Bytecode.SWITCH, - /* 3: */2, - /* 4: */9, - /* 5: */12, - /* 6: */Bytecode.CONST, - /* 7: */40, - /* 8: */Bytecode.RETURN, - /* 9: */Bytecode.CONST, - /* 10: */41, - /* 11: */Bytecode.RETURN, - /* 12: */Bytecode.CONST, - /* 13: */42, - /* 14: */Bytecode.RETURN}; + /* 0: */Bytecode.CONST, + /* 1: */1, + /* 2: */Bytecode.SWITCH, + /* 3: */2, + /* 4: */9, + /* 5: */12, + /* 6: */Bytecode.CONST, + /* 7: */40, + /* 8: */Bytecode.RETURN, + /* 9: */Bytecode.CONST, + /* 10: */41, + /* 11: */Bytecode.RETURN, + /* 12: */Bytecode.CONST, + /* 13: */42, + /* 14: */Bytecode.RETURN}; Program program = new Program("simpleSwitchProgram", bytecodes, 0, 3); assertPartialEvalEqualsAndRunsCorrect(program); } @@ -612,18 +612,18 @@ @SuppressWarnings("try") public void loopSwitchProgram() { byte[] bytecodes = new byte[]{ - /* 0: */Bytecode.CONST, - /* 1: */1, - /* 2: */Bytecode.SWITCH, - /* 3: */2, - /* 4: */0, - /* 5: */9, - /* 6: */Bytecode.CONST, - /* 7: */40, - /* 8: */Bytecode.RETURN, - /* 9: */Bytecode.CONST, - /* 10: */42, - /* 11: */Bytecode.RETURN}; + /* 0: */Bytecode.CONST, + /* 1: */1, + /* 2: */Bytecode.SWITCH, + /* 3: */2, + /* 4: */0, + /* 5: */9, + /* 6: */Bytecode.CONST, + /* 7: */40, + /* 8: */Bytecode.RETURN, + /* 9: */Bytecode.CONST, + /* 10: */42, + /* 11: */Bytecode.RETURN}; Program program = new Program("loopSwitchProgram", bytecodes, 0, 3); assertPartialEvalEqualsAndRunsCorrect(program); } diff -r 3bc2598ce1e0 -r 93349d4b852e graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/SafepointRethrowDeoptPETest.java --- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/SafepointRethrowDeoptPETest.java Mon Jan 25 15:03:43 2016 -0800 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/SafepointRethrowDeoptPETest.java Mon Jan 25 15:50:03 2016 -0800 @@ -208,12 +208,12 @@ /* spin */ } /* Thread.sleep(100); */ - compiledMethod.invalidate(); - } catch (InterruptedException e) { - Assert.fail("interrupted"); - } - terminate = 1; - }); + compiledMethod.invalidate(); + } catch (InterruptedException e) { + Assert.fail("interrupted"); + } + terminate = 1; + }); Thread t2 = new Thread(() -> { cdl.countDown(); Object result = compiledMethod.call();