From fc76d540a076e44bd95af939e0675b0a44acf3c0 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 27 May 2014 15:25:34 +0200 Subject: [PATCH 1/2] x86: Fix code generation for unused result of math.random(). --- src/lj_asm_x86.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h index fda911e5..40f95636 100644 --- a/src/lj_asm_x86.h +++ b/src/lj_asm_x86.h @@ -571,7 +571,7 @@ static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci) lua_assert(!irt_ispri(ir->t)); ra_destreg(as, ir, RID_RET); } - } else if (LJ_32 && irt_isfp(ir->t)) { + } else if (LJ_32 && irt_isfp(ir->t) && !(ci->flags & CCI_CASTU64)) { emit_x87op(as, XI_FPOP); /* Pop unused result from x87 st0. */ } } From 49d3157e146bc33b5b7c3a82ce00a8f824f6fa49 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 27 May 2014 15:58:04 +0200 Subject: [PATCH 2/2] PPC: Fix red zone overflow in machine code generation. --- src/lj_asm_ppc.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lj_asm_ppc.h b/src/lj_asm_ppc.h index e1a496a7..0a3d35e9 100644 --- a/src/lj_asm_ppc.h +++ b/src/lj_asm_ppc.h @@ -49,6 +49,8 @@ static void asm_exitstub_setup(ASMState *as, ExitNo nexits) { ExitNo i; MCode *mxp = as->mctop; + if (mxp - (nexits + 3 + MCLIM_REDZONE) < as->mclim) + asm_mclimit(as); /* 1: mflr r0; bl ->vm_exit_handler; li r0, traceno; bl <1; bl <1; ... */ for (i = nexits-1; (int32_t)i >= 0; i--) *--mxp = PPCI_BL|(((-3-i)&0x00ffffffu)<<2);