diff options
| author | Mike Pall <mike> | 2010-09-11 01:46:11 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2010-09-11 01:46:11 +0200 |
| commit | e15e4c4d95944da45092b4499b5f0e4d63f6bd01 (patch) | |
| tree | adfeb776eb1e01ef319692ea55b25ad7b3786a22 | |
| parent | daafc0b2a272c2d807959d46b529daaa78cfbb77 (diff) | |
| download | luajit-e15e4c4d95944da45092b4499b5f0e4d63f6bd01.tar.gz luajit-e15e4c4d95944da45092b4499b5f0e4d63f6bd01.tar.bz2 luajit-e15e4c4d95944da45092b4499b5f0e4d63f6bd01.zip | |
PPC: Add metamethod handlers for call instructions.
| -rw-r--r-- | src/buildvm_ppc.dasc | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc index 66ae819c..6a13cace 100644 --- a/src/buildvm_ppc.dasc +++ b/src/buildvm_ppc.dasc | |||
| @@ -573,14 +573,32 @@ static void build_subroutines(BuildCtx *ctx) | |||
| 573 | | | 573 | | |
| 574 | |//-- Call metamethod ---------------------------------------------------- | 574 | |//-- Call metamethod ---------------------------------------------------- |
| 575 | | | 575 | | |
| 576 | |->vmeta_call_ra: | ||
| 577 | | NYI | ||
| 578 | | | ||
| 579 | |->vmeta_call: // Resolve and call __call metamethod. | 576 | |->vmeta_call: // Resolve and call __call metamethod. |
| 580 | | NYI | 577 | | // TMP2 = old base, BASE = new base, RC = nargs*8 |
| 578 | | mr CARG1, L | ||
| 579 | | stw TMP2, L->base // This is the callers base! | ||
| 580 | | subi CARG2, BASE, 8 | ||
| 581 | | stw PC, SAVE_PC | ||
| 582 | | add CARG3, BASE, RC | ||
| 583 | | mr SAVE0, NARGS8:RC | ||
| 584 | | bl extern lj_meta_call // (lua_State *L, TValue *func, TValue *top) | ||
| 585 | | lwz LFUNC:RB, FRAME_FUNC(BASE) // Guaranteed to be a function here. | ||
| 586 | | addi NARGS8:RC, SAVE0, 8 // Got one more argument now. | ||
| 587 | | ins_call | ||
| 581 | | | 588 | | |
| 582 | |->vmeta_callt: // Resolve __call for BC_CALLT. | 589 | |->vmeta_callt: // Resolve __call for BC_CALLT. |
| 583 | | NYI | 590 | | // BASE = old base, RA = new base, RC = nargs*8 |
| 591 | | mr CARG1, L | ||
| 592 | | stw BASE, L->base | ||
| 593 | | subi CARG2, RA, 8 | ||
| 594 | | stw PC, SAVE_PC | ||
| 595 | | add CARG3, RA, RC | ||
| 596 | | mr SAVE0, NARGS8:RC | ||
| 597 | | bl extern lj_meta_call // (lua_State *L, TValue *func, TValue *top) | ||
| 598 | | lwz TMP1, FRAME_PC(BASE) | ||
| 599 | | addi NARGS8:RC, SAVE0, 8 // Got one more argument now. | ||
| 600 | | lwz LFUNC:RB, FRAME_FUNC(BASE) // Guaranteed to be a function here. | ||
| 601 | | b ->BC_CALLT_Z | ||
| 584 | | | 602 | | |
| 585 | |//-- Argument coercion for 'for' statement ------------------------------ | 603 | |//-- Argument coercion for 'for' statement ------------------------------ |
| 586 | | | 604 | | |
