From 13fae991fde585f5eb4165f74a408ff7d02df6ec Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 11 Jan 2008 09:44:16 -0700 Subject: [PATCH] resolve address operands only when writing the final output --- src/compiler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler.cpp b/src/compiler.cpp index 6a2740a6ec..e8393b7bf1 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -1467,7 +1467,7 @@ RegisterOperand::accept(Context* c, Operation op, ImmediateOperand* value(Context* c, AddressOperand* operand) { - if (operand->promise->resolved(c)) { + if (c->codeLength and operand->promise->resolved(c)) { return immediate(c, operand->promise->value(c)); } else { return immediate(c, 0); @@ -1544,7 +1544,7 @@ RegisterOperand::accept(Context* c, Operation op, ImmediateOperand* value(Context* c, AbsoluteOperand* operand) { - if (operand->promise->resolved(c)) { + if (c->codeLength and operand->promise->resolved(c)) { return immediate(c, operand->promise->value(c)); } else { return immediate(c, 0); @@ -1582,7 +1582,7 @@ void unconditional(Context* c, unsigned jump, AddressOperand* operand) { intptr_t v; - if (operand->promise->resolved(c)) { + if (c->codeLength and operand->promise->resolved(c)) { uint8_t* instruction = c->code.data + c->code.length(); v = reinterpret_cast(operand->promise->value(c)) - instruction - 5; @@ -1600,7 +1600,7 @@ void conditional(Context* c, unsigned condition, AddressOperand* operand) { intptr_t v; - if (operand->promise->resolved(c)) { + if (c->codeLength and operand->promise->resolved(c)) { uint8_t* instruction = c->code.data + c->code.length(); v = reinterpret_cast(operand->promise->value(c)) - instruction - 6;