aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lj_asm.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index e028ab4f..640b6e15 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -852,6 +852,19 @@ static uint32_t ir_khash(IRIns *ir)
852 return hashrot(lo, hi); 852 return hashrot(lo, hi);
853} 853}
854 854
855/* Flush instruction cache. */
856static void asm_cache_flush(MCode *start, MCode *end)
857{
858 VG_INVALIDATE(start, (char *)end-(char *)start);
859#if !LJ_TARGET_X86ORX64
860#if defined(__GNUC__)
861 __clear_cache(start, end);
862#else
863#error "Missing builtin to flush instruction cache"
864#endif
865#endif
866}
867
855/* -- Allocations --------------------------------------------------------- */ 868/* -- Allocations --------------------------------------------------------- */
856 869
857static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args); 870static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args);
@@ -1620,7 +1633,7 @@ void lj_asm_trace(jit_State *J, GCtrace *T)
1620 if (!as->loopref) 1633 if (!as->loopref)
1621 asm_tail_fixup(as, T->link); /* Note: this may change as->mctop! */ 1634 asm_tail_fixup(as, T->link); /* Note: this may change as->mctop! */
1622 T->szmcode = (MSize)((char *)as->mctop - (char *)as->mcp); 1635 T->szmcode = (MSize)((char *)as->mctop - (char *)as->mcp);
1623 VG_INVALIDATE(T->mcode, T->szmcode); 1636 asm_cache_flush(T->mcode, as->mctop);
1624} 1637}
1625 1638
1626#undef IR 1639#undef IR