fix 64-bit constant comparisons on 32-bit platforms

This commit is contained in:
Joel Dice 2010-12-20 18:08:52 -07:00
parent 5d5a18c482
commit 857dcd13e7
2 changed files with 16 additions and 3 deletions

View File

@ -4741,9 +4741,17 @@ class BranchEvent: public Event {
if (not unreachable(this)) { if (not unreachable(this)) {
if (firstConstant and secondConstant) { if (firstConstant and secondConstant) {
if (shouldJump(c, type, size, firstConstant->value->value(), int64_t firstValue = firstConstant->value->value();
secondConstant->value->value())) int64_t secondValue = secondConstant->value->value();
{
if (size > BytesPerWord) {
firstValue |= findConstantSite
(c, first->nextWord)->value->value() << 32;
secondValue |= findConstantSite
(c, second->nextWord)->value->value() << 32;
}
if (shouldJump(c, type, size, firstValue, secondValue)) {
apply(c, Jump, BytesPerWord, address->source, address->source); apply(c, Jump, BytesPerWord, address->source, address->source);
} }
} else { } else {

View File

@ -60,6 +60,11 @@ public class Longs {
} }
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
{ long a = 0x1FFFFFFFFL;
long b = -1;
expect(a != b);
}
expect(Math.abs(-123L) == 123L); expect(Math.abs(-123L) == 123L);
expect(readLongFrom(new java.io.InputStream() { expect(readLongFrom(new java.io.InputStream() {