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

Unified Diff: src/IceCfg.cpp

Issue 802183004: Subzero: Use CFG-local arena allocation for relevant containers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Typo fix Created 6 years 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 | « src/IceCfg.h ('k') | src/IceConverter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfg.cpp
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index a328d21fccf4202e449fe5a7620fa0dacbb78eab..59723ec277ddd86570058ff0194a0a2f210f5993 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -23,11 +23,17 @@
namespace Ice {
+thread_local const Cfg *Cfg::CurrentCfg = NULL;
+
+ArenaAllocator *getCurrentCfgAllocator() {
+ return Cfg::getCurrentCfgAllocator();
+}
+
Cfg::Cfg(GlobalContext *Ctx)
: Ctx(Ctx), FunctionName(""), ReturnType(IceType_void),
IsInternalLinkage(false), HasError(false), FocusedTiming(false),
ErrorMessage(""), Entry(NULL), NextInstNumber(Inst::NumberInitial),
- Live(nullptr),
+ Allocator(new ArenaAllocator()), Live(nullptr),
Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)),
VMetadata(new VariablesMetadata(this)),
TargetAssembler(
@@ -37,7 +43,13 @@ Cfg::Cfg(GlobalContext *Ctx)
"Attempt to build cfg when IR generation disabled");
}
-Cfg::~Cfg() {}
+Cfg::~Cfg() {
+ // TODO(stichnot,kschimpf): Set CurrentCfg=NULL in the dtor for
+ // safety. This can't be done currently because the translator
+ // manages the Cfg by creating a new Cfg (which sets CurrentCfg to
+ // the new value), then deleting the old Cfg (which would then reset
+ // CurrentCfg to NULL).
+}
void Cfg::setError(const IceString &Message) {
HasError = true;
« no previous file with comments | « src/IceCfg.h ('k') | src/IceConverter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698