diff options
author | Mike Pall <mike> | 2011-05-16 19:31:07 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-05-16 19:32:47 +0200 |
commit | fb46370e561bb74cca908980531b6092a34cf673 (patch) | |
tree | 33035a8fda14480408240e2115d863297969e744 | |
parent | dab4bcafba789c7954dc4f90623c81365dcedb7f (diff) | |
download | luajit-fb46370e561bb74cca908980531b6092a34cf673.tar.gz luajit-fb46370e561bb74cca908980531b6092a34cf673.tar.bz2 luajit-fb46370e561bb74cca908980531b6092a34cf673.zip |
Cleanup of target dependencies.
-rw-r--r-- | src/Makefile.dep | 4 | ||||
-rw-r--r-- | src/lib_jit.c | 5 | ||||
-rw-r--r-- | src/lj_arch.h | 3 | ||||
-rw-r--r-- | src/lj_asm.c | 4 | ||||
-rw-r--r-- | src/lj_jit.h | 19 | ||||
-rw-r--r-- | src/lj_mcode.c | 22 | ||||
-rw-r--r-- | src/lj_snap.c | 8 | ||||
-rw-r--r-- | src/lj_target.h | 8 | ||||
-rw-r--r-- | src/lj_target_x86.h | 4 | ||||
-rw-r--r-- | src/lj_trace.c | 62 |
10 files changed, 77 insertions, 62 deletions
diff --git a/src/Makefile.dep b/src/Makefile.dep index 05ef5748..5d1238f6 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep | |||
@@ -31,8 +31,8 @@ lib_io.o: lib_io.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ | |||
31 | lj_libdef.h | 31 | lj_libdef.h |
32 | lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h \ | 32 | lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h \ |
33 | lj_obj.h lj_def.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_bc.h lj_ir.h \ | 33 | lj_obj.h lj_def.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_bc.h lj_ir.h \ |
34 | lj_jit.h lj_iropt.h lj_dispatch.h lj_vm.h lj_vmevent.h lj_lib.h luajit.h \ | 34 | lj_jit.h lj_iropt.h lj_target.h lj_target_*.h lj_dispatch.h lj_vm.h \ |
35 | lj_libdef.h | 35 | lj_vmevent.h lj_lib.h luajit.h lj_libdef.h |
36 | lib_math.o: lib_math.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ | 36 | lib_math.o: lib_math.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ |
37 | lj_def.h lj_arch.h lj_lib.h lj_libdef.h | 37 | lj_def.h lj_arch.h lj_lib.h lj_libdef.h |
38 | lib_os.o: lib_os.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ | 38 | lib_os.o: lib_os.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ |
diff --git a/src/lib_jit.c b/src/lib_jit.c index e2fc8067..57837e1f 100644 --- a/src/lib_jit.c +++ b/src/lib_jit.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "lj_ir.h" | 20 | #include "lj_ir.h" |
21 | #include "lj_jit.h" | 21 | #include "lj_jit.h" |
22 | #include "lj_iropt.h" | 22 | #include "lj_iropt.h" |
23 | #include "lj_target.h" | ||
23 | #endif | 24 | #endif |
24 | #include "lj_dispatch.h" | 25 | #include "lj_dispatch.h" |
25 | #include "lj_vm.h" | 26 | #include "lj_vm.h" |
@@ -368,16 +369,12 @@ LJLIB_CF(jit_util_tracemc) | |||
368 | /* local addr = jit.util.traceexitstub(idx) */ | 369 | /* local addr = jit.util.traceexitstub(idx) */ |
369 | LJLIB_CF(jit_util_traceexitstub) | 370 | LJLIB_CF(jit_util_traceexitstub) |
370 | { | 371 | { |
371 | #ifdef EXITSTUBS_PER_GROUP | ||
372 | ExitNo exitno = (ExitNo)lj_lib_checkint(L, 1); | 372 | ExitNo exitno = (ExitNo)lj_lib_checkint(L, 1); |
373 | jit_State *J = L2J(L); | 373 | jit_State *J = L2J(L); |
374 | if (exitno < EXITSTUBS_PER_GROUP*LJ_MAX_EXITSTUBGR) { | 374 | if (exitno < EXITSTUBS_PER_GROUP*LJ_MAX_EXITSTUBGR) { |
375 | setintptrV(L->top-1, (intptr_t)(void *)exitstub_addr(J, exitno)); | 375 | setintptrV(L->top-1, (intptr_t)(void *)exitstub_addr(J, exitno)); |
376 | return 1; | 376 | return 1; |
377 | } | 377 | } |
378 | #else | ||
379 | UNUSED(L); | ||
380 | #endif | ||
381 | return 0; | 378 | return 0; |
382 | } | 379 | } |
383 | 380 | ||
diff --git a/src/lj_arch.h b/src/lj_arch.h index 3c6d9e9c..978ccd1f 100644 --- a/src/lj_arch.h +++ b/src/lj_arch.h | |||
@@ -119,6 +119,7 @@ | |||
119 | #define LJ_TARGET_X64 1 | 119 | #define LJ_TARGET_X64 1 |
120 | #define LJ_TARGET_X86ORX64 1 | 120 | #define LJ_TARGET_X86ORX64 1 |
121 | #define LJ_TARGET_EHRETREG 0 | 121 | #define LJ_TARGET_EHRETREG 0 |
122 | #define LJ_TARGET_JUMPRANGE 31 /* +-2^31 = +-2GB */ | ||
122 | #define LJ_TARGET_MASKSHIFT 1 | 123 | #define LJ_TARGET_MASKSHIFT 1 |
123 | #define LJ_TARGET_MASKROT 1 | 124 | #define LJ_TARGET_MASKROT 1 |
124 | #define LJ_ARCH_DUALNUM 1 | 125 | #define LJ_ARCH_DUALNUM 1 |
@@ -133,6 +134,7 @@ | |||
133 | #define LJ_ABI_EABI 1 | 134 | #define LJ_ABI_EABI 1 |
134 | #define LJ_TARGET_ARM 1 | 135 | #define LJ_TARGET_ARM 1 |
135 | #define LJ_TARGET_EHRETREG 0 | 136 | #define LJ_TARGET_EHRETREG 0 |
137 | #define LJ_TARGET_JUMPRANGE 25 /* +-2^25 = +-32MB */ | ||
136 | #define LJ_TARGET_MASKSHIFT 0 | 138 | #define LJ_TARGET_MASKSHIFT 0 |
137 | #define LJ_TARGET_MASKROT 1 | 139 | #define LJ_TARGET_MASKROT 1 |
138 | #define LJ_ARCH_DUALNUM 2 | 140 | #define LJ_ARCH_DUALNUM 2 |
@@ -153,6 +155,7 @@ | |||
153 | #define LJ_TARGET_PPC 1 | 155 | #define LJ_TARGET_PPC 1 |
154 | #define LJ_TARGET_PPCSPE 1 | 156 | #define LJ_TARGET_PPCSPE 1 |
155 | #define LJ_TARGET_EHRETREG 3 | 157 | #define LJ_TARGET_EHRETREG 3 |
158 | #define LJ_TARGET_JUMPRANGE 25 /* +-2^25 = +-32MB */ | ||
156 | #define LJ_TARGET_MASKSHIFT 0 | 159 | #define LJ_TARGET_MASKSHIFT 0 |
157 | #define LJ_TARGET_MASKROT 1 | 160 | #define LJ_TARGET_MASKROT 1 |
158 | #define LJ_ARCH_DUALNUM 0 | 161 | #define LJ_ARCH_DUALNUM 0 |
diff --git a/src/lj_asm.c b/src/lj_asm.c index 8b984d8e..37b7e3f5 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -1439,10 +1439,10 @@ void lj_asm_trace(jit_State *J, GCtrace *T) | |||
1439 | 1439 | ||
1440 | /* Set trace entry point before fixing up tail to allow link to self. */ | 1440 | /* Set trace entry point before fixing up tail to allow link to self. */ |
1441 | T->mcode = as->mcp; | 1441 | T->mcode = as->mcp; |
1442 | T->mcloop = as->mcloop ? (MSize)(as->mcloop - as->mcp) : 0; | 1442 | T->mcloop = as->mcloop ? (MSize)((char *)as->mcloop - (char *)as->mcp) : 0; |
1443 | if (!as->loopref) | 1443 | if (!as->loopref) |
1444 | asm_tail_fixup(as, T->link); /* Note: this may change as->mctop! */ | 1444 | asm_tail_fixup(as, T->link); /* Note: this may change as->mctop! */ |
1445 | T->szmcode = (MSize)(as->mctop - as->mcp); | 1445 | T->szmcode = (MSize)((char *)as->mctop - (char *)as->mcp); |
1446 | VG_INVALIDATE(T->mcode, T->szmcode); | 1446 | VG_INVALIDATE(T->mcode, T->szmcode); |
1447 | } | 1447 | } |
1448 | 1448 | ||
diff --git a/src/lj_jit.h b/src/lj_jit.h index 1cf63448..dd74dedb 100644 --- a/src/lj_jit.h +++ b/src/lj_jit.h | |||
@@ -258,13 +258,6 @@ enum { | |||
258 | #define lj_resetsplit(J) UNUSED(J) | 258 | #define lj_resetsplit(J) UNUSED(J) |
259 | #endif | 259 | #endif |
260 | 260 | ||
261 | /* Exit stubs. */ | ||
262 | #if LJ_TARGET_X86ORX64 | ||
263 | /* Limited by the range of a short fwd jump (127): (2+2)*(32-1)-2 = 122. */ | ||
264 | #define EXITSTUB_SPACING (2+2) | ||
265 | #define EXITSTUBS_PER_GROUP 32 | ||
266 | #endif | ||
267 | |||
268 | /* Fold state is used to fold instructions on-the-fly. */ | 261 | /* Fold state is used to fold instructions on-the-fly. */ |
269 | typedef struct FoldState { | 262 | typedef struct FoldState { |
270 | IRIns ins; /* Currently emitted instruction. */ | 263 | IRIns ins; /* Currently emitted instruction. */ |
@@ -331,9 +324,7 @@ typedef struct jit_State { | |||
331 | 324 | ||
332 | int32_t param[JIT_P__MAX]; /* JIT engine parameters. */ | 325 | int32_t param[JIT_P__MAX]; /* JIT engine parameters. */ |
333 | 326 | ||
334 | #if LJ_TARGET_X86ORX64 | ||
335 | MCode *exitstubgroup[LJ_MAX_EXITSTUBGR]; /* Exit stub group addresses. */ | 327 | MCode *exitstubgroup[LJ_MAX_EXITSTUBGR]; /* Exit stub group addresses. */ |
336 | #endif | ||
337 | 328 | ||
338 | HotPenalty penalty[PENALTY_SLOTS]; /* Penalty slots. */ | 329 | HotPenalty penalty[PENALTY_SLOTS]; /* Penalty slots. */ |
339 | uint32_t penaltyslot; /* Round-robin index into penalty slots. */ | 330 | uint32_t penaltyslot; /* Round-robin index into penalty slots. */ |
@@ -369,14 +360,4 @@ static LJ_AINLINE uint32_t LJ_PRNG_BITS(jit_State *J, int bits) | |||
369 | return J->prngstate >> (32-bits); | 360 | return J->prngstate >> (32-bits); |
370 | } | 361 | } |
371 | 362 | ||
372 | #ifdef EXITSTUBS_PER_GROUP | ||
373 | /* Return the address of an exit stub. */ | ||
374 | static LJ_AINLINE MCode *exitstub_addr(jit_State *J, ExitNo exitno) | ||
375 | { | ||
376 | lua_assert(J->exitstubgroup[exitno / EXITSTUBS_PER_GROUP] != NULL); | ||
377 | return (MCode *)((char *)J->exitstubgroup[exitno / EXITSTUBS_PER_GROUP] + | ||
378 | EXITSTUB_SPACING*(exitno % EXITSTUBS_PER_GROUP)); | ||
379 | } | ||
380 | #endif | ||
381 | |||
382 | #endif | 363 | #endif |
diff --git a/src/lj_mcode.c b/src/lj_mcode.c index 8d0f7213..279854f8 100644 --- a/src/lj_mcode.c +++ b/src/lj_mcode.c | |||
@@ -162,20 +162,7 @@ static void mcode_protect(jit_State *J, int prot) | |||
162 | #define mcode_validptr(p) ((p) && (uintptr_t)(p) < 0xffff0000) | 162 | #define mcode_validptr(p) ((p) && (uintptr_t)(p) < 0xffff0000) |
163 | #endif | 163 | #endif |
164 | 164 | ||
165 | #if LJ_TARGET_X64 | 165 | #ifdef LJ_TARGET_JUMPRANGE |
166 | #define MCODE_JUMPRANGE 31 | ||
167 | #elif LJ_TARGET_ARM | ||
168 | #define MCODE_JUMPRANGE 26 | ||
169 | #else | ||
170 | #define MCODE_JUMPRANGE 32 | ||
171 | #endif | ||
172 | |||
173 | #if MCODE_JUMPRANGE == 32 | ||
174 | |||
175 | /* All 32 bit memory addresses are reachable by relative jumps. */ | ||
176 | #define mcode_alloc(J, sz) mcode_alloc_at((J), 0, (sz), MCPROT_GEN) | ||
177 | |||
178 | #else | ||
179 | 166 | ||
180 | /* Get memory within relative jump distance of our code in 64 bit mode. */ | 167 | /* Get memory within relative jump distance of our code in 64 bit mode. */ |
181 | static void *mcode_alloc(jit_State *J, size_t sz) | 168 | static void *mcode_alloc(jit_State *J, size_t sz) |
@@ -184,7 +171,7 @@ static void *mcode_alloc(jit_State *J, size_t sz) | |||
184 | ** Try addresses within a distance of target-range/2+1MB..target+range/2-1MB. | 171 | ** Try addresses within a distance of target-range/2+1MB..target+range/2-1MB. |
185 | */ | 172 | */ |
186 | uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff; | 173 | uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff; |
187 | const uintptr_t range = (1u << MCODE_JUMPRANGE) - (1u << 21); | 174 | const uintptr_t range = (1u << LJ_TARGET_JUMPRANGE) - (1u << 21); |
188 | /* First try a contiguous area below the last one. */ | 175 | /* First try a contiguous area below the last one. */ |
189 | uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0; | 176 | uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0; |
190 | int i; | 177 | int i; |
@@ -208,6 +195,11 @@ static void *mcode_alloc(jit_State *J, size_t sz) | |||
208 | return NULL; | 195 | return NULL; |
209 | } | 196 | } |
210 | 197 | ||
198 | #else | ||
199 | |||
200 | /* All memory addresses are reachable by relative jumps. */ | ||
201 | #define mcode_alloc(J, sz) mcode_alloc_at((J), 0, (sz), MCPROT_GEN) | ||
202 | |||
211 | #endif | 203 | #endif |
212 | 204 | ||
213 | /* -- MCode area management ----------------------------------------------- */ | 205 | /* -- MCode area management ----------------------------------------------- */ |
diff --git a/src/lj_snap.c b/src/lj_snap.c index e1791b51..dd70ece1 100644 --- a/src/lj_snap.c +++ b/src/lj_snap.c | |||
@@ -392,8 +392,10 @@ const BCIns *lj_snap_restore(jit_State *J, void *exptr) | |||
392 | o->u32.lo = (uint32_t)*sps; | 392 | o->u32.lo = (uint32_t)*sps; |
393 | } else if (irt_isinteger(t)) { | 393 | } else if (irt_isinteger(t)) { |
394 | setintV(o, *sps); | 394 | setintV(o, *sps); |
395 | } else if (!LJ_SOFTFP && irt_isnum(t)) { | 395 | #if !LJ_SOFTFP |
396 | } else if (irt_isnum(t)) { | ||
396 | o->u64 = *(uint64_t *)sps; | 397 | o->u64 = *(uint64_t *)sps; |
398 | #endif | ||
397 | #if LJ_64 | 399 | #if LJ_64 |
398 | } else if (irt_islightud(t)) { | 400 | } else if (irt_islightud(t)) { |
399 | /* 64 bit lightuserdata which may escape already has the tag bits. */ | 401 | /* 64 bit lightuserdata which may escape already has the tag bits. */ |
@@ -411,8 +413,10 @@ const BCIns *lj_snap_restore(jit_State *J, void *exptr) | |||
411 | o->u32.lo = (uint32_t)ex->gpr[r-RID_MIN_GPR]; | 413 | o->u32.lo = (uint32_t)ex->gpr[r-RID_MIN_GPR]; |
412 | } else if (irt_isinteger(t)) { | 414 | } else if (irt_isinteger(t)) { |
413 | setintV(o, (int32_t)ex->gpr[r-RID_MIN_GPR]); | 415 | setintV(o, (int32_t)ex->gpr[r-RID_MIN_GPR]); |
414 | } else if (!LJ_SOFTFP && irt_isnum(t)) { | 416 | #if !LJ_SOFTFP |
417 | } else if (irt_isnum(t)) { | ||
415 | setnumV(o, ex->fpr[r-RID_MIN_FPR]); | 418 | setnumV(o, ex->fpr[r-RID_MIN_FPR]); |
419 | #endif | ||
416 | #if LJ_64 | 420 | #if LJ_64 |
417 | } else if (irt_islightud(t)) { | 421 | } else if (irt_islightud(t)) { |
418 | /* 64 bit lightuserdata which may escape already has the tag bits. */ | 422 | /* 64 bit lightuserdata which may escape already has the tag bits. */ |
diff --git a/src/lj_target.h b/src/lj_target.h index 8c91bf7e..bfa1c9f0 100644 --- a/src/lj_target.h +++ b/src/lj_target.h | |||
@@ -129,4 +129,12 @@ typedef uint32_t RegCost; | |||
129 | #error "Missing include for target CPU" | 129 | #error "Missing include for target CPU" |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | /* Return the address of an exit stub. */ | ||
133 | static LJ_AINLINE MCode *exitstub_addr(jit_State *J, ExitNo exitno) | ||
134 | { | ||
135 | lua_assert(J->exitstubgroup[exitno / EXITSTUBS_PER_GROUP] != NULL); | ||
136 | return (MCode *)((char *)J->exitstubgroup[exitno / EXITSTUBS_PER_GROUP] + | ||
137 | EXITSTUB_SPACING*(exitno % EXITSTUBS_PER_GROUP)); | ||
138 | } | ||
139 | |||
132 | #endif | 140 | #endif |
diff --git a/src/lj_target_x86.h b/src/lj_target_x86.h index 5c24761e..fd2a32fe 100644 --- a/src/lj_target_x86.h +++ b/src/lj_target_x86.h | |||
@@ -147,6 +147,10 @@ typedef struct { | |||
147 | int32_t spill[256]; /* Spill slots. */ | 147 | int32_t spill[256]; /* Spill slots. */ |
148 | } ExitState; | 148 | } ExitState; |
149 | 149 | ||
150 | /* Limited by the range of a short fwd jump (127): (2+2)*(32-1)-2 = 122. */ | ||
151 | #define EXITSTUB_SPACING (2+2) | ||
152 | #define EXITSTUBS_PER_GROUP 32 | ||
153 | |||
150 | /* -- x86 ModRM operand encoding ------------------------------------------ */ | 154 | /* -- x86 ModRM operand encoding ------------------------------------------ */ |
151 | 155 | ||
152 | typedef enum { | 156 | typedef enum { |
diff --git a/src/lj_trace.c b/src/lj_trace.c index ecfbfed6..7141de46 100644 --- a/src/lj_trace.c +++ b/src/lj_trace.c | |||
@@ -278,9 +278,7 @@ int lj_trace_flushall(lua_State *L) | |||
278 | memset(J->penalty, 0, sizeof(J->penalty)); | 278 | memset(J->penalty, 0, sizeof(J->penalty)); |
279 | /* Free the whole machine code and invalidate all exit stub groups. */ | 279 | /* Free the whole machine code and invalidate all exit stub groups. */ |
280 | lj_mcode_free(J); | 280 | lj_mcode_free(J); |
281 | #ifdef EXITSTUBS_PER_GROUP | ||
282 | memset(J->exitstubgroup, 0, sizeof(J->exitstubgroup)); | 281 | memset(J->exitstubgroup, 0, sizeof(J->exitstubgroup)); |
283 | #endif | ||
284 | lj_vmevent_send(L, TRACE, | 282 | lj_vmevent_send(L, TRACE, |
285 | setstrV(L, L->top++, lj_str_newlit(L, "flush")); | 283 | setstrV(L, L->top++, lj_str_newlit(L, "flush")); |
286 | ); | 284 | ); |
@@ -685,15 +683,58 @@ static TValue *trace_exit_cp(lua_State *L, lua_CFunction dummy, void *ud) | |||
685 | return NULL; | 683 | return NULL; |
686 | } | 684 | } |
687 | 685 | ||
686 | #ifndef LUAJIT_DISABLE_VMEVENT | ||
687 | /* Push all registers from exit state. */ | ||
688 | static void trace_exit_regs(lua_State *L, ExitState *ex) | ||
689 | { | ||
690 | int32_t i; | ||
691 | setintV(L->top++, RID_NUM_GPR); | ||
692 | setintV(L->top++, RID_NUM_FPR); | ||
693 | for (i = 0; i < RID_NUM_GPR; i++) { | ||
694 | if (sizeof(ex->gpr[i]) == sizeof(int32_t)) | ||
695 | setintV(L->top++, (int32_t)ex->gpr[i]); | ||
696 | else | ||
697 | setnumV(L->top++, (lua_Number)ex->gpr[i]); | ||
698 | } | ||
699 | #if !LJ_SOFTFP | ||
700 | for (i = 0; i < RID_NUM_FPR; i++) { | ||
701 | setnumV(L->top, ex->fpr[i]); | ||
702 | if (LJ_UNLIKELY(tvisnan(L->top))) | ||
703 | setnanV(L->top); | ||
704 | L->top++; | ||
705 | } | ||
706 | #endif | ||
707 | } | ||
708 | #endif | ||
709 | |||
710 | #ifdef EXITSTATE_PCREG | ||
711 | /* Determine trace number from pc of exit instruction. */ | ||
712 | static TraceNo trace_exit_find(jit_State *J, MCode *pc) | ||
713 | { | ||
714 | TraceNo traceno; | ||
715 | for (traceno = 1; traceno < J->sizetrace; traceno++) { | ||
716 | GCtrace *T = traceref(J, traceno); | ||
717 | if (T && pc >= T->mcode && pc < (MCode *)((char *)T->mcode + T->szmcode)) | ||
718 | return traceno; | ||
719 | } | ||
720 | lua_assert(0); | ||
721 | return 0; | ||
722 | } | ||
723 | #endif | ||
724 | |||
688 | /* A trace exited. Restore interpreter state. */ | 725 | /* A trace exited. Restore interpreter state. */ |
689 | int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr) | 726 | int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr) |
690 | { | 727 | { |
691 | ERRNO_SAVE | 728 | ERRNO_SAVE |
692 | lua_State *L = J->L; | 729 | lua_State *L = J->L; |
730 | ExitState *ex = (ExitState *)exptr; | ||
693 | ExitDataCP exd; | 731 | ExitDataCP exd; |
694 | int errcode; | 732 | int errcode; |
695 | const BCIns *pc; | 733 | const BCIns *pc; |
696 | void *cf; | 734 | void *cf; |
735 | #ifdef EXITSTATE_PCREG | ||
736 | J->parent = trace_exit_find(J, (MCode *)(intptr_t)ex->gpr[EXITSTATE_PCREG]); | ||
737 | #endif | ||
697 | exd.J = J; | 738 | exd.J = J; |
698 | exd.exptr = exptr; | 739 | exd.exptr = exptr; |
699 | errcode = lj_vm_cpcall(L, NULL, &exd, trace_exit_cp); | 740 | errcode = lj_vm_cpcall(L, NULL, &exd, trace_exit_cp); |
@@ -701,25 +742,10 @@ int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr) | |||
701 | return -errcode; /* Return negated error code. */ | 742 | return -errcode; /* Return negated error code. */ |
702 | 743 | ||
703 | lj_vmevent_send(L, TEXIT, | 744 | lj_vmevent_send(L, TEXIT, |
704 | ExitState *ex = (ExitState *)exptr; | ||
705 | int32_t i; | ||
706 | lj_state_checkstack(L, 4+RID_NUM_GPR+RID_NUM_FPR+LUA_MINSTACK); | 745 | lj_state_checkstack(L, 4+RID_NUM_GPR+RID_NUM_FPR+LUA_MINSTACK); |
707 | setintV(L->top++, J->parent); | 746 | setintV(L->top++, J->parent); |
708 | setintV(L->top++, J->exitno); | 747 | setintV(L->top++, J->exitno); |
709 | setintV(L->top++, RID_NUM_GPR); | 748 | trace_exit_regs(L, ex); |
710 | setintV(L->top++, RID_NUM_FPR); | ||
711 | for (i = 0; i < RID_NUM_GPR; i++) { | ||
712 | if (sizeof(ex->gpr[i]) == sizeof(int32_t)) | ||
713 | setintV(L->top++, (int32_t)ex->gpr[i]); | ||
714 | else | ||
715 | setnumV(L->top++, (lua_Number)ex->gpr[i]); | ||
716 | } | ||
717 | for (i = 0; i < RID_NUM_FPR; i++) { | ||
718 | setnumV(L->top, ex->fpr[i]); | ||
719 | if (LJ_UNLIKELY(tvisnan(L->top))) | ||
720 | setnanV(L->top); | ||
721 | L->top++; | ||
722 | } | ||
723 | ); | 749 | ); |
724 | 750 | ||
725 | pc = exd.pc; | 751 | pc = exd.pc; |