Commit 1a9043e7 by John Porto

Fixes a bug in that caused IceAssembler to use Allocator before it was initialized.

Initializes IceAssembler::Allocator before IceAssembler::Buffer. BUG= None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1177843006.
parent aff4ccf9
......@@ -156,8 +156,8 @@ class Assembler {
public:
Assembler()
: Buffer(*this), FunctionName(""), IsInternal(false),
Preliminary(false) {}
: Allocator(), FunctionName(""), IsInternal(false), Preliminary(false),
Buffer(*this) {}
virtual ~Assembler() = default;
// Allocate a chunk of bytes using the per-Assembler allocator.
......@@ -212,9 +212,6 @@ public:
void setPreliminary(bool Value) { Preliminary = Value; }
bool getPreliminary() const { return Preliminary; }
protected:
AssemblerBuffer Buffer;
private:
ArenaAllocator<32 * 1024> Allocator;
// FunctionName and IsInternal are transferred from the original Cfg
......@@ -227,6 +224,12 @@ private:
// final pass where all changes to label bindings, label links, and
// relocation fixups are fully committed (Preliminary=false).
bool Preliminary;
protected:
// Buffer's constructor uses the Allocator, so it needs to appear after it.
// TODO(jpp): dependencies on construction order are a nice way of shooting
// yourself in the foot. Fix this.
AssemblerBuffer Buffer;
};
} // end of namespace Ice
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment