aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2011-10-24 16:13:12 +0200
committerMike Pall <mike>2011-10-24 16:13:12 +0200
commitcb1dd159e3b25e23cb8aa2ba9b6da76bb17398ec (patch)
tree9605b1c4e9800cfe7d33f6e7cec989365d98e58c /src
parenta0d782755482483c09e919a51c396322dd228bf2 (diff)
downloadluajit-cb1dd159e3b25e23cb8aa2ba9b6da76bb17398ec.tar.gz
luajit-cb1dd159e3b25e23cb8aa2ba9b6da76bb17398ec.tar.bz2
luajit-cb1dd159e3b25e23cb8aa2ba9b6da76bb17398ec.zip
PPC: Add support for per-trace exit stubs.
Diffstat (limited to 'src')
-rw-r--r--src/lib_jit.c14
-rw-r--r--src/lj_target.h2
2 files changed, 15 insertions, 1 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c
index bfafa724..d4277add 100644
--- a/src/lib_jit.c
+++ b/src/lib_jit.c
@@ -377,15 +377,27 @@ LJLIB_CF(jit_util_tracemc)
377 return 0; 377 return 0;
378} 378}
379 379
380/* local addr = jit.util.traceexitstub(idx) */ 380/* local addr = jit.util.traceexitstub([tr,] exitno) */
381LJLIB_CF(jit_util_traceexitstub) 381LJLIB_CF(jit_util_traceexitstub)
382{ 382{
383#ifdef EXITSTUBS_PER_GROUP
383 ExitNo exitno = (ExitNo)lj_lib_checkint(L, 1); 384 ExitNo exitno = (ExitNo)lj_lib_checkint(L, 1);
384 jit_State *J = L2J(L); 385 jit_State *J = L2J(L);
385 if (exitno < EXITSTUBS_PER_GROUP*LJ_MAX_EXITSTUBGR) { 386 if (exitno < EXITSTUBS_PER_GROUP*LJ_MAX_EXITSTUBGR) {
386 setintptrV(L->top-1, (intptr_t)(void *)exitstub_addr(J, exitno)); 387 setintptrV(L->top-1, (intptr_t)(void *)exitstub_addr(J, exitno));
387 return 1; 388 return 1;
388 } 389 }
390#else
391 if (L->top > L->base+1) { /* Don't throw for one-argument variant. */
392 GCtrace *T = jit_checktrace(L);
393 ExitNo exitno = (ExitNo)lj_lib_checkint(L, 2);
394 ExitNo maxexit = T->root ? T->nsnap+1 : T->nsnap;
395 if (T && T->mcode != NULL && exitno < maxexit) {
396 setintptrV(L->top-1, (intptr_t)(void *)exitstub_trace_addr(T, exitno));
397 return 1;
398 }
399 }
400#endif
389 return 0; 401 return 0;
390} 402}
391 403
diff --git a/src/lj_target.h b/src/lj_target.h
index 410ad0a0..33feb17c 100644
--- a/src/lj_target.h
+++ b/src/lj_target.h
@@ -131,6 +131,7 @@ typedef uint32_t RegCost;
131#error "Missing include for target CPU" 131#error "Missing include for target CPU"
132#endif 132#endif
133 133
134#ifdef EXITSTUBS_PER_GROUP
134/* Return the address of an exit stub. */ 135/* Return the address of an exit stub. */
135static LJ_AINLINE MCode *exitstub_addr(jit_State *J, ExitNo exitno) 136static LJ_AINLINE MCode *exitstub_addr(jit_State *J, ExitNo exitno)
136{ 137{
@@ -138,5 +139,6 @@ static LJ_AINLINE MCode *exitstub_addr(jit_State *J, ExitNo exitno)
138 return (MCode *)((char *)J->exitstubgroup[exitno / EXITSTUBS_PER_GROUP] + 139 return (MCode *)((char *)J->exitstubgroup[exitno / EXITSTUBS_PER_GROUP] +
139 EXITSTUB_SPACING*(exitno % EXITSTUBS_PER_GROUP)); 140 EXITSTUB_SPACING*(exitno % EXITSTUBS_PER_GROUP));
140} 141}
142#endif
141 143
142#endif 144#endif