diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_asm_mips.h | 9 | ||||
-rw-r--r-- | src/lj_jit.h | 6 | ||||
-rw-r--r-- | src/lj_mcode.c | 6 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h index d0def3e1..05af3d09 100644 --- a/src/lj_asm_mips.h +++ b/src/lj_asm_mips.h | |||
@@ -65,10 +65,9 @@ static Reg ra_alloc2(ASMState *as, IRIns *ir, RegSet allow) | |||
65 | static void asm_sparejump_setup(ASMState *as) | 65 | static void asm_sparejump_setup(ASMState *as) |
66 | { | 66 | { |
67 | MCode *mxp = as->mcbot; | 67 | MCode *mxp = as->mcbot; |
68 | /* Assumes sizeof(MCLink) == 8. */ | 68 | if (((uintptr_t)mxp & (LJ_PAGESIZE-1)) == sizeof(MCLink)) { |
69 | if (((uintptr_t)mxp & (LJ_PAGESIZE-1)) == 8) { | ||
70 | lua_assert(MIPSI_NOP == 0); | 69 | lua_assert(MIPSI_NOP == 0); |
71 | memset(mxp+2, 0, MIPS_SPAREJUMP*8); | 70 | memset(mxp, 0, MIPS_SPAREJUMP*2*sizeof(MCode)); |
72 | mxp += MIPS_SPAREJUMP*2; | 71 | mxp += MIPS_SPAREJUMP*2; |
73 | lua_assert(mxp < as->mctop); | 72 | lua_assert(mxp < as->mctop); |
74 | lj_mcode_sync(as->mcbot, mxp); | 73 | lj_mcode_sync(as->mcbot, mxp); |
@@ -2480,7 +2479,9 @@ void lj_asm_patchexit(jit_State *J, GCtrace *T, ExitNo exitno, MCode *target) | |||
2480 | if (!cstart) cstart = p-1; | 2479 | if (!cstart) cstart = p-1; |
2481 | } else { /* Branch out of range. Use spare jump slot in mcarea. */ | 2480 | } else { /* Branch out of range. Use spare jump slot in mcarea. */ |
2482 | int i; | 2481 | int i; |
2483 | for (i = 2; i < 2+MIPS_SPAREJUMP*2; i += 2) { | 2482 | for (i = (int)(sizeof(MCLink)/sizeof(MCode)); |
2483 | i < (int)(sizeof(MCLink)/sizeof(MCode)+MIPS_SPAREJUMP*2); | ||
2484 | i += 2) { | ||
2484 | if (mcarea[i] == tjump) { | 2485 | if (mcarea[i] == tjump) { |
2485 | delta = mcarea+i - p; | 2486 | delta = mcarea+i - p; |
2486 | goto patchbranch; | 2487 | goto patchbranch; |
diff --git a/src/lj_jit.h b/src/lj_jit.h index 92054e3d..2fa8efc4 100644 --- a/src/lj_jit.h +++ b/src/lj_jit.h | |||
@@ -158,6 +158,12 @@ typedef uint8_t MCode; | |||
158 | typedef uint32_t MCode; | 158 | typedef uint32_t MCode; |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | /* Linked list of MCode areas. */ | ||
162 | typedef struct MCLink { | ||
163 | MCode *next; /* Next area. */ | ||
164 | size_t size; /* Size of current area. */ | ||
165 | } MCLink; | ||
166 | |||
161 | /* Stack snapshot header. */ | 167 | /* Stack snapshot header. */ |
162 | typedef struct SnapShot { | 168 | typedef struct SnapShot { |
163 | uint16_t mapofs; /* Offset into snapshot map. */ | 169 | uint16_t mapofs; /* Offset into snapshot map. */ |
diff --git a/src/lj_mcode.c b/src/lj_mcode.c index 77035bf7..e46e3ef0 100644 --- a/src/lj_mcode.c +++ b/src/lj_mcode.c | |||
@@ -272,12 +272,6 @@ static void *mcode_alloc(jit_State *J, size_t sz) | |||
272 | 272 | ||
273 | /* -- MCode area management ----------------------------------------------- */ | 273 | /* -- MCode area management ----------------------------------------------- */ |
274 | 274 | ||
275 | /* Linked list of MCode areas. */ | ||
276 | typedef struct MCLink { | ||
277 | MCode *next; /* Next area. */ | ||
278 | size_t size; /* Size of current area. */ | ||
279 | } MCLink; | ||
280 | |||
281 | /* Allocate a new MCode area. */ | 275 | /* Allocate a new MCode area. */ |
282 | static void mcode_allocarea(jit_State *J) | 276 | static void mcode_allocarea(jit_State *J) |
283 | { | 277 | { |