aboutsummaryrefslogtreecommitdiff
path: root/src/buildvm_x86.dasc
diff options
context:
space:
mode:
authorMike Pall <mike>2009-12-17 22:08:20 +0100
committerMike Pall <mike>2009-12-17 22:08:20 +0100
commit6adab430afd9804d616b49658d09ab25c9380725 (patch)
tree155629b9598bc975c93454fd0ae6e88edfbad3c2 /src/buildvm_x86.dasc
parent1353acacb16fe988a9c68f1e6ccafb5ac28686e8 (diff)
downloadluajit-6adab430afd9804d616b49658d09ab25c9380725.tar.gz
luajit-6adab430afd9804d616b49658d09ab25c9380725.tar.bz2
luajit-6adab430afd9804d616b49658d09ab25c9380725.zip
Adapt primary inbound calls in x64 interpreter.
Change argument order for lj_vm_cpcall() to simplify x64 interpreter.
Diffstat (limited to 'src/buildvm_x86.dasc')
-rw-r--r--src/buildvm_x86.dasc145
1 files changed, 115 insertions, 30 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc
index c781725f..384af0d2 100644
--- a/src/buildvm_x86.dasc
+++ b/src/buildvm_x86.dasc
@@ -21,14 +21,17 @@
21|.define BASE, edx // Not C callee-save, refetched anyway. 21|.define BASE, edx // Not C callee-save, refetched anyway.
22|.if not X64 or X64WIN 22|.if not X64 or X64WIN
23|.define KBASE, edi // Must be C callee-save. 23|.define KBASE, edi // Must be C callee-save.
24|.define KBASEa, KBASE
24|.define PC, esi // Must be C callee-save. 25|.define PC, esi // Must be C callee-save.
25|.else 26|.else
26|.define KBASE, r13d // Must be C callee-save. 27|.define KBASE, r13d // Must be C callee-save.
28|.define KBASEa, r13
27|.define PC, r12d // Must be C callee-save. 29|.define PC, r12d // Must be C callee-save.
28|.endif 30|.endif
29|.define DISPATCH, ebx // Must be C callee-save. 31|.define DISPATCH, ebx // Must be C callee-save.
30| 32|
31|.define RA, ecx 33|.define RA, ecx
34|.if X64; .define RAa, rcx; .else; .define RAa, RA; .endif
32|.define RAL, cl 35|.define RAL, cl
33|.define RB, ebp // Must be ebp (C callee-save). 36|.define RB, ebp // Must be ebp (C callee-save).
34|.define RC, eax // Must be eax (fcomparepp and others). 37|.define RC, eax // Must be eax (fcomparepp and others).
@@ -37,6 +40,7 @@
37|.define RCL, al 40|.define RCL, al
38|.define OP, RB 41|.define OP, RB
39|.define RD, RC 42|.define RD, RC
43|.if X64; .define RDa, rax; .else; .define RDa, RD; .endif
40|.define RDL, RCL 44|.define RDL, RCL
41| 45|
42|.if not X64 46|.if not X64
@@ -133,9 +137,9 @@
133|.define INARG_BASE, SAVE_CFRAME // Overwritten by SAVE_CFRAME! 137|.define INARG_BASE, SAVE_CFRAME // Overwritten by SAVE_CFRAME!
134| 138|
135|// Arguments for vm_cpcall. 139|// Arguments for vm_cpcall.
136|.define INARG_CP_UD, SAVE_ERRF 140|.define INARG_CP_CALL, SAVE_ERRF
137|.define INARG_CP_FUNC, SAVE_NRES 141|.define INARG_CP_UD, SAVE_NRES
138|.define INARG_CP_CALL, SAVE_CFRAME 142|.define INARG_CP_FUNC, SAVE_CFRAME
139| 143|
140|//----------------------------------------------------------------------- 144|//-----------------------------------------------------------------------
141|.elif X64WIN // x64/Windows stack layout 145|.elif X64WIN // x64/Windows stack layout
@@ -408,15 +412,20 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
408 |->gate_cwrap: // Call gate for wrapped C functions. 412 |->gate_cwrap: // Call gate for wrapped C functions.
409 | // RA = new base, RB = CFUNC, RC = nargs+1, (BASE = old base), PC = return 413 | // RA = new base, RB = CFUNC, RC = nargs+1, (BASE = old base), PC = return
410 | mov [RA-4], PC 414 | mov [RA-4], PC
411 | mov KBASE, CFUNC:RB->f 415 | mov KBASEa, CFUNC:RB->f
412 | mov L:RB, SAVE_L 416 | mov L:RB, SAVE_L
413 | lea RC, [RA+NARGS:RC*8-8] 417 | lea RC, [RA+NARGS:RC*8-8]
414 | mov L:RB->base, RA 418 | mov L:RB->base, RA
415 | lea RA, [RC+8*LUA_MINSTACK] 419 | lea RA, [RC+8*LUA_MINSTACK]
416 | mov ARG2, KBASE
417 | mov ARG1, L:RB
418 | mov L:RB->top, RC 420 | mov L:RB->top, RC
419 | cmp RA, L:RB->maxstack 421 | cmp RA, L:RB->maxstack
422 |.if X64
423 | mov CARG2, KBASEa
424 | mov CARG1d, L:RB // Caveat: CARG1d may be RA.
425 |.else
426 | mov ARG2, KBASEa
427 | mov ARG1, L:RB
428 |.endif
420 | ja ->gate_c_growstack // Need to grow stack. 429 | ja ->gate_c_growstack // Need to grow stack.
421 | set_vmstate C 430 | set_vmstate C
422 | // (lua_State *L, lua_CFunction f) 431 | // (lua_State *L, lua_CFunction f)
@@ -437,17 +446,21 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
437 |->gate_c: // Call gate for C functions. 446 |->gate_c: // Call gate for C functions.
438 | // RA = new base, RB = CFUNC, RC = nargs+1, (BASE = old base), PC = return 447 | // RA = new base, RB = CFUNC, RC = nargs+1, (BASE = old base), PC = return
439 | mov [RA-4], PC 448 | mov [RA-4], PC
440 | mov KBASE, CFUNC:RB->f 449 | mov KBASEa, CFUNC:RB->f
441 | mov L:RB, SAVE_L 450 | mov L:RB, SAVE_L
442 | lea RC, [RA+NARGS:RC*8-8] 451 | lea RC, [RA+NARGS:RC*8-8]
443 | mov L:RB->base, RA 452 | mov L:RB->base, RA
444 | lea RA, [RC+8*LUA_MINSTACK] 453 | lea RA, [RC+8*LUA_MINSTACK]
445 | mov ARG1, L:RB
446 | mov L:RB->top, RC 454 | mov L:RB->top, RC
447 | cmp RA, L:RB->maxstack 455 | cmp RA, L:RB->maxstack
456 |.if X64
457 | mov CARG1d, L:RB // Caveat: CARG1d may be RA.
458 |.else
459 | mov ARG1, L:RB
460 |.endif
448 | ja ->gate_c_growstack // Need to grow stack. 461 | ja ->gate_c_growstack // Need to grow stack.
449 | set_vmstate C 462 | set_vmstate C
450 | call KBASE // (lua_State *L) 463 | call KBASEa // (lua_State *L)
451 | set_vmstate INTERP 464 | set_vmstate INTERP
452 | // nresults returned in eax (RD). 465 | // nresults returned in eax (RD).
453 | mov BASE, L:RB->base 466 | mov BASE, L:RB->base
@@ -498,8 +511,8 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
498 | mov L:RB->top, BASE 511 | mov L:RB->top, BASE
499 | 512 |
500 |->vm_leave_cp: 513 |->vm_leave_cp:
501 | mov RA, SAVE_CFRAME // Restore previous C frame. 514 | mov RAa, SAVE_CFRAME // Restore previous C frame.
502 | mov L:RB->cframe, RA 515 | mov L:RB->cframe, RAa
503 | xor eax, eax // Ok return status for vm_pcall. 516 | xor eax, eax // Ok return status for vm_pcall.
504 | 517 |
505 |->vm_leave_unw: 518 |->vm_leave_unw:
@@ -530,27 +543,44 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
530 | // - A return back from a lua_call() with (high) nresults adjustment. 543 | // - A return back from a lua_call() with (high) nresults adjustment.
531 | mov L:RB->top, BASE // Save current top held in BASE (yes). 544 | mov L:RB->top, BASE // Save current top held in BASE (yes).
532 | mov NRESULTS, RD // Need to fill only remainder with nil. 545 | mov NRESULTS, RD // Need to fill only remainder with nil.
546 |.if X64
547 | mov CARG2d, RA // Caveat: CARG1d may be RA.
548 | mov CARG1d, L:RB
549 |.else
533 | mov ARG2, RA // Grow by wanted nresults+1. 550 | mov ARG2, RA // Grow by wanted nresults+1.
534 | mov ARG1, L:RB 551 | mov ARG1, L:RB
552 |.endif
535 | call extern lj_state_growstack // (lua_State *L, int n) 553 | call extern lj_state_growstack // (lua_State *L, int n)
536 | mov BASE, L:RB->top // Need the (realloced) L->top in BASE. 554 | mov BASE, L:RB->top // Need the (realloced) L->top in BASE.
537 | jmp <3 555 | jmp <3
538 | 556 |
539 |->vm_unwind_c: // Unwind C stack, return from vm_pcall. 557 |->vm_unwind_c: // Unwind C stack, return from vm_pcall.
540 | // (void *cframe, int errcode) 558 | // (void *cframe, int errcode)
559 |.if X64
560 | and CARG1, CFRAME_RAWMASK
561 | mov eax, CARG2d // Error return status for vm_pcall.
562 | mov rsp, CARG1
563 |.else
541 | mov ecx, [esp+4] 564 | mov ecx, [esp+4]
542 | mov eax, [esp+8] // Error return status for vm_pcall. 565 | mov eax, [esp+8] // Error return status for vm_pcall.
543 | and ecx, CFRAME_RAWMASK 566 | and ecx, CFRAME_RAWMASK
544 | mov esp, ecx 567 | mov esp, ecx
568 |.endif
545 | mov L:RB, SAVE_L 569 | mov L:RB, SAVE_L
546 | mov GL:RB, L:RB->glref 570 | mov GL:RB, L:RB->glref
547 | mov dword GL:RB->vmstate, ~LJ_VMST_C 571 | mov dword GL:RB->vmstate, ~LJ_VMST_C
548 | jmp ->vm_leave_unw 572 | jmp ->vm_leave_unw
549 | 573 |
550 |->vm_unwind_ff: // Unwind C stack, return from ff pcall. 574 |->vm_unwind_ff: // Unwind C stack, return from ff pcall.
575 | // (void *cframe)
576 |.if X64
577 | and CARG1, CFRAME_RAWMASK
578 | mov rsp, CARG1
579 |.else
551 | mov ecx, [esp+4] 580 | mov ecx, [esp+4]
552 | and ecx, CFRAME_RAWMASK 581 | and ecx, CFRAME_RAWMASK
553 | mov esp, ecx 582 | mov esp, ecx
583 |.endif
554 | mov L:RB, SAVE_L 584 | mov L:RB, SAVE_L
555 | mov RA, -8 // Results start at BASE+RA = BASE-8. 585 | mov RA, -8 // Results start at BASE+RA = BASE-8.
556 | mov RD, 1+1 // Really 1+2 results, incr. later. 586 | mov RD, 1+1 // Really 1+2 results, incr. later.
@@ -578,7 +608,11 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
578 |//-- Grow stack on-demand ----------------------------------------------- 608 |//-- Grow stack on-demand -----------------------------------------------
579 | 609 |
580 |->gate_c_growstack: // Grow stack for C function. 610 |->gate_c_growstack: // Grow stack for C function.
611 |.if X64
612 | mov CARG2d, LUA_MINSTACK
613 |.else
581 | mov ARG2, LUA_MINSTACK 614 | mov ARG2, LUA_MINSTACK
615 |.endif
582 | jmp >1 616 | jmp >1
583 | 617 |
584 |->gate_lv_growstack: // Grow stack for vararg Lua function. 618 |->gate_lv_growstack: // Grow stack for vararg Lua function.
@@ -598,8 +632,13 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
598 | mov L:RB->base, BASE 632 | mov L:RB->base, BASE
599 | mov L:RB->top, RC 633 | mov L:RB->top, RC
600 | mov SAVE_PC, PC 634 | mov SAVE_PC, PC
635 |.if X64
636 | mov CARG2d, RA
637 | mov CARG1d, L:RB // Caveat: CARG1d may be RA.
638 |.else
601 | mov ARG2, RA 639 | mov ARG2, RA
602 | mov ARG1, L:RB 640 | mov ARG1, L:RB
641 |.endif
603 |1: 642 |1:
604 | // L:RB = L, L->base = new base, L->top = top 643 | // L:RB = L, L->base = new base, L->top = top
605 | // SAVE_PC = initial PC+1 (undefined for C functions) 644 | // SAVE_PC = initial PC+1 (undefined for C functions)
@@ -619,18 +658,28 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
619 |//----------------------------------------------------------------------- 658 |//-----------------------------------------------------------------------
620 | 659 |
621 |->vm_resume: // Setup C frame and resume thread. 660 |->vm_resume: // Setup C frame and resume thread.
622 | // (lua_State *L, StkId base, int nres1 = 0, ptrdiff_t ef = 0) 661 | // (lua_State *L, TValue *base, int nres1 = 0, ptrdiff_t ef = 0)
623 | saveregs 662 | saveregs
663 |.if X64
664 | mov L:RB, CARG1d // Caveat: CARG1d may be RA.
665 | mov SAVE_L, CARG1d
666 | mov RA, CARG2d
667 |.else
668 | mov L:RB, SAVE_L
669 | mov RA, INARG_BASE // Caveat: overlaps SAVE_CFRAME!
670 |.endif
624 | mov PC, FRAME_C 671 | mov PC, FRAME_C
625 | xor RD, RD 672 | xor RD, RD
626 | mov L:RB, SAVE_L
627 | lea KBASE, [esp+CFRAME_RESUME] 673 | lea KBASE, [esp+CFRAME_RESUME]
628 | mov RA, INARG_BASE
629 | mov DISPATCH, L:RB->glref // Setup pointer to dispatch table. 674 | mov DISPATCH, L:RB->glref // Setup pointer to dispatch table.
630 | add DISPATCH, GG_G2DISP 675 | add DISPATCH, GG_G2DISP
631 | mov L:RB->cframe, KBASE 676 | mov L:RB->cframe, KBASE
632 | mov SAVE_CFRAME, RD // Caveat: overlaps INARG_BASE!
633 | mov SAVE_PC, RD // Any value outside of bytecode is ok. 677 | mov SAVE_PC, RD // Any value outside of bytecode is ok.
678 | mov SAVE_CFRAME, RDa
679 |.if X64
680 | mov SAVE_NRES, RD
681 | mov SAVE_ERRF, RD
682 |.endif
634 | cmp byte L:RB->status, RDL 683 | cmp byte L:RB->status, RDL
635 | je >3 // Initial resume (like a call). 684 | je >3 // Initial resume (like a call).
636 | 685 |
@@ -650,25 +699,39 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
650 | jmp ->vm_return 699 | jmp ->vm_return
651 | 700 |
652 |->vm_pcall: // Setup protected C frame and enter VM. 701 |->vm_pcall: // Setup protected C frame and enter VM.
653 | // (lua_State *L, StkId base, int nres1, ptrdiff_t ef) 702 | // (lua_State *L, TValue *base, int nres1, ptrdiff_t ef)
654 | saveregs 703 | saveregs
655 | mov PC, FRAME_CP 704 | mov PC, FRAME_CP
705 |.if X64
706 | mov SAVE_ERRF, CARG4d
707 |.endif
656 | jmp >1 708 | jmp >1
657 | 709 |
658 |->vm_call: // Setup C frame and enter VM. 710 |->vm_call: // Setup C frame and enter VM.
659 | // (lua_State *L, StkId base, int nres1) 711 | // (lua_State *L, TValue *base, int nres1)
660 | saveregs 712 | saveregs
661 | mov PC, FRAME_C 713 | mov PC, FRAME_C
662 | 714 |
663 |1: // Entry point for vm_pcall above (PC = ftype). 715 |1: // Entry point for vm_pcall above (PC = ftype).
716 |.if X64
717 | mov SAVE_NRES, CARG3d
718 | mov L:RB, CARG1d // Caveat: CARG1d may be RA.
719 | mov SAVE_L, CARG1d
720 | mov RA, CARG2d
721 |.else
664 | mov L:RB, SAVE_L 722 | mov L:RB, SAVE_L
665 | mov RA, INARG_BASE 723 | mov RA, INARG_BASE // Caveat: overlaps SAVE_CFRAME!
724 |.endif
666 | 725 |
667 |2: // Entry point for vm_cpcall below (RA = base, RB = L, PC = ftype). 726 |2: // Entry point for vm_cpcall below (RA = base, RB = L, PC = ftype).
668 | mov KBASE, L:RB->cframe // Add our C frame to cframe chain. 727 | mov KBASEa, L:RB->cframe // Add our C frame to cframe chain.
669 | mov SAVE_CFRAME, KBASE // Caveat: overlaps INARG_BASE! 728 | mov SAVE_CFRAME, KBASEa
670 | mov SAVE_PC, L:RB // Any value outside of bytecode is ok. 729 | mov SAVE_PC, L:RB // Any value outside of bytecode is ok.
730 |.if X64
731 | mov L:RB->cframe, rsp
732 |.else
671 | mov L:RB->cframe, esp 733 | mov L:RB->cframe, esp
734 |.endif
672 | 735 |
673 | mov DISPATCH, L:RB->glref // Setup pointer to dispatch table. 736 | mov DISPATCH, L:RB->glref // Setup pointer to dispatch table.
674 | add DISPATCH, GG_G2DISP 737 | add DISPATCH, GG_G2DISP
@@ -691,31 +754,44 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
691 | // RA = new base, RB = LFUNC/CFUNC, RC = nargs+1. 754 | // RA = new base, RB = LFUNC/CFUNC, RC = nargs+1.
692 | 755 |
693 |->vm_cpcall: // Setup protected C frame, call C. 756 |->vm_cpcall: // Setup protected C frame, call C.
694 | // (lua_State *L, lua_CPFunction cp, lua_CFunction func, void *ud) 757 | // (lua_State *L, lua_CFunction func, void *ud, lua_CPFunction cp)
695 | saveregs 758 | saveregs
759 |.if X64
760 | mov L:RB, CARG1d // Caveat: CARG1d may be RA.
761 | mov SAVE_L, CARG1d
762 |.else
696 | mov L:RB, SAVE_L 763 | mov L:RB, SAVE_L
697 | mov RC, INARG_CP_UD 764 | // Caveat: INARG_CP_* and SAVE_CFRAME/SAVE_NRES/SAVE_ERRF overlap!
765 | mov RC, INARG_CP_UD // Get args before they are overwritten.
698 | mov RA, INARG_CP_FUNC 766 | mov RA, INARG_CP_FUNC
699 | mov BASE, INARG_CP_CALL 767 | mov BASE, INARG_CP_CALL
768 |.endif
700 | mov SAVE_PC, L:RB // Any value outside of bytecode is ok. 769 | mov SAVE_PC, L:RB // Any value outside of bytecode is ok.
701 | 770 |
702 | // Caveat: INARG_P_* and INARG_CP_* overlap!
703 | mov KBASE, L:RB->stack // Compute -savestack(L, L->top). 771 | mov KBASE, L:RB->stack // Compute -savestack(L, L->top).
704 | sub KBASE, L:RB->top 772 | sub KBASE, L:RB->top
705 | mov SAVE_ERRF, 0 // No error function. 773 | mov SAVE_ERRF, 0 // No error function.
706 | mov SAVE_NRES, KBASE // Neg. delta means cframe w/o frame. 774 | mov SAVE_NRES, KBASE // Neg. delta means cframe w/o frame.
707 | // Handler may change cframe_nres(L->cframe) or cframe_errfunc(L->cframe). 775 | // Handler may change cframe_nres(L->cframe) or cframe_errfunc(L->cframe).
708 | 776 |
709 | mov ARG3, RC 777 |.if X64
778 | mov KBASEa, L:RB->cframe // Add our C frame to cframe chain.
779 | mov SAVE_CFRAME, KBASEa
780 | mov L:RB->cframe, rsp
781 |
782 | call CARG4 // (lua_State *L, lua_CFunction func, void *ud)
783 |.else
784 | mov ARG3, RC // Have to copy args downwards.
710 | mov ARG2, RA 785 | mov ARG2, RA
711 | mov ARG1, L:RB 786 | mov ARG1, L:RB
712 | 787 |
713 | mov KBASE, L:RB->cframe // Add our C frame to cframe chain. 788 | mov KBASE, L:RB->cframe // Add our C frame to cframe chain.
714 | mov SAVE_CFRAME, KBASE // Caveat: overlaps INARG_CP_CALL! 789 | mov SAVE_CFRAME, KBASE
715 | mov L:RB->cframe, esp 790 | mov L:RB->cframe, esp
716 | 791 |
717 | call BASE // (lua_State *L, lua_CFunction func, void *ud) 792 | call BASE // (lua_State *L, lua_CFunction func, void *ud)
718 | // StkId (new base) or NULL returned in eax (RC). 793 |.endif
794 | // TValue * (new base) or NULL returned in eax (RC).
719 | test RC, RC 795 | test RC, RC
720 | jz ->vm_leave_cp // No base? Just remove C frame. 796 | jz ->vm_leave_cp // No base? Just remove C frame.
721 | mov RA, RC 797 | mov RA, RC
@@ -737,11 +813,16 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
737 | mov dword [RA+RD*8-4], LJ_TNIL // Ensure one valid arg. 813 | mov dword [RA+RD*8-4], LJ_TNIL // Ensure one valid arg.
738 | mov RC, RA // ... in [RC] 814 | mov RC, RA // ... in [RC]
739 | mov PC, [RB-12] // Restore PC from [cont|PC]. 815 | mov PC, [RB-12] // Restore PC from [cont|PC].
816 | mov RA, dword [RB-16]
817 |.if X64
818 | lea KBASEa, qword [=>0]
819 | add RAa, KBASEa
820 |.endif
740 | mov LFUNC:KBASE, [BASE-8] 821 | mov LFUNC:KBASE, [BASE-8]
741 | mov PROTO:KBASE, LFUNC:KBASE->pt 822 | mov PROTO:KBASE, LFUNC:KBASE->pt
742 | mov KBASE, PROTO:KBASE->k 823 | mov KBASE, PROTO:KBASE->k
743 | // BASE = base, RC = result, RB = meta base 824 | // BASE = base, RC = result, RB = meta base
744 | jmp dword [RB-16] // Jump to continuation. 825 | jmp RAa // Jump to continuation.
745 | 826 |
746 |->cont_cat: // BASE = base, RC = result, RB = mbase 827 |->cont_cat: // BASE = base, RC = result, RB = mbase
747 | movzx RA, PC_RB 828 | movzx RA, PC_RB
@@ -1028,7 +1109,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
1028 | mov ARG1, L:RB 1109 | mov ARG1, L:RB
1029 | mov SAVE_PC, PC 1110 | mov SAVE_PC, PC
1030 | mov L:RB->base, BASE 1111 | mov L:RB->base, BASE
1031 | call extern lj_meta_for // (lua_State *L, StkId base) 1112 | call extern lj_meta_for // (lua_State *L, TValue *base)
1032 | mov BASE, L:RB->base 1113 | mov BASE, L:RB->base
1033 | mov RC, [PC-4] 1114 | mov RC, [PC-4]
1034 | movzx RA, RCH 1115 | movzx RA, RCH
@@ -1447,7 +1528,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
1447 | xor RA, RA 1528 | xor RA, RA
1448 | mov ARG4, RA 1529 | mov ARG4, RA
1449 | mov ARG3, RA 1530 | mov ARG3, RA
1450 | call ->vm_resume // (lua_State *L, StkId base, 0, 0) 1531 | call ->vm_resume // (lua_State *L, TValue *base, 0, 0)
1451 | set_vmstate INTERP 1532 | set_vmstate INTERP
1452 | 1533 |
1453 | mov L:RB, SAVE_L 1534 | mov L:RB, SAVE_L
@@ -2123,6 +2204,9 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
2123 |// The 16 bit exit number is stored with two (sign-extended) push imm8. 2204 |// The 16 bit exit number is stored with two (sign-extended) push imm8.
2124 |->vm_exit_handler: 2205 |->vm_exit_handler:
2125#if LJ_HASJIT 2206#if LJ_HASJIT
2207 |.if X64
2208 | int3 // NYI
2209 |.else
2126 | push ebp; lea ebp, [esp+12]; push ebp 2210 | push ebp; lea ebp, [esp+12]; push ebp
2127 | push ebx; push edx; push ecx; push eax 2211 | push ebx; push edx; push ecx; push eax
2128 | movzx RC, byte [ebp-4] // Reconstruct exit number. 2212 | movzx RC, byte [ebp-4] // Reconstruct exit number.
@@ -2159,6 +2243,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
2159 | mov BASE, L:RB->base 2243 | mov BASE, L:RB->base
2160 | mov PC, SAVE_PC 2244 | mov PC, SAVE_PC
2161 | mov SAVE_L, L:RB // Needed for on-trace resume/yield. 2245 | mov SAVE_L, L:RB // Needed for on-trace resume/yield.
2246 |.endif
2162#endif 2247#endif
2163 |->vm_exit_interp: 2248 |->vm_exit_interp:
2164#if LJ_HASJIT 2249#if LJ_HASJIT
@@ -2875,7 +2960,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
2875 | mov ARG2, RA 2960 | mov ARG2, RA
2876 | mov ARG1, L:RB 2961 | mov ARG1, L:RB
2877 | mov L:RB->base, BASE 2962 | mov L:RB->base, BASE
2878 | call extern lj_func_closeuv // (lua_State *L, StkId level) 2963 | call extern lj_func_closeuv // (lua_State *L, TValue *level)
2879 | mov BASE, L:RB->base 2964 | mov BASE, L:RB->base
2880 |1: 2965 |1:
2881 | ins_next 2966 | ins_next