diff --git a/src/lj_target.h b/src/lj_target.h index a80cc027..c302d301 100644 --- a/src/lj_target.h +++ b/src/lj_target.h @@ -144,12 +144,15 @@ typedef uint32_t RegCost; #ifdef EXITSTUBS_PER_GROUP /* Return the address of an exit stub. */ -static LJ_AINLINE MCode *exitstub_addr(jit_State *J, ExitNo exitno) +static LJ_AINLINE char *exitstub_addr_(char **group, uint32_t exitno) { - lua_assert(J->exitstubgroup[exitno / EXITSTUBS_PER_GROUP] != NULL); - return (MCode *)((char *)J->exitstubgroup[exitno / EXITSTUBS_PER_GROUP] + - EXITSTUB_SPACING*(exitno % EXITSTUBS_PER_GROUP)); + lua_assert(group[exitno / EXITSTUBS_PER_GROUP] != NULL); + return (char *)group[exitno / EXITSTUBS_PER_GROUP] + + EXITSTUB_SPACING*(exitno % EXITSTUBS_PER_GROUP); } +/* Avoid dependence on lj_jit.h if only including lj_target.h. */ +#define exitstub_addr(J, exitno) \ + ((MCode *)exitstub_addr_((char **)((J)->exitstubgroup), (exitno))) #endif #endif diff --git a/src/lj_target_ppc.h b/src/lj_target_ppc.h index f754a8d3..d8fbea6d 100644 --- a/src/lj_target_ppc.h +++ b/src/lj_target_ppc.h @@ -112,13 +112,14 @@ typedef struct { #define EXITSTATE_CHECKEXIT 1 /* Return the address of a per-trace exit stub. */ -static LJ_AINLINE MCode *exitstub_trace_addr(GCtrace *T, ExitNo exitno) +static LJ_AINLINE uint32_t *exitstub_trace_addr_(uint32_t *p, uint32_t exitno) { - /* Keep this in-sync with asm_exitstub_*. */ - MCode *p = (MCode *)((char *)T->mcode + T->szmcode); while (*p == 0x60000000) p++; /* Skip PPCI_NOP. */ return p + 3 + exitno; } +/* Avoid dependence on lj_jit.h if only including lj_target.h. */ +#define exitstub_trace_addr(T, exitno) \ + exitstub_trace_addr_((MCode *)((char *)(T)->mcode + (T)->szmcode), (exitno)) /* -- Instructions -------------------------------------------------------- */