diff --git a/src/codegen/target/x86/fixup.cpp b/src/codegen/target/x86/fixup.cpp index ba0a06f906..294780fae5 100644 --- a/src/codegen/target/x86/fixup.cpp +++ b/src/codegen/target/x86/fixup.cpp @@ -33,15 +33,15 @@ ResolvedPromise* resolvedPromise(Context* c, int64_t value) { return new(c->zone) ResolvedPromise(value); } -Offset::Offset(Context* c, MyBlock* block, unsigned offset, AlignmentPadding* limit): +OffsetPromise::OffsetPromise(Context* c, MyBlock* block, unsigned offset, AlignmentPadding* limit): c(c), block(block), offset(offset), limit(limit), value_(-1) { } -bool Offset::resolved() { +bool OffsetPromise::resolved() { return block->start != static_cast(~0); } -int64_t Offset::value() { +int64_t OffsetPromise::value() { assert(c, resolved()); if (value_ == -1) { @@ -52,7 +52,7 @@ int64_t Offset::value() { return value_; } Promise* offsetPromise(Context* c) { - return new(c->zone) Offset(c, c->lastBlock, c->code.length(), c->lastBlock->lastPadding); + return new(c->zone) OffsetPromise(c, c->lastBlock, c->code.length(), c->lastBlock->lastPadding); } void* diff --git a/src/codegen/target/x86/fixup.h b/src/codegen/target/x86/fixup.h index 78f77b3044..fa170bb542 100644 --- a/src/codegen/target/x86/fixup.h +++ b/src/codegen/target/x86/fixup.h @@ -29,9 +29,18 @@ class AlignmentPadding; ResolvedPromise* resolvedPromise(Context* c, int64_t value); -class Offset: public Promise { +class Task { public: - Offset(Context* c, MyBlock* block, unsigned offset, AlignmentPadding* limit); + Task(Task* next): next(next) { } + + virtual void run(Context* c) = 0; + + Task* next; +}; + +class OffsetPromise: public Promise { + public: + OffsetPromise(Context* c, MyBlock* block, unsigned offset, AlignmentPadding* limit); virtual bool resolved(); @@ -46,16 +55,6 @@ class Offset: public Promise { Promise* offsetPromise(Context* c); - -class Task { - public: - Task(Task* next): next(next) { } - - virtual void run(Context* c) = 0; - - Task* next; -}; - void* resolveOffset(vm::System* s, uint8_t* instruction, unsigned instructionSize, int64_t value); class OffsetListener: public Promise::Listener {