summaryrefslogtreecommitdiff
path: root/src/buildvm_x86.dasc
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildvm_x86.dasc')
-rw-r--r--src/buildvm_x86.dasc29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc
index 69672adc..bc128457 100644
--- a/src/buildvm_x86.dasc
+++ b/src/buildvm_x86.dasc
@@ -2393,37 +2393,38 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
2393 |.endif 2393 |.endif
2394 | call aword CFUNC:RD->f // (lua_State *L) 2394 | call aword CFUNC:RD->f // (lua_State *L)
2395 | mov BASE, L:RB->base 2395 | mov BASE, L:RB->base
2396 | // Either throws an error or recovers and returns 0 or MULTRES (+1). 2396 | // Either throws an error, or recovers and returns -1, 0 or nresults+1.
2397 | test RD, RD; jnz ->fff_res // Returned MULTRES (already in RD). 2397 | test RD, RD; jg ->fff_res // Returned nresults+1?
2398 |1: // Returned 0: retry fast path. 2398 |1:
2399 | mov RD, L:RB->top 2399 | mov RA, L:RB->top
2400 | sub RD, BASE 2400 | sub RA, BASE
2401 | shr RD, 3 2401 | shr RA, 3
2402 | add NARGS:RD, 1 2402 | test RD, RD
2403 | lea NARGS:RD, [RA+1]
2403 | mov LFUNC:RB, [BASE-8] 2404 | mov LFUNC:RB, [BASE-8]
2404 | cmp dword [BASE-4], PC 2405 | jne >2 // Returned -1?
2405 | jne >2 // Tailcalled? 2406 | ins_callt // Returned 0: retry fast path.
2406 | ins_callt // Retry the call.
2407 | 2407 |
2408 |2: // Reconstruct previous base for vmeta_call. 2408 |2: // Reconstruct previous base for vmeta_call during tailcall.
2409 | mov RA, BASE 2409 | mov RA, BASE
2410 | test PC, FRAME_TYPE 2410 | test PC, FRAME_TYPE
2411 | jnz >3 2411 | jnz >3
2412 | movzx RB, PC_RA 2412 | movzx RB, PC_RA
2413 | not RBa // Note: ~RB = -(RB+1) 2413 | not RBa // Note: ~RB = -(RB+1)
2414 | lea BASE, [BASE+RB*8] // base = base - (RB+1)*8 2414 | lea BASE, [BASE+RB*8] // base = base - (RB+1)*8
2415 | jmp ->vm_call_dispatch // Resolve again. 2415 | jmp ->vm_call_dispatch // Resolve again for tailcall.
2416 |3: 2416 |3:
2417 | mov RB, PC 2417 | mov RB, PC
2418 | and RB, -8 2418 | and RB, -8
2419 | sub BASE, RB 2419 | sub BASE, RB
2420 | jmp ->vm_call_dispatch // Resolve again. 2420 | jmp ->vm_call_dispatch // Resolve again for tailcall.
2421 | 2421 |
2422 |5: // Grow stack for fallback handler. 2422 |5: // Grow stack for fallback handler.
2423 | mov FCARG2, LUA_MINSTACK 2423 | mov FCARG2, LUA_MINSTACK
2424 | mov FCARG1, L:RB 2424 | mov FCARG1, L:RB
2425 | call extern lj_state_growstack@8 // (lua_State *L, int n) 2425 | call extern lj_state_growstack@8 // (lua_State *L, int n)
2426 | mov BASE, L:RB->base 2426 | mov BASE, L:RB->base
2427 | xor RD, RD // Simulate a return 0.
2427 | jmp <1 // Dumb retry (goes through ff first). 2428 | jmp <1 // Dumb retry (goes through ff first).
2428 | 2429 |
2429 |->fff_gcstep: // Call GC step function. 2430 |->fff_gcstep: // Call GC step function.
@@ -4366,7 +4367,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4366 case BC_CALLMT: 4367 case BC_CALLMT:
4367 | ins_AD // RA = base, RD = extra_nargs 4368 | ins_AD // RA = base, RD = extra_nargs
4368 | add NARGS:RD, MULTRES 4369 | add NARGS:RD, MULTRES
4369 | // Fall through. Assumes BC_CALLMT follows and ins_AD is a no-op. 4370 | // Fall through. Assumes BC_CALLT follows and ins_AD is a no-op.
4370 break; 4371 break;
4371 case BC_CALLT: 4372 case BC_CALLT:
4372 | ins_AD // RA = base, RD = nargs+1 4373 | ins_AD // RA = base, RD = nargs+1