Skip to content

Commit

Permalink
LJ_GC64: Make ASMREF_L references 64 bit.
Browse files Browse the repository at this point in the history
Reported by Yichun Zhang.
  • Loading branch information
Mike Pall committed Oct 2, 2017
1 parent b4ed321 commit 850f8c5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lj_asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
4 changes: 3 additions & 1 deletion src/lj_ir.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<<IRT_NUM)|(1u<<IRT_I64)|(1u<<IRT_U64)|(1u<<IRT_P64)|\
(1u<<IRT_LIGHTUD)|(1u<<IRT_STR)|(1u<<IRT_THREAD)|(1u<<IRT_PROTO)|\
(1u<<IRT_FUNC)|(1u<<IRT_CDATA)|(1u<<IRT_TAB)|(1u<<IRT_UDATA))
(1u<<IRT_FUNC)|(1u<<IRT_CDATA)|(1u<<IRT_TAB)|(1u<<IRT_UDATA)|\
(1u<<IRT_NIL))
#elif LJ_64
#define IRT_IS64 \
((1u<<IRT_NUM)|(1u<<IRT_I64)|(1u<<IRT_U64)|(1u<<IRT_P64)|(1u<<IRT_LIGHTUD))
Expand Down
1 change: 1 addition & 0 deletions src/lj_opt_sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ static void sink_sweep_ins(jit_State *J)
for (ir = IR(J->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++;
}
Expand Down

0 comments on commit 850f8c5

Please sign in to comment.