diff options
| author | Mike Pall <mike> | 2011-04-05 00:23:05 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2011-04-05 00:23:05 +0200 |
| commit | 43d7db62d11e5bdc466cb02e9dd67c7cf00d75db (patch) | |
| tree | adc89c5c8bd28202309c9085de3ea3d101c9e6fe /src | |
| parent | 959683c77cea015b21e79d25d510ce3af3a7d0df (diff) | |
| download | luajit-43d7db62d11e5bdc466cb02e9dd67c7cf00d75db.tar.gz luajit-43d7db62d11e5bdc466cb02e9dd67c7cf00d75db.tar.bz2 luajit-43d7db62d11e5bdc466cb02e9dd67c7cf00d75db.zip | |
ARM: Add pcall() and xpcall() fast functions and unwinders.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buildvm_arm.dasc | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/src/buildvm_arm.dasc b/src/buildvm_arm.dasc index f3d32473..d2c3e5ca 100644 --- a/src/buildvm_arm.dasc +++ b/src/buildvm_arm.dasc | |||
| @@ -290,14 +290,34 @@ static void build_subroutines(BuildCtx *ctx) | |||
| 290 | | b <2 | 290 | | b <2 |
| 291 | | | 291 | | |
| 292 | |->vm_unwind_c: // Unwind C stack, return from vm_pcall. | 292 | |->vm_unwind_c: // Unwind C stack, return from vm_pcall. |
| 293 | | NYI | 293 | | // (void *cframe, int errcode) |
| 294 | | mov sp, CARG1 | ||
| 295 | | mov CRET1, CARG2 | ||
| 294 | |->vm_unwind_c_eh: // Landing pad for external unwinder. | 296 | |->vm_unwind_c_eh: // Landing pad for external unwinder. |
| 295 | | NYI | 297 | | ldr L, SAVE_L |
| 298 | | mv_vmstate CARG4, C | ||
| 299 | | ldr GL:CARG3, L->glref | ||
| 300 | | str CARG4, GL:CARG3->vmstate | ||
| 301 | | b ->vm_leave_unw | ||
| 296 | | | 302 | | |
| 297 | |->vm_unwind_ff: // Unwind C stack, return from ff pcall. | 303 | |->vm_unwind_ff: // Unwind C stack, return from ff pcall. |
| 298 | | NYI | 304 | | // (void *cframe) |
| 305 | | bic sp, CARG1, #~CFRAME_RAWMASK | ||
| 299 | |->vm_unwind_ff_eh: // Landing pad for external unwinder. | 306 | |->vm_unwind_ff_eh: // Landing pad for external unwinder. |
| 300 | | NYI | 307 | | ldr L, SAVE_L |
| 308 | | mov MASKR8, #255 | ||
| 309 | | mov RC, #16 // 2 results: false + error message. | ||
| 310 | | lsl MASKR8, MASKR8, #3 // MASKR8 = 255*8. | ||
| 311 | | ldr BASE, L->base | ||
| 312 | | ldr DISPATCH, L->glref // Setup pointer to dispatch table. | ||
| 313 | | mvn CARG1, #~LJ_TFALSE | ||
| 314 | | sub RA, BASE, #8 // Results start at BASE-8. | ||
| 315 | | ldr PC, [BASE, FRAME_PC] // Fetch PC of previous frame. | ||
| 316 | | add DISPATCH, DISPATCH, #GG_G2DISP | ||
| 317 | | mv_vmstate CARG2, INTERP | ||
| 318 | | str CARG1, [BASE, #-4] // Prepend false to error message. | ||
| 319 | | st_vmstate CARG2 | ||
| 320 | | b ->vm_returnc | ||
| 301 | | | 321 | | |
| 302 | |//----------------------------------------------------------------------- | 322 | |//----------------------------------------------------------------------- |
| 303 | |//-- Grow stack for calls ----------------------------------------------- | 323 | |//-- Grow stack for calls ----------------------------------------------- |
| @@ -688,10 +708,29 @@ static void build_subroutines(BuildCtx *ctx) | |||
| 688 | |//-- Base library: catch errors ---------------------------------------- | 708 | |//-- Base library: catch errors ---------------------------------------- |
| 689 | | | 709 | | |
| 690 | |.ffunc pcall | 710 | |.ffunc pcall |
| 691 | | NYI | 711 | | ldrb RA, [DISPATCH, #DISPATCH_GL(hookmask)] |
| 712 | | cmp NARGS8:RC, #8 | ||
| 713 | | blo ->fff_fallback | ||
| 714 | | tst RA, #HOOK_ACTIVE // Remember active hook before pcall. | ||
| 715 | | mov RB, BASE | ||
| 716 | | add BASE, BASE, #8 | ||
| 717 | | moveq PC, #8+FRAME_PCALL | ||
| 718 | | movne PC, #8+FRAME_PCALLH | ||
| 719 | | sub NARGS8:RC, NARGS8:RC, #8 | ||
| 720 | | b ->vm_call_dispatch | ||
| 692 | | | 721 | | |
| 693 | |.ffunc_2 xpcall | 722 | |.ffunc_2 xpcall |
| 694 | | NYI | 723 | | ldrb RA, [DISPATCH, #DISPATCH_GL(hookmask)] |
| 724 | | checkfunc CARG4, ->fff_fallback // Traceback must be a function. | ||
| 725 | | mov RB, BASE | ||
| 726 | | strd CARG12, [BASE, #8] // Swap function and traceback. | ||
| 727 | | strd CARG34, [BASE] | ||
| 728 | | tst RA, #HOOK_ACTIVE // Remember active hook before pcall. | ||
| 729 | | add BASE, BASE, #16 | ||
| 730 | | moveq PC, #16+FRAME_PCALL | ||
| 731 | | movne PC, #16+FRAME_PCALLH | ||
| 732 | | sub NARGS8:RC, NARGS8:RC, #16 | ||
| 733 | | b ->vm_call_dispatch | ||
| 695 | | | 734 | | |
| 696 | |//-- Coroutine library -------------------------------------------------- | 735 | |//-- Coroutine library -------------------------------------------------- |
| 697 | | | 736 | | |
