]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
ARM64: Prevent STP fusion for conditional code emitted by TBAR.
authorMike Pall <mike>
Mon, 28 Aug 2023 20:39:35 +0000 (22:39 +0200)
committerMike Pall <mike>
Mon, 28 Aug 2023 20:39:35 +0000 (22:39 +0200)
Thanks to Peter Cawley. #1057

src/lj_asm_arm64.h

index 34960d7c30e2bda138465126ef4aa4cad52c4b40..1d5cca4f5909fd7d334134beb205fda13e3efe9a 100644 (file)
@@ -1289,8 +1289,9 @@ static void asm_tbar(ASMState *as, IRIns *ir)
   Reg link = ra_scratch(as, rset_exclude(RSET_GPR, tab));
   Reg mark = RID_TMP;
   MCLabel l_end = emit_label(as);
-  emit_lso(as, A64I_STRx, link, tab, (int32_t)offsetof(GCtab, gclist));
   emit_lso(as, A64I_STRB, mark, tab, (int32_t)offsetof(GCtab, marked));
+  /* Keep STRx in the middle to avoid LDP/STP fusion with surrounding code. */
+  emit_lso(as, A64I_STRx, link, tab, (int32_t)offsetof(GCtab, gclist));
   emit_setgl(as, tab, gc.grayagain);
   emit_dn(as, A64I_ANDw^emit_isk13(~LJ_GC_BLACK, 0), mark, mark);
   emit_getgl(as, link, gc.grayagain);