Make fixups reference any constant (allow const float/double pool literals). This avoids doing getConstantSym to avoid hitting the global context's getConstantSym during emitIAS(), which may be desirable for multi-threading, since each function's emitIAS() should be able to happen on a separate thread. The stringification is moved till later, so it still happens, just without creating a constant relocatable w/ offset of 0. This ends up tickling an issue where -O0 on 252.eon now gets 2x as many page faults, and I'm not sure exactly why. This makes the overall time higher, though emit time is lower. When translating with -O2 # of page faults is about the same before/after, so that oddness is restricted to O0. Before this change, tweaking the slab size at O0 doesn't seem to affect as drastically as 2x swings either. To work around this, I turned the slab size of the assembler down to 32KB. === Move all the .L$type$poolid into a function (replacing getPoolEntryID). BUG=none R=stichnot@chromium.org Review URL: https://codereview.chromium.org/837553009
diff --git a/src/assembler_ia32.cpp b/src/assembler_ia32.cpp index 30b84e8..8feb7fe 100644 --- a/src/assembler_ia32.cpp +++ b/src/assembler_ia32.cpp
@@ -31,31 +31,21 @@ public: static DirectCallRelocation *create(Assembler *Asm, FixupKind Kind, - const ConstantRelocatable *Sym) { + const Constant *Sym) { return new (Asm->Allocate<DirectCallRelocation>()) DirectCallRelocation(Kind, Sym); } private: - DirectCallRelocation(FixupKind Kind, const ConstantRelocatable *Sym) + DirectCallRelocation(FixupKind Kind, const Constant *Sym) : AssemblerFixup(Kind, Sym) {} }; -Address Address::ofConstPool(GlobalContext *Ctx, Assembler *Asm, - const Constant *Imm) { - // We should make this much lighter-weight. E.g., just record the const pool - // entry ID. - std::string Buffer; - llvm::raw_string_ostream StrBuf(Buffer); - Type Ty = Imm->getType(); - assert(llvm::isa<ConstantFloat>(Imm) || llvm::isa<ConstantDouble>(Imm)); - StrBuf << ".L$" << Ty << "$" << Imm->getPoolEntryID(); +Address Address::ofConstPool(Assembler *Asm, const Constant *Imm) { + AssemblerFixup *Fixup = + x86::DisplacementRelocation::create(Asm, FK_Abs_4, Imm); const RelocOffsetT Offset = 0; - const bool SuppressMangling = true; - Constant *Sym = Ctx->getConstantSym(Offset, StrBuf.str(), SuppressMangling); - AssemblerFixup *Fixup = x86::DisplacementRelocation::create( - Asm, FK_Abs_4, llvm::cast<ConstantRelocatable>(Sym)); - return x86::Address::Absolute(Fixup); + return x86::Address::Absolute(Offset, Fixup); } AssemblerX86::~AssemblerX86() {