aboutsummaryrefslogtreecommitdiff
path: root/src/vm_mips.dasc
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm_mips.dasc')
-rw-r--r--src/vm_mips.dasc34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/vm_mips.dasc b/src/vm_mips.dasc
index aad4fccf..39d1521d 100644
--- a/src/vm_mips.dasc
+++ b/src/vm_mips.dasc
@@ -487,12 +487,13 @@ static void build_subroutines(BuildCtx *ctx)
487 | addiu DISPATCH, DISPATCH, GG_G2DISP 487 | addiu DISPATCH, DISPATCH, GG_G2DISP
488 | sw r0, SAVE_NRES 488 | sw r0, SAVE_NRES
489 | sw r0, SAVE_ERRF 489 | sw r0, SAVE_ERRF
490 | sw TMP0, L->cframe 490 | sw CARG1, SAVE_PC // Any value outside of bytecode is ok.
491 | sw r0, SAVE_CFRAME 491 | sw r0, SAVE_CFRAME
492 | beqz TMP1, >3 492 | beqz TMP1, >3
493 |. sw CARG1, SAVE_PC // Any value outside of bytecode is ok. 493 |. sw TMP0, L->cframe
494 | 494 |
495 | // Resume after yield (like a return). 495 | // Resume after yield (like a return).
496 | sw L, DISPATCH_GL(cur_L)(DISPATCH)
496 | move RA, BASE 497 | move RA, BASE
497 | lw BASE, L->base 498 | lw BASE, L->base
498 | lw TMP1, L->top 499 | lw TMP1, L->top
@@ -526,17 +527,18 @@ static void build_subroutines(BuildCtx *ctx)
526 | 527 |
527 |1: // Entry point for vm_pcall above (PC = ftype). 528 |1: // Entry point for vm_pcall above (PC = ftype).
528 | lw TMP1, L:CARG1->cframe 529 | lw TMP1, L:CARG1->cframe
529 | sw CARG3, SAVE_NRES
530 | move L, CARG1 530 | move L, CARG1
531 | sw CARG1, SAVE_L 531 | sw CARG3, SAVE_NRES
532 | move BASE, CARG2
533 | sw sp, L->cframe // Add our C frame to cframe chain.
534 | lw DISPATCH, L->glref // Setup pointer to dispatch table. 532 | lw DISPATCH, L->glref // Setup pointer to dispatch table.
533 | sw CARG1, SAVE_L
534 | move BASE, CARG2
535 | addiu DISPATCH, DISPATCH, GG_G2DISP
535 | sw CARG1, SAVE_PC // Any value outside of bytecode is ok. 536 | sw CARG1, SAVE_PC // Any value outside of bytecode is ok.
536 | sw TMP1, SAVE_CFRAME 537 | sw TMP1, SAVE_CFRAME
537 | addiu DISPATCH, DISPATCH, GG_G2DISP 538 | sw sp, L->cframe // Add our C frame to cframe chain.
538 | 539 |
539 |3: // Entry point for vm_cpcall/vm_resume (BASE = base, PC = ftype). 540 |3: // Entry point for vm_cpcall/vm_resume (BASE = base, PC = ftype).
541 | sw L, DISPATCH_GL(cur_L)(DISPATCH)
540 | lw TMP2, L->base // TMP2 = old base (used in vmeta_call). 542 | lw TMP2, L->base // TMP2 = old base (used in vmeta_call).
541 | lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float). 543 | lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float).
542 | lw TMP1, L->top 544 | lw TMP1, L->top
@@ -567,20 +569,21 @@ static void build_subroutines(BuildCtx *ctx)
567 | lw TMP0, L:CARG1->stack 569 | lw TMP0, L:CARG1->stack
568 | sw CARG1, SAVE_L 570 | sw CARG1, SAVE_L
569 | lw TMP1, L->top 571 | lw TMP1, L->top
572 | lw DISPATCH, L->glref // Setup pointer to dispatch table.
570 | sw CARG1, SAVE_PC // Any value outside of bytecode is ok. 573 | sw CARG1, SAVE_PC // Any value outside of bytecode is ok.
571 | subu TMP0, TMP0, TMP1 // Compute -savestack(L, L->top). 574 | subu TMP0, TMP0, TMP1 // Compute -savestack(L, L->top).
572 | lw TMP1, L->cframe 575 | lw TMP1, L->cframe
573 | sw sp, L->cframe // Add our C frame to cframe chain. 576 | addiu DISPATCH, DISPATCH, GG_G2DISP
574 | sw TMP0, SAVE_NRES // Neg. delta means cframe w/o frame. 577 | sw TMP0, SAVE_NRES // Neg. delta means cframe w/o frame.
575 | sw r0, SAVE_ERRF // No error function. 578 | sw r0, SAVE_ERRF // No error function.
576 | move CFUNCADDR, CARG4 579 | sw TMP1, SAVE_CFRAME
580 | sw sp, L->cframe // Add our C frame to cframe chain.
581 | sw L, DISPATCH_GL(cur_L)(DISPATCH)
577 | jalr CARG4 // (lua_State *L, lua_CFunction func, void *ud) 582 | jalr CARG4 // (lua_State *L, lua_CFunction func, void *ud)
578 |. sw TMP1, SAVE_CFRAME 583 |. move CFUNCADDR, CARG4
579 | move BASE, CRET1 584 | move BASE, CRET1
580 | lw DISPATCH, L->glref // Setup pointer to dispatch table.
581 | li PC, FRAME_CP
582 | bnez CRET1, <3 // Else continue with the call. 585 | bnez CRET1, <3 // Else continue with the call.
583 |. addiu DISPATCH, DISPATCH, GG_G2DISP 586 |. li PC, FRAME_CP
584 | b ->vm_leave_cp // No base? Just remove C frame. 587 | b ->vm_leave_cp // No base? Just remove C frame.
585 |. nop 588 |. nop
586 | 589 |
@@ -1364,6 +1367,7 @@ static void build_subroutines(BuildCtx *ctx)
1364 | lw TMP3, L:RA->top 1367 | lw TMP3, L:RA->top
1365 | li_vmstate INTERP 1368 | li_vmstate INTERP
1366 | lw BASE, L->base 1369 | lw BASE, L->base
1370 | sw L, DISPATCH_GL(cur_L)(DISPATCH)
1367 | st_vmstate 1371 | st_vmstate
1368 | beqz AT, >8 1372 | beqz AT, >8
1369 |. subu RD, TMP3, TMP2 1373 |. subu RD, TMP3, TMP2
@@ -2045,7 +2049,7 @@ static void build_subroutines(BuildCtx *ctx)
2045 | lw TMP1, 0(TMP2) // Load exit number. 2049 | lw TMP1, 0(TMP2) // Load exit number.
2046 | st_vmstate 2050 | st_vmstate
2047 | sw TMP2, 16+32*8+29*4(sp) // Store sp in RID_SP. 2051 | sw TMP2, 16+32*8+29*4(sp) // Store sp in RID_SP.
2048 | lw L, DISPATCH_GL(jit_L)(DISPATCH) 2052 | lw L, DISPATCH_GL(cur_L)(DISPATCH)
2049 | lw BASE, DISPATCH_GL(jit_base)(DISPATCH) 2053 | lw BASE, DISPATCH_GL(jit_base)(DISPATCH)
2050 | load_got lj_trace_exit 2054 | load_got lj_trace_exit
2051 | sw L, DISPATCH_J(L)(DISPATCH) 2055 | sw L, DISPATCH_J(L)(DISPATCH)
@@ -3980,7 +3984,6 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
3980 | sw AT, DISPATCH_GL(vmstate)(DISPATCH) 3984 | sw AT, DISPATCH_GL(vmstate)(DISPATCH)
3981 | lw TRACE:TMP2, 0(TMP1) 3985 | lw TRACE:TMP2, 0(TMP1)
3982 | sw BASE, DISPATCH_GL(jit_base)(DISPATCH) 3986 | sw BASE, DISPATCH_GL(jit_base)(DISPATCH)
3983 | sw L, DISPATCH_GL(jit_L)(DISPATCH)
3984 | lw TMP2, TRACE:TMP2->mcode 3987 | lw TMP2, TRACE:TMP2->mcode
3985 | sw L, DISPATCH_GL(tmpbuf.L)(DISPATCH) 3988 | sw L, DISPATCH_GL(tmpbuf.L)(DISPATCH)
3986 | jr TMP2 3989 | jr TMP2
@@ -4108,6 +4111,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
4108 | li_vmstate INTERP 4111 | li_vmstate INTERP
4109 | lw PC, FRAME_PC(BASE) // Fetch PC of caller. 4112 | lw PC, FRAME_PC(BASE) // Fetch PC of caller.
4110 | subu RA, TMP1, RD // RA = L->top - nresults*8 4113 | subu RA, TMP1, RD // RA = L->top - nresults*8
4114 | sw L, DISPATCH_GL(cur_L)(DISPATCH)
4111 | b ->vm_returnc 4115 | b ->vm_returnc
4112 |. st_vmstate 4116 |. st_vmstate
4113 break; 4117 break;