Subzero. Allocate global initializers from a dedicated arena.
This allows Subzero to release the global initializers once they've been
lowered.
This CL also modifies the global initializer types to ensure they are
trivially destructible -- therefore not requiring destructors to run.
BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4360
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/1776473007 .
diff --git a/src/IceTargetLoweringARM32.cpp b/src/IceTargetLoweringARM32.cpp
index e3f46ea..9b76976 100644
--- a/src/IceTargetLoweringARM32.cpp
+++ b/src/IceTargetLoweringARM32.cpp
@@ -908,15 +908,19 @@
"GOTOFF$" + Func->getFunctionName() + "$" + CRName;
if (KnownGotoffs.count(CRGotoffName) == 0) {
constexpr bool SuppressMangling = true;
- auto *Global = VariableDeclaration::create(Ctx, SuppressMangling);
+ auto *Global =
+ VariableDeclaration::create(Func->getGlobalPool(), SuppressMangling);
Global->setIsConstant(true);
Global->setName(CRName);
+ Func->getGlobalPool()->willNotBeEmitted(Global);
- auto *Gotoff = VariableDeclaration::create(Ctx, SuppressMangling);
+ auto *Gotoff =
+ VariableDeclaration::create(Func->getGlobalPool(), SuppressMangling);
constexpr auto GotFixup = R_ARM_GOTOFF32;
Gotoff->setIsConstant(true);
Gotoff->addInitializer(VariableDeclaration::RelocInitializer::create(
- Global, {RelocOffset::create(Ctx, 0)}, GotFixup));
+ Func->getGlobalPool(), Global, {RelocOffset::create(Ctx, 0)},
+ GotFixup));
Gotoff->setName(CRGotoffName);
Func->addGlobal(Gotoff);
KnownGotoffs.emplace(CRGotoffName);