From 30f1a3c6289075ef4af08f5ec502be2fc8627a0c Mon Sep 17 00:00:00 2001 From: Merry Date: Tue, 30 Jan 2024 17:22:43 +0000 Subject: [PATCH] Avoid emplace. --- src/dynarmic/backend/arm64/abi.cpp | 2 +- src/dynarmic/backend/arm64/address_space.cpp | 8 ++++---- src/dynarmic/backend/arm64/fastmem.h | 2 +- src/dynarmic/backend/arm64/reg_alloc.cpp | 16 ++++++++-------- src/dynarmic/backend/x64/a32_emit_x64.cpp | 6 +++--- src/dynarmic/backend/x64/a64_emit_x64.cpp | 6 +++--- src/dynarmic/backend/x64/constant_pool.cpp | 2 +- src/dynarmic/backend/x64/emit_x64.cpp | 4 ++-- src/dynarmic/backend/x64/emit_x64_memory.cpp.inc | 2 +- src/dynarmic/common/memory_pool.cpp | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/dynarmic/backend/arm64/abi.cpp b/src/dynarmic/backend/arm64/abi.cpp index e6913f0d..6d7b9637 100644 --- a/src/dynarmic/backend/arm64/abi.cpp +++ b/src/dynarmic/backend/arm64/abi.cpp @@ -30,7 +30,7 @@ static std::vector ListToIndexes(u32 list) { std::vector indexes; for (int i = 0; i < 32; i++) { if (mcl::bit::get_bit(i, list)) { - indexes.emplace_back(i); + indexes.push_back(i); } } return indexes; diff --git a/src/dynarmic/backend/arm64/address_space.cpp b/src/dynarmic/backend/arm64/address_space.cpp index 4ba579f0..10df477d 100644 --- a/src/dynarmic/backend/arm64/address_space.cpp +++ b/src/dynarmic/backend/arm64/address_space.cpp @@ -105,9 +105,9 @@ EmittedBlockInfo AddressSpace::Emit(IR::Block block) { EmittedBlockInfo block_info = EmitArm64(code, std::move(block), GetEmitConfig(), fastmem_manager); - ASSERT(block_entries.emplace(block.Location(), block_info.entry_point).second); - ASSERT(reverse_block_entries.emplace(block_info.entry_point, block.Location()).second); - ASSERT(block_infos.emplace(block_info.entry_point, block_info).second); + ASSERT(block_entries.insert({block.Location(), block_info.entry_point}).second); + ASSERT(reverse_block_entries.insert({block_info.entry_point, block.Location()}).second); + ASSERT(block_infos.insert({block_info.entry_point, block_info}).second); Link(block_info); RelinkForDescriptor(block.Location(), block_info.entry_point); @@ -255,7 +255,7 @@ void AddressSpace::Link(EmittedBlockInfo& block_info) { } for (auto [target_descriptor, list] : block_info.block_relocations) { - block_references[target_descriptor].emplace(block_info.entry_point); + block_references[target_descriptor].insert(block_info.entry_point); LinkBlockLinks(block_info.entry_point, Get(target_descriptor), list); } } diff --git a/src/dynarmic/backend/arm64/fastmem.h b/src/dynarmic/backend/arm64/fastmem.h index 74abb45a..8ed686ae 100644 --- a/src/dynarmic/backend/arm64/fastmem.h +++ b/src/dynarmic/backend/arm64/fastmem.h @@ -45,7 +45,7 @@ public: } void MarkDoNotFastmem(DoNotFastmemMarker marker) { - do_not_fastmem.emplace(marker); + do_not_fastmem.insert(marker); } private: diff --git a/src/dynarmic/backend/arm64/reg_alloc.cpp b/src/dynarmic/backend/arm64/reg_alloc.cpp index c3cad3d1..fedee02f 100644 --- a/src/dynarmic/backend/arm64/reg_alloc.cpp +++ b/src/dynarmic/backend/arm64/reg_alloc.cpp @@ -97,7 +97,7 @@ void HostLocInfo::SetupScratchLocation() { void HostLocInfo::SetupLocation(const IR::Inst* value) { ASSERT(IsCompletelyEmpty()); values.clear(); - values.emplace_back(value); + values.push_back(value); realized = true; uses_this_inst = 0; accumulated_uses = 0; @@ -189,7 +189,7 @@ void RegAlloc::PrepareForCall(std::optional arg0, } void RegAlloc::DefineAsExisting(IR::Inst* inst, Argument& arg) { - defined_insts.emplace(inst); + defined_insts.insert(inst); ASSERT(!ValueLocation(inst)); @@ -199,17 +199,17 @@ void RegAlloc::DefineAsExisting(IR::Inst* inst, Argument& arg) { } auto& info = ValueInfo(arg.value.GetInst()); - info.values.emplace_back(inst); + info.values.push_back(inst); info.expected_uses += inst->UseCount(); } void RegAlloc::DefineAsRegister(IR::Inst* inst, oaknut::Reg reg) { - defined_insts.emplace(inst); + defined_insts.insert(inst); ASSERT(!ValueLocation(inst)); auto& info = reg.is_vector() ? fprs[reg.index()] : gprs[reg.index()]; ASSERT(info.IsCompletelyEmpty()); - info.values.emplace_back(inst); + info.values.push_back(inst); info.expected_uses += inst->UseCount(); } @@ -373,7 +373,7 @@ int RegAlloc::RealizeReadImpl(const IR::Value& value) { template int RegAlloc::RealizeWriteImpl(const IR::Inst* value) { - defined_insts.emplace(value); + defined_insts.insert(value); ASSERT(!ValueLocation(value)); @@ -398,7 +398,7 @@ int RegAlloc::RealizeWriteImpl(const IR::Inst* value) { template int RegAlloc::RealizeReadWriteImpl(const IR::Value& read_value, const IR::Inst* write_value) { - defined_insts.emplace(write_value); + defined_insts.insert(write_value); // TODO: Move elimination @@ -462,7 +462,7 @@ void RegAlloc::SpillFpr(int index) { } void RegAlloc::ReadWriteFlags(Argument& read, IR::Inst* write) { - defined_insts.emplace(write); + defined_insts.insert(write); const auto current_location = ValueLocation(read.value.GetInst()); ASSERT(current_location); diff --git a/src/dynarmic/backend/x64/a32_emit_x64.cpp b/src/dynarmic/backend/x64/a32_emit_x64.cpp index ce52c52c..fc8e8bae 100644 --- a/src/dynarmic/backend/x64/a32_emit_x64.cpp +++ b/src/dynarmic/backend/x64/a32_emit_x64.cpp @@ -1166,7 +1166,7 @@ void A32EmitX64::EmitTerminalImpl(IR::Term::LinkBlock terminal, IR::LocationDesc if (conf.enable_cycle_counting) { code.cmp(qword[rsp + ABI_SHADOW_SPACE + offsetof(StackLayout, cycles_remaining)], 0); - patch_information[terminal.next].jg.emplace_back(code.getCurr()); + patch_information[terminal.next].jg.push_back(code.getCurr()); if (const auto next_bb = GetBasicBlock(terminal.next)) { EmitPatchJg(terminal.next, next_bb->entrypoint); } else { @@ -1175,7 +1175,7 @@ void A32EmitX64::EmitTerminalImpl(IR::Term::LinkBlock terminal, IR::LocationDesc } else { code.cmp(dword[r15 + offsetof(A32JitState, halt_reason)], 0); - patch_information[terminal.next].jz.emplace_back(code.getCurr()); + patch_information[terminal.next].jz.push_back(code.getCurr()); if (const auto next_bb = GetBasicBlock(terminal.next)) { EmitPatchJz(terminal.next, next_bb->entrypoint); } else { @@ -1197,7 +1197,7 @@ void A32EmitX64::EmitTerminalImpl(IR::Term::LinkBlockFast terminal, IR::Location return; } - patch_information[terminal.next].jmp.emplace_back(code.getCurr()); + patch_information[terminal.next].jmp.push_back(code.getCurr()); if (const auto next_bb = GetBasicBlock(terminal.next)) { EmitPatchJmp(terminal.next, next_bb->entrypoint); } else { diff --git a/src/dynarmic/backend/x64/a64_emit_x64.cpp b/src/dynarmic/backend/x64/a64_emit_x64.cpp index 99ee090d..cec78138 100644 --- a/src/dynarmic/backend/x64/a64_emit_x64.cpp +++ b/src/dynarmic/backend/x64/a64_emit_x64.cpp @@ -620,7 +620,7 @@ void A64EmitX64::EmitTerminalImpl(IR::Term::LinkBlock terminal, IR::LocationDesc if (conf.enable_cycle_counting) { code.cmp(qword[rsp + ABI_SHADOW_SPACE + offsetof(StackLayout, cycles_remaining)], 0); - patch_information[terminal.next].jg.emplace_back(code.getCurr()); + patch_information[terminal.next].jg.push_back(code.getCurr()); if (const auto next_bb = GetBasicBlock(terminal.next)) { EmitPatchJg(terminal.next, next_bb->entrypoint); } else { @@ -629,7 +629,7 @@ void A64EmitX64::EmitTerminalImpl(IR::Term::LinkBlock terminal, IR::LocationDesc } else { code.cmp(dword[r15 + offsetof(A64JitState, halt_reason)], 0); - patch_information[terminal.next].jz.emplace_back(code.getCurr()); + patch_information[terminal.next].jz.push_back(code.getCurr()); if (const auto next_bb = GetBasicBlock(terminal.next)) { EmitPatchJz(terminal.next, next_bb->entrypoint); } else { @@ -650,7 +650,7 @@ void A64EmitX64::EmitTerminalImpl(IR::Term::LinkBlockFast terminal, IR::Location return; } - patch_information[terminal.next].jmp.emplace_back(code.getCurr()); + patch_information[terminal.next].jmp.push_back(code.getCurr()); if (auto next_bb = GetBasicBlock(terminal.next)) { EmitPatchJmp(terminal.next, next_bb->entrypoint); } else { diff --git a/src/dynarmic/backend/x64/constant_pool.cpp b/src/dynarmic/backend/x64/constant_pool.cpp index 443cb4c0..ba003262 100644 --- a/src/dynarmic/backend/x64/constant_pool.cpp +++ b/src/dynarmic/backend/x64/constant_pool.cpp @@ -29,7 +29,7 @@ Xbyak::Address ConstantPool::GetConstant(const Xbyak::AddressFrame& frame, u64 l ASSERT(insertion_point < pool.size()); ConstantT& target_constant = pool[insertion_point]; target_constant = constant; - iter = constant_info.emplace(constant, &target_constant).first; + iter = constant_info.insert({constant, &target_constant}).first; ++insertion_point; } return frame[code.rip + iter->second]; diff --git a/src/dynarmic/backend/x64/emit_x64.cpp b/src/dynarmic/backend/x64/emit_x64.cpp index fac6c089..902ddef9 100644 --- a/src/dynarmic/backend/x64/emit_x64.cpp +++ b/src/dynarmic/backend/x64/emit_x64.cpp @@ -88,7 +88,7 @@ void EmitX64::PushRSBHelper(Xbyak::Reg64 loc_desc_reg, Xbyak::Reg64 index_reg, I code.mov(loc_desc_reg, target.Value()); - patch_information[target].mov_rcx.emplace_back(code.getCurr()); + patch_information[target].mov_rcx.push_back(code.getCurr()); EmitPatchMovRcx(target_code_ptr); code.mov(qword[r15 + index_reg * 8 + code.GetJitStateInfo().offsetof_rsb_location_descriptors], loc_desc_reg); @@ -339,7 +339,7 @@ EmitX64::BlockDescriptor EmitX64::RegisterBlock(const IR::LocationDescriptor& de Patch(descriptor, entrypoint); BlockDescriptor block_desc{entrypoint, size}; - block_descriptors.emplace(descriptor.Value(), block_desc); + block_descriptors.insert({IR::LocationDescriptor{descriptor.Value()}, block_desc}); return block_desc; } diff --git a/src/dynarmic/backend/x64/emit_x64_memory.cpp.inc b/src/dynarmic/backend/x64/emit_x64_memory.cpp.inc index 61116dbc..272b896a 100644 --- a/src/dynarmic/backend/x64/emit_x64_memory.cpp.inc +++ b/src/dynarmic/backend/x64/emit_x64_memory.cpp.inc @@ -44,7 +44,7 @@ FakeCall AxxEmitX64::FastmemCallback(u64 rip_) { if (iter->second.recompile) { const auto marker = iter->second.marker; - do_not_fastmem.emplace(marker); + do_not_fastmem.insert(marker); InvalidateBasicBlocks({std::get<0>(marker)}); } diff --git a/src/dynarmic/common/memory_pool.cpp b/src/dynarmic/common/memory_pool.cpp index 9e25fba5..a62cd112 100644 --- a/src/dynarmic/common/memory_pool.cpp +++ b/src/dynarmic/common/memory_pool.cpp @@ -24,7 +24,7 @@ Pool::~Pool() { void* Pool::Alloc() { if (remaining == 0) { - slabs.emplace_back(current_slab); + slabs.push_back(current_slab); AllocateNewSlab(); }