aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2009-12-30 02:38:40 +0100
committerMike Pall <mike>2009-12-30 02:38:40 +0100
commit8fc9430d067e255202f6b89fae7065bc50e0c668 (patch)
treed05aebc6f53894d8f07410ab00a8565c8954aae7 /src
parent9de0f53a8db3a4d3fa1951ff08aaab392dc7a584 (diff)
downloadluajit-8fc9430d067e255202f6b89fae7065bc50e0c668.tar.gz
luajit-8fc9430d067e255202f6b89fae7065bc50e0c668.tar.bz2
luajit-8fc9430d067e255202f6b89fae7065bc50e0c668.zip
Rename NRESULTS to MULTRES on the assembler side, too.
Diffstat (limited to 'src')
-rw-r--r--src/buildvm_x86.dasc66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc
index 952fc9d6..b9dddd1f 100644
--- a/src/buildvm_x86.dasc
+++ b/src/buildvm_x86.dasc
@@ -147,12 +147,12 @@
147|// FPARGx overlaps ARGx and ARG(x+1) on x86. 147|// FPARGx overlaps ARGx and ARG(x+1) on x86.
148|.define FPARG3, qword [esp+qword*1] 148|.define FPARG3, qword [esp+qword*1]
149|.define FPARG1, qword [esp] 149|.define FPARG1, qword [esp]
150|// TMPQ overlaps TMP1/TMP2. ARG5/NRESULTS overlap TMP1/TMP2 (and TMPQ). 150|// TMPQ overlaps TMP1/TMP2. ARG5/MULTRES overlap TMP1/TMP2 (and TMPQ).
151|.define TMPQ, qword [esp+aword*4] 151|.define TMPQ, qword [esp+aword*4]
152|.define TMP3, ARG4 152|.define TMP3, ARG4
153|.define ARG5, TMP1 153|.define ARG5, TMP1
154|.define TMPa, TMP1 154|.define TMPa, TMP1
155|.define NRESULTS, TMP2 155|.define MULTRES, TMP2
156| 156|
157|// Arguments for vm_call and vm_pcall. 157|// Arguments for vm_call and vm_pcall.
158|.define INARG_BASE, SAVE_CFRAME // Overwritten by SAVE_CFRAME! 158|.define INARG_BASE, SAVE_CFRAME // Overwritten by SAVE_CFRAME!
@@ -201,9 +201,9 @@
201|.define CSAVE_1, aword [rsp] //<-- rsp while in interpreter. 201|.define CSAVE_1, aword [rsp] //<-- rsp while in interpreter.
202|//----- 16 byte aligned, ^^^ 32 byte register save area, owned by callee 202|//----- 16 byte aligned, ^^^ 32 byte register save area, owned by callee
203| 203|
204|// TMPQ overlaps TMP1/TMP2. NRESULTS overlaps TMP2 (and TMPQ). 204|// TMPQ overlaps TMP1/TMP2. MULTRES overlaps TMP2 (and TMPQ).
205|.define TMPQ, qword [rsp+aword*14] 205|.define TMPQ, qword [rsp+aword*14]
206|.define NRESULTS, TMP2 206|.define MULTRES, TMP2
207|.define TMPa, ARG5 207|.define TMPa, ARG5
208|.define ARG5d, dword [rsp+aword*4] 208|.define ARG5d, dword [rsp+aword*4]
209|.define TMP3, ARG5d 209|.define TMP3, ARG5d
@@ -240,10 +240,10 @@
240|.define TMP1, dword [rsp] //<-- rsp while in interpreter. 240|.define TMP1, dword [rsp] //<-- rsp while in interpreter.
241|//----- 16 byte aligned 241|//----- 16 byte aligned
242| 242|
243|// TMPQ overlaps TMP1/TMP2. NRESULTS overlaps TMP2 (and TMPQ). 243|// TMPQ overlaps TMP1/TMP2. MULTRES overlaps TMP2 (and TMPQ).
244|.define TMPQ, qword [rsp] 244|.define TMPQ, qword [rsp]
245|.define TMP3, dword [rsp+aword*3] 245|.define TMP3, dword [rsp+aword*3]
246|.define NRESULTS, TMP2 246|.define MULTRES, TMP2
247| 247|
248|.endif 248|.endif
249| 249|
@@ -504,7 +504,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
504 | add RA, L:RB->top // RA = (L->top-(L->base+nresults))*8 504 | add RA, L:RB->top // RA = (L->top-(L->base+nresults))*8
505 |->vm_returnc: 505 |->vm_returnc:
506 | add RD, 1 // RD = nresults+1 506 | add RD, 1 // RD = nresults+1
507 | mov NRESULTS, RD 507 | mov MULTRES, RD
508 | test PC, FRAME_TYPE 508 | test PC, FRAME_TYPE
509 | jz ->BC_RET_Z // Handle regular return to Lua. 509 | jz ->BC_RET_Z // Handle regular return to Lua.
510 | jmp ->vm_return 510 | jmp ->vm_return
@@ -535,7 +535,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
535 | add RA, L:RB->top // RA = (L->top-(L->base+nresults))*8 535 | add RA, L:RB->top // RA = (L->top-(L->base+nresults))*8
536 |->vm_returnc: 536 |->vm_returnc:
537 | add RD, 1 // RD = nresults+1 537 | add RD, 1 // RD = nresults+1
538 | mov NRESULTS, RD 538 | mov MULTRES, RD
539 | test PC, FRAME_TYPE 539 | test PC, FRAME_TYPE
540 | jz ->BC_RET_Z // Handle regular return to Lua. 540 | jz ->BC_RET_Z // Handle regular return to Lua.
541 | // Fallthrough. 541 | // Fallthrough.
@@ -543,7 +543,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
543 |//-- Return handling (non-inline) --------------------------------------- 543 |//-- Return handling (non-inline) ---------------------------------------
544 | 544 |
545 |->vm_return: 545 |->vm_return:
546 | // BASE = base, RA = resultofs, RD = nresults+1 (= NRESULTS), PC = return 546 | // BASE = base, RA = resultofs, RD = nresults+1 (= MULTRES), PC = return
547 | test PC, FRAME_C 547 | test PC, FRAME_C
548 | jz ->vm_returnp 548 | jz ->vm_returnp
549 | 549 |
@@ -567,7 +567,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
567 | mov L:RB, SAVE_L 567 | mov L:RB, SAVE_L
568 | mov L:RB->base, PC 568 | mov L:RB->base, PC
569 |3: 569 |3:
570 | mov RD, NRESULTS 570 | mov RD, MULTRES
571 | mov RA, SAVE_NRES // RA = wanted nresults+1 571 | mov RA, SAVE_NRES // RA = wanted nresults+1
572 |4: 572 |4:
573 | cmp RA, RD 573 | cmp RA, RD
@@ -608,7 +608,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
608 | // - The GC shrinks the stack in between. 608 | // - The GC shrinks the stack in between.
609 | // - A return back from a lua_call() with (high) nresults adjustment. 609 | // - A return back from a lua_call() with (high) nresults adjustment.
610 | mov L:RB->top, BASE // Save current top held in BASE (yes). 610 | mov L:RB->top, BASE // Save current top held in BASE (yes).
611 | mov NRESULTS, RD // Need to fill only remainder with nil. 611 | mov MULTRES, RD // Need to fill only remainder with nil.
612 | mov FCARG2, RA 612 | mov FCARG2, RA
613 | mov FCARG1, L:RB 613 | mov FCARG1, L:RB
614 | call extern lj_state_growstack@8 // (lua_State *L, int n) 614 | call extern lj_state_growstack@8 // (lua_State *L, int n)
@@ -649,7 +649,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
649 | mov PC, [BASE-4] // Fetch PC of previous frame. 649 | mov PC, [BASE-4] // Fetch PC of previous frame.
650 | mov dword [BASE-4], LJ_TFALSE // Prepend false to error message. 650 | mov dword [BASE-4], LJ_TFALSE // Prepend false to error message.
651 | set_vmstate INTERP 651 | set_vmstate INTERP
652 | jmp ->vm_returnc // Increments RD/NRESULTS and returns. 652 | jmp ->vm_returnc // Increments RD/MULTRES and returns.
653 | 653 |
654 |->vm_returnp: 654 |->vm_returnp:
655 | test PC, FRAME_P 655 | test PC, FRAME_P
@@ -662,7 +662,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
662 | mov PC, [BASE-4] // Fetch PC of previous frame. 662 | mov PC, [BASE-4] // Fetch PC of previous frame.
663 | // Prepending may overwrite the pcall frame, so do it at the end. 663 | // Prepending may overwrite the pcall frame, so do it at the end.
664 | mov dword [BASE+RA+4], LJ_TTRUE // Prepend true to results. 664 | mov dword [BASE+RA+4], LJ_TTRUE // Prepend true to results.
665 | jmp ->vm_returnc // Increments RD/NRESULTS and returns. 665 | jmp ->vm_returnc // Increments RD/MULTRES and returns.
666 | 666 |
667 |//-- Grow stack on-demand ----------------------------------------------- 667 |//-- Grow stack on-demand -----------------------------------------------
668 | 668 |
@@ -743,7 +743,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
743 | add RD, 1 // RD = nresults+1 743 | add RD, 1 // RD = nresults+1
744 | sub RA, BASE // RA = resultofs 744 | sub RA, BASE // RA = resultofs
745 | mov PC, [BASE-4] 745 | mov PC, [BASE-4]
746 | mov NRESULTS, RD 746 | mov MULTRES, RD
747 | test PC, FRAME_TYPE 747 | test PC, FRAME_TYPE
748 | jz ->BC_RET_Z 748 | jz ->BC_RET_Z
749 | jmp ->vm_return 749 | jmp ->vm_return
@@ -855,7 +855,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
855 |//-- Continuation dispatch ---------------------------------------------- 855 |//-- Continuation dispatch ----------------------------------------------
856 | 856 |
857 |->cont_dispatch: 857 |->cont_dispatch:
858 | // BASE = meta base, RA = resultofs, RD = nresults+1 (also in NRESULTS) 858 | // BASE = meta base, RA = resultofs, RD = nresults+1 (also in MULTRES)
859 | add RA, BASE 859 | add RA, BASE
860 | and PC, -8 860 | and PC, -8
861 | mov RB, BASE 861 | mov RB, BASE
@@ -1356,7 +1356,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
1356 |.ffunc_1 assert 1356 |.ffunc_1 assert
1357 | mov RB, [RA+4] 1357 | mov RB, [RA+4]
1358 | cmp RB, LJ_TISTRUECOND; jae ->fff_fallback 1358 | cmp RB, LJ_TISTRUECOND; jae ->fff_fallback
1359 | mov NRESULTS, RD 1359 | mov MULTRES, RD
1360 | mov [RA-4], RB 1360 | mov [RA-4], RB
1361 | mov RB, [RA] 1361 | mov RB, [RA]
1362 | mov [RA-8], RB 1362 | mov [RA-8], RB
@@ -1373,7 +1373,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
1373 | jnz <1 1373 | jnz <1
1374 | mov RA, TMP1 1374 | mov RA, TMP1
1375 |2: 1375 |2:
1376 | mov RD, NRESULTS 1376 | mov RD, MULTRES
1377 | jmp ->fff_res_ 1377 | jmp ->fff_res_
1378 | 1378 |
1379 |.ffunc_1 type 1379 |.ffunc_1 type
@@ -1807,7 +1807,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
1807 |.endif 1807 |.endif
1808 |7: 1808 |7:
1809 | mov PC, SAVE_PC 1809 | mov PC, SAVE_PC
1810 | mov NRESULTS, RD 1810 | mov MULTRES, RD
1811 |.if resume 1811 |.if resume
1812 | mov RAa, -8 1812 | mov RAa, -8
1813 |.else 1813 |.else
@@ -1891,7 +1891,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
1891 |->fff_res1: 1891 |->fff_res1:
1892 | mov RD, 1+1 1892 | mov RD, 1+1
1893 |->fff_res: 1893 |->fff_res:
1894 | mov NRESULTS, RD 1894 | mov MULTRES, RD
1895 |->fff_res_: 1895 |->fff_res_:
1896 | test PC, FRAME_TYPE 1896 | test PC, FRAME_TYPE
1897 | jnz >7 1897 | jnz >7
@@ -2528,7 +2528,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
2528 | mov ARG1, L:RB 2528 | mov ARG1, L:RB
2529 |.endif 2529 |.endif
2530 | call aword CFUNC:RC->f // (lua_State *L) 2530 | call aword CFUNC:RC->f // (lua_State *L)
2531 | // Either throws an error or recovers and returns 0 or NRESULTS (+1). 2531 | // Either throws an error or recovers and returns 0 or MULTRES (+1).
2532 | test RC, RC; jnz >3 2532 | test RC, RC; jnz >3
2533 |1: // Returned 0: retry fast path. 2533 |1: // Returned 0: retry fast path.
2534 | mov RA, L:RB->base 2534 | mov RA, L:RB->base
@@ -2547,7 +2547,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
2547 | jne ->vmeta_call 2547 | jne ->vmeta_call
2548 | jmp aword LFUNC:RB->gate // Retry the call. 2548 | jmp aword LFUNC:RB->gate // Retry the call.
2549 | 2549 |
2550 |3: // Returned NRESULTS (already in RC/RD). 2550 |3: // Returned MULTRES (already in RC/RD).
2551 | mov RA, L:RB->base 2551 | mov RA, L:RB->base
2552 | mov BASE, TMP1 // Restore old BASE. 2552 | mov BASE, TMP1 // Restore old BASE.
2553 | add BASE, RA 2553 | add BASE, RA
@@ -2638,7 +2638,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
2638 |->cont_hook: // Continue from hook yield. 2638 |->cont_hook: // Continue from hook yield.
2639 | add PC, 4 2639 | add PC, 4
2640 | mov RA, [RB-24] 2640 | mov RA, [RB-24]
2641 | mov NRESULTS, RA // Restore NRESULTS for *M ins. 2641 | mov MULTRES, RA // Restore MULTRES for *M ins.
2642 | jmp <4 2642 | jmp <4
2643 | 2643 |
2644 |->vm_hotloop: // Hot loop counter underflow. 2644 |->vm_hotloop: // Hot loop counter underflow.
@@ -4345,7 +4345,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4345 | test byte TAB:RB->marked, LJ_GC_BLACK // isblack(table) 4345 | test byte TAB:RB->marked, LJ_GC_BLACK // isblack(table)
4346 | jnz >7 4346 | jnz >7
4347 |2: 4347 |2:
4348 | mov RD, NRESULTS 4348 | mov RD, MULTRES
4349 if (sse) { 4349 if (sse) {
4350 | cvtsd2si KBASE, xmm0 // Const is guaranteed to be an int. 4350 | cvtsd2si KBASE, xmm0 // Const is guaranteed to be an int.
4351 } else { 4351 } else {
@@ -4404,7 +4404,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4404 case BC_CALL: case BC_CALLM: 4404 case BC_CALL: case BC_CALLM:
4405 | ins_A_C // RA = base, (RB = nresults+1,) RC = nargs+1 | extra_nargs 4405 | ins_A_C // RA = base, (RB = nresults+1,) RC = nargs+1 | extra_nargs
4406 if (op == BC_CALLM) { 4406 if (op == BC_CALLM) {
4407 | add NARGS:RC, NRESULTS 4407 | add NARGS:RC, MULTRES
4408 } 4408 }
4409 | lea RA, [BASE+RA*8+8] 4409 | lea RA, [BASE+RA*8+8]
4410 | mov LFUNC:RB, [RA-8] 4410 | mov LFUNC:RB, [RA-8]
@@ -4415,7 +4415,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4415 4415
4416 case BC_CALLMT: 4416 case BC_CALLMT:
4417 | ins_AD // RA = base, RD = extra_nargs 4417 | ins_AD // RA = base, RD = extra_nargs
4418 | add NARGS:RD, NRESULTS 4418 | add NARGS:RD, MULTRES
4419 | // Fall through. Assumes BC_CALLMT follows and ins_AD is a no-op. 4419 | // Fall through. Assumes BC_CALLMT follows and ins_AD is a no-op.
4420 break; 4420 break;
4421 case BC_CALLT: 4421 case BC_CALLT:
@@ -4431,7 +4431,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4431 | jnz >7 4431 | jnz >7
4432 |1: 4432 |1:
4433 | mov [BASE-8], LFUNC:RB // Copy function down, reloaded below. 4433 | mov [BASE-8], LFUNC:RB // Copy function down, reloaded below.
4434 | mov NRESULTS, NARGS:RD 4434 | mov MULTRES, NARGS:RD
4435 | sub NARGS:RD, 1 4435 | sub NARGS:RD, 1
4436 | jz >3 4436 | jz >3
4437 |2: 4437 |2:
@@ -4450,7 +4450,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4450 | cmp byte LFUNC:RB->ffid, 1 // (> FF_C) Calling a fast function? 4450 | cmp byte LFUNC:RB->ffid, 1 // (> FF_C) Calling a fast function?
4451 | ja >5 4451 | ja >5
4452 |4: 4452 |4:
4453 | mov NARGS:RD, NRESULTS 4453 | mov NARGS:RD, MULTRES
4454 | jmp aword LFUNC:RB->gate 4454 | jmp aword LFUNC:RB->gate
4455 | 4455 |
4456 |5: // Tailcall to a fast function. 4456 |5: // Tailcall to a fast function.
@@ -4530,14 +4530,14 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4530 | ins_next 4530 | ins_next
4531 | 4531 |
4532 |5: // Copy all varargs. 4532 |5: // Copy all varargs.
4533 | mov NRESULTS, 1 // NRESULTS = 0+1 4533 | mov MULTRES, 1 // MULTRES = 0+1
4534 | mov RC, BASE 4534 | mov RC, BASE
4535 | sub RC, KBASE 4535 | sub RC, KBASE
4536 | jbe <3 // No vararg slots? 4536 | jbe <3 // No vararg slots?
4537 | mov RB, RC 4537 | mov RB, RC
4538 | shr RB, 3 4538 | shr RB, 3
4539 | add RB, 1 4539 | add RB, 1
4540 | mov NRESULTS, RB // NRESULTS = #varargs+1 4540 | mov MULTRES, RB // MULTRES = #varargs+1
4541 | mov L:RB, SAVE_L 4541 | mov L:RB, SAVE_L
4542 | add RC, RA 4542 | add RC, RA
4543 | cmp RC, L:RB->maxstack 4543 | cmp RC, L:RB->maxstack
@@ -4558,7 +4558,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4558 | mov L:RB->top, RA 4558 | mov L:RB->top, RA
4559 | mov SAVE_PC, PC 4559 | mov SAVE_PC, PC
4560 | sub KBASE, BASE // Need delta, because BASE may change. 4560 | sub KBASE, BASE // Need delta, because BASE may change.
4561 | mov FCARG2, NRESULTS 4561 | mov FCARG2, MULTRES
4562 | sub FCARG2, 1 4562 | sub FCARG2, 1
4563 | mov FCARG1, L:RB 4563 | mov FCARG1, L:RB
4564 | call extern lj_state_growstack@8 // (lua_State *L, int n) 4564 | call extern lj_state_growstack@8 // (lua_State *L, int n)
@@ -4572,7 +4572,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4572 4572
4573 case BC_RETM: 4573 case BC_RETM:
4574 | ins_AD // RA = results, RD = extra_nresults 4574 | ins_AD // RA = results, RD = extra_nresults
4575 | add RD, NRESULTS // NRESULTS >=1, so RD >=1. 4575 | add RD, MULTRES // MULTRES >=1, so RD >=1.
4576 | // Fall through. Assumes BC_RET follows and ins_AD is a no-op. 4576 | // Fall through. Assumes BC_RET follows and ins_AD is a no-op.
4577 break; 4577 break;
4578 4578
@@ -4583,7 +4583,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4583 } 4583 }
4584 |1: 4584 |1:
4585 | mov PC, [BASE-4] 4585 | mov PC, [BASE-4]
4586 | mov NRESULTS, RD // Save nresults+1. 4586 | mov MULTRES, RD // Save nresults+1.
4587 | test PC, FRAME_TYPE // Check frame type marker. 4587 | test PC, FRAME_TYPE // Check frame type marker.
4588 | jnz >7 // Not returning to a fixarg Lua func? 4588 | jnz >7 // Not returning to a fixarg Lua func?
4589 switch (op) { 4589 switch (op) {
@@ -4601,7 +4601,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4601 | sub RD, 1 4601 | sub RD, 1
4602 | jnz <2 4602 | jnz <2
4603 |3: 4603 |3:
4604 | mov RD, NRESULTS // Note: NRESULTS may be >255. 4604 | mov RD, MULTRES // Note: MULTRES may be >255.
4605 | movzx RB, PC_RB // So cannot compare with RDL! 4605 | movzx RB, PC_RB // So cannot compare with RDL!
4606 |5: 4606 |5:
4607 | cmp RB, RD // More results expected? 4607 | cmp RB, RD // More results expected?