From cbfbb0ef8bc37edca1bcd5915e212970a878f838 Mon Sep 17 00:00:00 2001 From: BreadFish64 Date: Mon, 20 Apr 2020 15:11:25 -0500 Subject: [PATCH] emit_a64: get rid of useless NOP generation We don't actually patch anything in those locations beside a jump. --- src/backend/A64/a32_emit_a64.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/backend/A64/a32_emit_a64.cpp b/src/backend/A64/a32_emit_a64.cpp index fccae1cf..11bd547d 100644 --- a/src/backend/A64/a32_emit_a64.cpp +++ b/src/backend/A64/a32_emit_a64.cpp @@ -879,7 +879,6 @@ void A32EmitA64::ReadMemory(A32EmitContext& ctx, IR::Inst* inst, const CodePtr c ASSERT_MSG(false, "Invalid bit_size"); break; } - code.EnsurePatchLocationSize(patch_location, 5); fastmem_patch_info.emplace( patch_location, @@ -889,9 +888,7 @@ void A32EmitA64::ReadMemory(A32EmitContext& ctx, IR::Inst* inst, const CodePtr c code.SetCodePtr(patch_location); FixupBranch thunk = code.B(); u8* end_ptr = code.GetWritableCodePtr(); - code.EnsurePatchLocationSize(patch_location, 5); - code.FlushIcacheSection(reinterpret_cast(patch_location), code.GetCodePtr()); - + code.FlushIcacheSection(reinterpret_cast(patch_location), end_ptr); code.SetCodePtr(save_code_ptr); code.SwitchToFarCode(); code.SetJumpTarget(thunk); @@ -994,7 +991,6 @@ void A32EmitA64::WriteMemory(A32EmitContext& ctx, IR::Inst* inst, const CodePtr ASSERT_MSG(false, "Invalid bit_size"); break; } - code.EnsurePatchLocationSize(patch_location, 5); fastmem_patch_info.emplace( patch_location, @@ -1004,9 +1000,7 @@ void A32EmitA64::WriteMemory(A32EmitContext& ctx, IR::Inst* inst, const CodePtr code.SetCodePtr(patch_location); FixupBranch thunk = code.B(); u8* end_ptr = code.GetWritableCodePtr(); - code.EnsurePatchLocationSize(patch_location, 5); - code.FlushIcacheSection(reinterpret_cast(patch_location), code.GetCodePtr()); - + code.FlushIcacheSection(reinterpret_cast(patch_location), end_ptr); code.SetCodePtr(save_code_ptr); code.SwitchToFarCode(); code.SetJumpTarget(thunk);