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

Unified Diff: src/PNaClTranslator.cpp

Issue 1776473007: Subzero. Allocate global initializers from a dedicated arena. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Removes global variable (and initializer) allocation methods from GlobalContext. Created 4 years, 9 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 | « src/IceTargetLoweringARM32.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 595b2340eb515b1ed3878e3596ebecc26e2bded0..74e7b7472021ccc2935ec016ab6ed37e7a29912e 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -257,6 +257,11 @@ public:
size_t getNumTypeIDValues() const { return TypeIDValues.size(); }
+ /// Returns a pointer to the pool where globals are allocated.
+ Ice::VariableDeclarationList *getGlobalVariablesPool() {
+ return VariableDeclarations.get();
+ }
+
/// Returns the undefined type associated with type ID. Note: Returns extended
/// type ready to be defined.
ExtendedType *getTypeByIDForDefining(NaClBcIndexSize_t ID) {
@@ -1021,9 +1026,11 @@ public:
: BlockParserBaseClass(BlockID, EnclosingParser),
Timer(Ice::TimerStack::TT_parseGlobals, getTranslator().getContext()),
NumFunctionIDs(Context->getNumFunctionIDs()),
- DummyGlobalVar(
- Ice::VariableDeclaration::create(getTranslator().getContext())),
- CurGlobalVar(DummyGlobalVar) {}
+ DummyGlobalVar(Ice::VariableDeclaration::create(
+ Context->getGlobalVariablesPool())),
+ CurGlobalVar(DummyGlobalVar) {
+ Context->getGlobalVariablesPool()->willNotBeEmitted(DummyGlobalVar);
+ }
~GlobalsParser() final = default;
@@ -1063,7 +1070,8 @@ private:
Ice::VariableDeclaration *getGlobalVarByID(NaClBcIndexSize_t Index) {
Ice::VariableDeclaration *&Decl = GlobalVarsMap[Index];
if (Decl == nullptr)
- Decl = Ice::VariableDeclaration::create(getTranslator().getContext());
+ Decl =
+ Ice::VariableDeclaration::create(Context->getGlobalVariablesPool());
return Decl;
}
@@ -1173,16 +1181,18 @@ void GlobalsParser::ProcessRecord() {
// ZEROFILL: [size]
if (!isValidRecordSize(1, "zerofill"))
return;
+ auto *Pool = Context->getGlobalVariablesPool();
CurGlobalVar->addInitializer(
- Ice::VariableDeclaration::ZeroInitializer::create(Values[0]));
+ Ice::VariableDeclaration::ZeroInitializer::create(Pool, Values[0]));
return;
}
case naclbitc::GLOBALVAR_DATA: {
// DATA: [b0, b1, ...]
if (!isValidRecordSizeAtLeast(1, "data"))
return;
+ auto *Pool = Context->getGlobalVariablesPool();
CurGlobalVar->addInitializer(
- Ice::VariableDeclaration::DataInitializer::create(Values));
+ Ice::VariableDeclaration::DataInitializer::create(Pool, Values));
return;
}
case naclbitc::GLOBALVAR_RELOC: {
@@ -1208,10 +1218,12 @@ void GlobalsParser::ProcessRecord() {
Error(StrBuf.str());
}
}
+ auto *Pool = Context->getGlobalVariablesPool();
Ice::GlobalContext *Ctx = getTranslator().getContext();
CurGlobalVar->addInitializer(
Ice::VariableDeclaration::RelocInitializer::create(
- getGlobalDeclByID(Index), {Ice::RelocOffset::create(Ctx, Offset)}));
+ Pool, getGlobalDeclByID(Index),
+ {Ice::RelocOffset::create(Ctx, Offset)}));
return;
}
default:
« no previous file with comments | « src/IceTargetLoweringARM32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698