fix predicate used to determine whether to resolve address operands

This commit is contained in:
Joel Dice 2008-01-11 11:11:31 -07:00
parent 570925ad0e
commit a56c0ad2ef

View File

@ -1467,7 +1467,7 @@ RegisterOperand::accept(Context* c, Operation op,
ImmediateOperand* ImmediateOperand*
value(Context* c, AddressOperand* operand) value(Context* c, AddressOperand* operand)
{ {
if (c->codeLength and operand->promise->resolved(c)) { if (c->codeLength >= 0 and operand->promise->resolved(c)) {
return immediate(c, operand->promise->value(c)); return immediate(c, operand->promise->value(c));
} else { } else {
return immediate(c, 0); return immediate(c, 0);
@ -1544,7 +1544,7 @@ RegisterOperand::accept(Context* c, Operation op,
ImmediateOperand* ImmediateOperand*
value(Context* c, AbsoluteOperand* operand) value(Context* c, AbsoluteOperand* operand)
{ {
if (c->codeLength and operand->promise->resolved(c)) { if (c->codeLength >= 0 and operand->promise->resolved(c)) {
return immediate(c, operand->promise->value(c)); return immediate(c, operand->promise->value(c));
} else { } else {
return immediate(c, 0); return immediate(c, 0);
@ -1582,7 +1582,7 @@ void
unconditional(Context* c, unsigned jump, AddressOperand* operand) unconditional(Context* c, unsigned jump, AddressOperand* operand)
{ {
intptr_t v; intptr_t v;
if (c->codeLength and operand->promise->resolved(c)) { if (c->codeLength >= 0 and operand->promise->resolved(c)) {
uint8_t* instruction = c->code.data + c->code.length(); uint8_t* instruction = c->code.data + c->code.length();
v = reinterpret_cast<uint8_t*>(operand->promise->value(c)) v = reinterpret_cast<uint8_t*>(operand->promise->value(c))
- instruction - 5; - instruction - 5;
@ -1600,7 +1600,7 @@ void
conditional(Context* c, unsigned condition, AddressOperand* operand) conditional(Context* c, unsigned condition, AddressOperand* operand)
{ {
intptr_t v; intptr_t v;
if (c->codeLength and operand->promise->resolved(c)) { if (c->codeLength >= 0 and operand->promise->resolved(c)) {
uint8_t* instruction = c->code.data + c->code.length(); uint8_t* instruction = c->code.data + c->code.length();
v = reinterpret_cast<uint8_t*>(operand->promise->value(c)) v = reinterpret_cast<uint8_t*>(operand->promise->value(c))
- instruction - 6; - instruction - 6;