Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: src/IceAssembler.h

Issue 1177843006: Fixes a bug in that caused IceAssembler to use Allocator before it was initialized. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceAssembler.h
diff --git a/src/IceAssembler.h b/src/IceAssembler.h
index 131b62a0bb9677faf5751a87f474c0c256ad0550..55ef088fa9ff4945f87e074a9616b1ce77933e7d 100644
--- a/src/IceAssembler.h
+++ b/src/IceAssembler.h
@@ -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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698