aboutsummaryrefslogtreecommitdiff
path: root/src/lj_asm_mips.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_asm_mips.h')
-rw-r--r--src/lj_asm_mips.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h
index 190a55eb..22031d11 100644
--- a/src/lj_asm_mips.h
+++ b/src/lj_asm_mips.h
@@ -1665,6 +1665,9 @@ static void asm_stack_restore(ASMState *as, SnapShot *snap)
1665 1665
1666/* -- GC handling --------------------------------------------------------- */ 1666/* -- GC handling --------------------------------------------------------- */
1667 1667
1668/* Marker to prevent patching the GC check exit. */
1669#define MIPS_NOPATCH_GC_CHECK MIPSI_OR
1670
1668/* Check GC threshold and do one or more GC steps. */ 1671/* Check GC threshold and do one or more GC steps. */
1669static void asm_gc_check(ASMState *as) 1672static void asm_gc_check(ASMState *as)
1670{ 1673{
@@ -1680,6 +1683,7 @@ static void asm_gc_check(ASMState *as)
1680 args[0] = ASMREF_TMP1; /* global_State *g */ 1683 args[0] = ASMREF_TMP1; /* global_State *g */
1681 args[1] = ASMREF_TMP2; /* MSize steps */ 1684 args[1] = ASMREF_TMP2; /* MSize steps */
1682 asm_gencall(as, ci, args); 1685 asm_gencall(as, ci, args);
1686 l_end[-3] = MIPS_NOPATCH_GC_CHECK; /* Replace the nop after the call. */
1683 emit_tsi(as, MIPSI_ADDIU, ra_releasetmp(as, ASMREF_TMP1), RID_JGL, -32768); 1687 emit_tsi(as, MIPSI_ADDIU, ra_releasetmp(as, ASMREF_TMP1), RID_JGL, -32768);
1684 tmp = ra_releasetmp(as, ASMREF_TMP2); 1688 tmp = ra_releasetmp(as, ASMREF_TMP2);
1685 emit_loadi(as, tmp, as->gcsteps); 1689 emit_loadi(as, tmp, as->gcsteps);
@@ -1936,7 +1940,8 @@ void lj_asm_patchexit(jit_State *J, GCtrace *T, ExitNo exitno, MCode *target)
1936 if (((p[-1] ^ (px-p)) & 0xffffu) == 0 && 1940 if (((p[-1] ^ (px-p)) & 0xffffu) == 0 &&
1937 ((p[-1] & 0xf0000000u) == MIPSI_BEQ || 1941 ((p[-1] & 0xf0000000u) == MIPSI_BEQ ||
1938 (p[-1] & 0xfc1e0000u) == MIPSI_BLTZ || 1942 (p[-1] & 0xfc1e0000u) == MIPSI_BLTZ ||
1939 (p[-1] & 0xffe00000u) == MIPSI_BC1F)) { 1943 (p[-1] & 0xffe00000u) == MIPSI_BC1F) &&
1944 p[-2] != MIPS_NOPATCH_GC_CHECK) {
1940 ptrdiff_t delta = target - p; 1945 ptrdiff_t delta = target - p;
1941 if (((delta + 0x8000) >> 16) == 0) { /* Patch in-range branch. */ 1946 if (((delta + 0x8000) >> 16) == 0) { /* Patch in-range branch. */
1942 patchbranch: 1947 patchbranch: