From 850f8c59d3d04a9847f21f32a6c36d8269b5b6b1 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Mon, 2 Oct 2017 23:10:56 +0200 Subject: [PATCH] LJ_GC64: Make ASMREF_L references 64 bit. Reported by Yichun Zhang. --- src/lj_asm.c | 1 + src/lj_ir.h | 4 +++- src/lj_opt_sink.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lj_asm.c b/src/lj_asm.c index d961927bde..753fe6bd1d 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c @@ -2015,6 +2015,7 @@ static void asm_setup_regsp(ASMState *as) ir->prev = REGSP_INIT; if (irt_is64(ir->t) && ir->o != IR_KNULL) { #if LJ_GC64 + /* The false-positive of irt_is64() for ASMREF_L (REF_NIL) is OK here. */ ir->i = 0; /* Will become non-zero only for RIP-relative addresses. */ #else /* Make life easier for backends by putting address of constant in i. */ diff --git a/src/lj_ir.h b/src/lj_ir.h index 34c2785394..8057a7508c 100644 --- a/src/lj_ir.h +++ b/src/lj_ir.h @@ -377,10 +377,12 @@ typedef struct IRType1 { uint8_t irt; } IRType1; #define irt_isint64(t) (irt_typerange((t), IRT_I64, IRT_U64)) #if LJ_GC64 +/* Include IRT_NIL, so IR(ASMREF_L) (aka REF_NIL) is considered 64 bit. */ #define IRT_IS64 \ ((1u<cur.nk); ir < irbase; ir++) { irt_clearmark(ir->t); ir->prev = REGSP_INIT; + /* The false-positive of irt_is64() for ASMREF_L (REF_NIL) is OK here. */ if (irt_is64(ir->t) && ir->o != IR_KNULL) ir++; }