aboutsummaryrefslogtreecommitdiff
path: root/src/buildvm_x86.dasc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/buildvm_x86.dasc22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc
index f293cd23..5af00d38 100644
--- a/src/buildvm_x86.dasc
+++ b/src/buildvm_x86.dasc
@@ -437,8 +437,9 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
437 | 437 |
438 |->vm_return: 438 |->vm_return:
439 | // BASE = base, RA = resultofs, RD = nresults+1 (= MULTRES), PC = return 439 | // BASE = base, RA = resultofs, RD = nresults+1 (= MULTRES), PC = return
440 | test PC, FRAME_C 440 | xor PC, FRAME_C
441 | jz ->vm_returnp 441 | test PC, FRAME_TYPE
442 | jnz ->vm_returnp
442 | 443 |
443 | // Return to C. 444 | // Return to C.
444 | set_vmstate C 445 | set_vmstate C
@@ -4412,12 +4413,16 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4412 | jmp <4 4413 | jmp <4
4413 | 4414 |
4414 |7: // Tailcall from a vararg function. 4415 |7: // Tailcall from a vararg function.
4415 | jnp <1 // Vararg frame below? 4416 | sub PC, FRAME_VARG
4416 | and PC, -8 4417 | test PC, FRAME_TYPEP
4418 | jnz >8 // Vararg frame below?
4417 | sub BASE, PC // Need to relocate BASE/KBASE down. 4419 | sub BASE, PC // Need to relocate BASE/KBASE down.
4418 | mov KBASE, BASE 4420 | mov KBASE, BASE
4419 | mov PC, [BASE-4] 4421 | mov PC, [BASE-4]
4420 | jmp <1 4422 | jmp <1
4423 |8:
4424 | add PC, FRAME_VARG
4425 | jmp <1
4421 break; 4426 break;
4422 4427
4423 case BC_ITERC: 4428 case BC_ITERC:
@@ -4587,12 +4592,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4587 | jmp <5 4592 | jmp <5
4588 | 4593 |
4589 |7: // Non-standard return case. 4594 |7: // Non-standard return case.
4590 | jnp ->vm_return 4595 | lea RB, [PC-FRAME_VARG]
4596 | test RB, FRAME_TYPEP
4597 | jnz ->vm_return
4591 | // Return from vararg function: relocate BASE down and RA up. 4598 | // Return from vararg function: relocate BASE down and RA up.
4592 | and PC, -8 4599 | sub BASE, RB
4593 | sub BASE, PC
4594 if (op != BC_RET0) { 4600 if (op != BC_RET0) {
4595 | add RA, PC 4601 | add RA, RB
4596 } 4602 }
4597 | jmp <1 4603 | jmp <1
4598 break; 4604 break;