diff options
| author | Mike Pall <mike> | 2012-01-15 17:05:34 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2012-01-15 17:05:34 +0100 |
| commit | 2f396c6db7c1f0737ebd32c82265befa563b1586 (patch) | |
| tree | b53530c3307053468f7404c619d393fbef0ed2f7 /src | |
| parent | 248cf2ffa9f43e9645c345d58ae2822fd2225979 (diff) | |
| download | luajit-2f396c6db7c1f0737ebd32c82265befa563b1586.tar.gz luajit-2f396c6db7c1f0737ebd32c82265befa563b1586.tar.bz2 luajit-2f396c6db7c1f0737ebd32c82265befa563b1586.zip | |
FFI: Don't touch frame in callbacks with tailcalls to fast functions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_ccallback.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lj_ccallback.c b/src/lj_ccallback.c index f3474588..3c95958d 100644 --- a/src/lj_ccallback.c +++ b/src/lj_ccallback.c | |||
| @@ -274,6 +274,7 @@ void lj_ccallback_mcode_free(CTState *cts) | |||
| 274 | #elif LJ_TARGET_ARM | 274 | #elif LJ_TARGET_ARM |
| 275 | 275 | ||
| 276 | #define CALLBACK_HANDLE_REGARG \ | 276 | #define CALLBACK_HANDLE_REGARG \ |
| 277 | UNUSED(isfp); \ | ||
| 277 | if (n > 1) ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \ | 278 | if (n > 1) ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \ |
| 278 | if (ngpr + n <= maxgpr) { \ | 279 | if (ngpr + n <= maxgpr) { \ |
| 279 | sp = &cts->cb.gpr[ngpr]; \ | 280 | sp = &cts->cb.gpr[ngpr]; \ |
| @@ -455,11 +456,13 @@ void LJ_FASTCALL lj_ccallback_leave(CTState *cts, TValue *o) | |||
| 455 | GCfunc *fn; | 456 | GCfunc *fn; |
| 456 | TValue *obase = L->base; | 457 | TValue *obase = L->base; |
| 457 | L->base = L->top; /* Keep continuation frame for throwing errors. */ | 458 | L->base = L->top; /* Keep continuation frame for throwing errors. */ |
| 458 | /* PC of RET* is lost. Point to last line for result conv. errors. */ | 459 | if (o >= L->base) { |
| 459 | fn = curr_func(L); | 460 | /* PC of RET* is lost. Point to last line for result conv. errors. */ |
| 460 | if (isluafunc(fn)) { | 461 | fn = curr_func(L); |
| 461 | GCproto *pt = funcproto(fn); | 462 | if (isluafunc(fn)) { |
| 462 | setcframe_pc(L->cframe, proto_bc(pt)+pt->sizebc+1); | 463 | GCproto *pt = funcproto(fn); |
| 464 | setcframe_pc(L->cframe, proto_bc(pt)+pt->sizebc+1); | ||
| 465 | } | ||
| 463 | } | 466 | } |
| 464 | callback_conv_result(cts, L, o); | 467 | callback_conv_result(cts, L, o); |
| 465 | /* Finally drop C frame and continuation frame. */ | 468 | /* Finally drop C frame and continuation frame. */ |
