From c4ccac9a9c28be3c1f8884e188c7f80119c02cb7 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 13 Oct 2019 00:02:44 +0300 Subject: [PATCH] [TSX] Fix XABORT handling Break repeat loop after explicit transaction abort. May have performance consequences. --- Utilities/JIT.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Utilities/JIT.cpp b/Utilities/JIT.cpp index 419a02b45c..cb95477330 100644 --- a/Utilities/JIT.cpp +++ b/Utilities/JIT.cpp @@ -205,12 +205,18 @@ void asmjit::build_transaction_enter(asmjit::X86Assembler& c, asmjit::Label fall } else { + // Don't repeat on explicit XABORT instruction (workaround) + c.test(x86::eax, _XABORT_EXPLICIT); + c.jnz(fallback); + // Count an attempt without RETRY flag as 65 normal attempts and continue + c.push(x86::rax); c.not_(x86::eax); c.and_(x86::eax, _XABORT_RETRY); c.shl(x86::eax, 5); c.add(x86::eax, 1); // eax = RETRY ? 1 : 65 c.add(ctr, x86::rax); + c.pop(x86::rax); } c.cmp(ctr, less_than);