From 2169653c50e1c182c29a2e00e3f695db01295f2e Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 16 May 2020 12:31:12 +0100 Subject: [PATCH] a64_emit_x64: Invalid regalloc code for EmitA64ExclusiveReadMemory128 Attempted to allocate args[0] after end of allocation scope --- src/backend/x64/a64_emit_x64.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/x64/a64_emit_x64.cpp b/src/backend/x64/a64_emit_x64.cpp index a535ffbe..965b7c09 100644 --- a/src/backend/x64/a64_emit_x64.cpp +++ b/src/backend/x64/a64_emit_x64.cpp @@ -995,8 +995,9 @@ void A64EmitX64::EmitA64ExclusiveReadMemory128(A64EmitContext& ctx, IR::Inst* in ASSERT(conf.global_monitor != nullptr); auto args = ctx.reg_alloc.GetArgumentInfo(inst); const Xbyak::Xmm result = ctx.reg_alloc.ScratchXmm(); + ctx.reg_alloc.Use(args[0], ABI_PARAM2); ctx.reg_alloc.EndOfAllocScope(); - ctx.reg_alloc.HostCall(nullptr, {}, args[0]); + ctx.reg_alloc.HostCall(nullptr); code.mov(code.byte[r15 + offsetof(A64JitState, exclusive_state)], u8(1)); code.mov(code.ABI_PARAM1, reinterpret_cast(&conf));