2 ** This file has been pre-processed with DynASM.
3 ** http://luajit.org/dynasm.html
4 ** DynASM version 1.3.0, DynASM ppc version 1.3.0
5 ** DO NOT EDIT! The original file is in "buildvm_ppc.dasc".
8 #if DASM_VERSION != 10300
9 #error "Version mismatch between DynASM and included encoding engine"
12 #define DASM_SECTION_CODE_OP 0
13 #define DASM_SECTION_CODE_SUB 1
14 #define DASM_MAXSECTION 2
15 static const unsigned int build_actionlist
[7101] = {
7128 GLOB_vm_unwind_c_eh
,
7130 GLOB_vm_unwind_ff_eh
,
7131 GLOB_vm_growstack_c
,
7132 GLOB_vm_growstack_l
,
7136 GLOB_vm_call_dispatch
,
7138 GLOB_vm_call_dispatch_f
,
7158 GLOB_vmeta_equal_cd
,
7159 GLOB_vmeta_arith_nv
,
7160 GLOB_vmeta_arith_nv2
,
7162 GLOB_vmeta_arith_vn
,
7163 GLOB_vmeta_arith_vv
,
7164 GLOB_vmeta_arith_vn2
,
7165 GLOB_vmeta_arith_vv2
,
7176 GLOB_ff_getmetatable
,
7178 GLOB_ff_setmetatable
,
7189 GLOB_ff_coroutine_resume
,
7190 GLOB_ff_coroutine_wrap_aux
,
7191 GLOB_ff_coroutine_yield
,
7221 GLOB_ff_string_byte
,
7222 GLOB_ff_string_char
,
7226 GLOB_ff_string_reverse
,
7227 GLOB_ff_string_lower
,
7228 GLOB_ff_string_upper
,
7239 GLOB_ff_bit_arshift
,
7250 GLOB_vm_exit_handler
,
7251 GLOB_vm_exit_interp
,
7269 static const char *const globnames
[] = {
7288 "vm_call_dispatch_f",
7339 "ff_coroutine_resume",
7340 "ff_coroutine_wrap_aux",
7341 "ff_coroutine_yield",
7376 "ff_string_reverse",
7419 static const char *const extnames
[] = {
7420 "lj_state_growstack",
7431 "lj_str_fromnumber",
7435 "lj_ffh_coroutine_wrap_err",
7469 "lj_gc_step_fixtop",
7474 #define Dt1(_V) (int)(ptrdiff_t)&(((lua_State *)0)_V)
7475 #define Dt2(_V) (int)(ptrdiff_t)&(((global_State *)0)_V)
7476 #define Dt3(_V) (int)(ptrdiff_t)&(((TValue *)0)_V)
7477 #define Dt4(_V) (int)(ptrdiff_t)&(((GCobj *)0)_V)
7478 #define Dt5(_V) (int)(ptrdiff_t)&(((GCstr *)0)_V)
7479 #define Dt6(_V) (int)(ptrdiff_t)&(((GCtab *)0)_V)
7480 #define Dt7(_V) (int)(ptrdiff_t)&(((GCfuncL *)0)_V)
7481 #define Dt8(_V) (int)(ptrdiff_t)&(((GCfuncC *)0)_V)
7482 #define Dt9(_V) (int)(ptrdiff_t)&(((GCproto *)0)_V)
7483 #define DtA(_V) (int)(ptrdiff_t)&(((GCupval *)0)_V)
7484 #define DtB(_V) (int)(ptrdiff_t)&(((Node *)0)_V)
7485 #define DtC(_V) (int)(ptrdiff_t)&(((int *)0)_V)
7486 #define DtD(_V) (int)(ptrdiff_t)&(((GCtrace *)0)_V)
7487 #define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
7488 #define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
7489 #define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
7491 /* Generate subroutines used by opcodes and other parts of the VM. */
7492 /* The .code_sub section should be last to help static branch prediction. */
7493 static void build_subroutines(BuildCtx
*ctx
)
7496 dasm_put(Dst
, 1, FRAME_P
, LJ_TTRUE
, FRAME_TYPE
, FRAME_C
, ~LJ_VMST_C
, Dt1(->base
), DISPATCH_GL(vmstate
), 31-3, Dt1(->top
));
7497 dasm_put(Dst
, 55, Dt1(->cframe
), 184+(14-14)*4, 40+(14-14)*8, 184+(15-14)*4, 40+(15-14)*8, 184+(16-14)*4, 40+(16-14)*8, 184+(17-14)*4, 40+(17-14)*8, 184+(18-14)*4, 40+(18-14)*8, 184+(19-14)*4, 40+(19-14)*8, 184+(20-14)*4, 40+(20-14)*8, 184+(21-14)*4, 40+(21-14)*8, 184+(22-14)*4, 40+(22-14)*8, 184+(23-14)*4, 40+(23-14)*8);
7498 dasm_put(Dst
, 103, 184+(24-14)*4, 40+(24-14)*8, 184+(25-14)*4, 40+(25-14)*8, 184+(26-14)*4, 40+(26-14)*8, 184+(27-14)*4, 40+(27-14)*8, 184+(28-14)*4, 40+(28-14)*8, 184+(29-14)*4, 40+(29-14)*8, 184+(30-14)*4, 40+(30-14)*8, 184+(31-14)*4, 40+(31-14)*8, Dt1(->maxstack
));
7499 dasm_put(Dst
, 152, Dt1(->top
), 31-3, Dt1(->top
), ~LJ_VMST_C
, Dt1(->glref
), Dt2(->vmstate
), LJ_TISNUM
, Dt1(->base
), Dt1(->glref
), LJ_TFALSE
, LJ_TNIL
, ~LJ_VMST_INTERP
, GG_G2DISP
);
7500 dasm_put(Dst
, 215, DISPATCH_GL(vmstate
), LUA_MINSTACK
, Dt1(->base
), Dt1(->top
), 32-3, Dt1(->base
), Dt1(->top
), Dt7(->pc
), 184+(14-14)*4, 40+(14-14)*8, 184+(15-14)*4, 40+(15-14)*8, 184+(16-14)*4, 40+(16-14)*8, 184+(17-14)*4);
7501 dasm_put(Dst
, 275, 40+(17-14)*8, 184+(18-14)*4, 40+(18-14)*8, 184+(19-14)*4, 40+(19-14)*8, 184+(20-14)*4, 40+(20-14)*8, 184+(21-14)*4, 40+(21-14)*8, 184+(22-14)*4, 40+(22-14)*8, 184+(23-14)*4, 40+(23-14)*8, 184+(24-14)*4, 40+(24-14)*8, 184+(25-14)*4, 40+(25-14)*8, 184+(26-14)*4, 40+(26-14)*8, 184+(27-14)*4, 40+(27-14)*8, 184+(28-14)*4);
7502 dasm_put(Dst
, 322, 40+(28-14)*8, 184+(29-14)*4, 40+(29-14)*8, 184+(30-14)*4, 40+(30-14)*8, 184+(31-14)*4, 40+(31-14)*8, Dt1(->glref
), Dt1(->status
), FRAME_CP
, CFRAME_RESUME
, GG_G2DISP
, Dt1(->cframe
), Dt1(->base
), LJ_TISNUM
, Dt1(->top
), Dt1(->status
), FRAME_TYPE
, ~LJ_VMST_INTERP
, LJ_TNIL
, DISPATCH_GL(vmstate
));
7503 dasm_put(Dst
, 389, 184+(14-14)*4, 40+(14-14)*8, 184+(15-14)*4, 40+(15-14)*8, 184+(16-14)*4, 40+(16-14)*8, 184+(17-14)*4, 40+(17-14)*8, 184+(18-14)*4, 40+(18-14)*8, 184+(19-14)*4, 40+(19-14)*8, 184+(20-14)*4, 40+(20-14)*8, 184+(21-14)*4, 40+(21-14)*8, 184+(22-14)*4, 40+(22-14)*8, 184+(23-14)*4);
7504 dasm_put(Dst
, 435, 40+(23-14)*8, 184+(24-14)*4, 40+(24-14)*8, 184+(25-14)*4, 40+(25-14)*8, 184+(26-14)*4, 40+(26-14)*8, 184+(27-14)*4, 40+(27-14)*8, 184+(28-14)*4, 40+(28-14)*8, 184+(29-14)*4, 40+(29-14)*8, 184+(30-14)*4, 40+(30-14)*8, 184+(31-14)*4, 40+(31-14)*8, FRAME_CP
, 184+(14-14)*4, 40+(14-14)*8);
7505 dasm_put(Dst
, 482, 184+(15-14)*4, 40+(15-14)*8, 184+(16-14)*4, 40+(16-14)*8, 184+(17-14)*4, 40+(17-14)*8, 184+(18-14)*4, 40+(18-14)*8, 184+(19-14)*4, 40+(19-14)*8, 184+(20-14)*4, 40+(20-14)*8, 184+(21-14)*4, 40+(21-14)*8, 184+(22-14)*4, 40+(22-14)*8, 184+(23-14)*4, 40+(23-14)*8, 184+(24-14)*4, 40+(24-14)*8, 184+(25-14)*4, 40+(25-14)*8);
7506 dasm_put(Dst
, 528, 184+(26-14)*4, 40+(26-14)*8, 184+(27-14)*4, 40+(27-14)*8, 184+(28-14)*4, 40+(28-14)*8, 184+(29-14)*4, 40+(29-14)*8, 184+(30-14)*4, 40+(30-14)*8, 184+(31-14)*4, 40+(31-14)*8, FRAME_C
, Dt1(->cframe
), Dt1(->cframe
), Dt1(->glref
), GG_G2DISP
, Dt1(->base
), LJ_TISNUM
, Dt1(->top
));
7507 dasm_put(Dst
, 578, ~LJ_VMST_INTERP
, LJ_TNIL
, DISPATCH_GL(vmstate
), LJ_TFUNC
, Dt7(->pc
), 184+(14-14)*4, 40+(14-14)*8, 184+(15-14)*4, 40+(15-14)*8, 184+(16-14)*4, 40+(16-14)*8, 184+(17-14)*4, 40+(17-14)*8, 184+(18-14)*4, 40+(18-14)*8, 184+(19-14)*4, 40+(19-14)*8, 184+(20-14)*4);
7508 dasm_put(Dst
, 645, 40+(20-14)*8, 184+(21-14)*4, 40+(21-14)*8, 184+(22-14)*4, 40+(22-14)*8, 184+(23-14)*4, 40+(23-14)*8, 184+(24-14)*4, 40+(24-14)*8, 184+(25-14)*4, 40+(25-14)*8, 184+(26-14)*4, 40+(26-14)*8, 184+(27-14)*4, 40+(27-14)*8, 184+(28-14)*4, 40+(28-14)*8, 184+(29-14)*4, 40+(29-14)*8, 184+(30-14)*4, 40+(30-14)*8, 184+(31-14)*4);
7509 dasm_put(Dst
, 691, 40+(31-14)*8, Dt1(->stack
), Dt1(->top
), Dt1(->cframe
), Dt1(->cframe
), Dt1(->glref
), FRAME_CP
, GG_G2DISP
, Dt7(->pc
), PC2PROTO(k
), Dt1(->base
), DISPATCH_GL(tmptv
));
7510 dasm_put(Dst
, 765, LJ_TSTR
, DISPATCH_GL(tmptv
), LJ_TTAB
, DISPATCH_GL(tmptv2
), LJ_TSTR
);
7514 dasm_put(Dst
, 794, DISPATCH_GL(tmptv
));
7520 dasm_put(Dst
, 804, Dt1(->base
), FRAME_CONT
, Dt1(->top
), DISPATCH_GL(tmptv
), LJ_TSTR
, DISPATCH_GL(tmptv
), LJ_TTAB
, DISPATCH_GL(tmptv2
), LJ_TSTR
);
7524 dasm_put(Dst
, 876, DISPATCH_GL(tmptv
));
7530 dasm_put(Dst
, 886, Dt1(->base
), FRAME_CONT
, Dt1(->top
));
7542 dasm_put(Dst
, 941, Dt1(->base
), -(BCBIAS_J
*4 >> 16), LJ_TTRUE
, LJ_TTRUE
, Dt1(->base
));
7544 dasm_put(Dst
, 1004, Dt1(->base
));
7546 dasm_put(Dst
, 1015);
7548 dasm_put(Dst
, 1022);
7550 dasm_put(Dst
, 1027);
7552 dasm_put(Dst
, 1041);
7554 dasm_put(Dst
, 1044);
7556 dasm_put(Dst
, 1047);
7558 dasm_put(Dst
, 1050, Dt1(->base
), FRAME_CONT
);
7559 #ifdef LUAJIT_ENABLE_LUA52COMPAT
7560 dasm_put(Dst
, 1074);
7562 dasm_put(Dst
, 1076, Dt1(->base
));
7563 #ifdef LUAJIT_ENABLE_LUA52COMPAT
7564 dasm_put(Dst
, 1084);
7566 dasm_put(Dst
, 1091);
7568 dasm_put(Dst
, 1094, Dt1(->base
), Dt7(->pc
), Dt1(->base
), Dt1(->base
));
7570 dasm_put(Dst
, 1142);
7572 dasm_put(Dst
, 1144);
7574 dasm_put(Dst
, 1146, BC_JFORI
);
7576 dasm_put(Dst
, 1149);
7578 dasm_put(Dst
, 1151, BC_JFORI
);
7580 dasm_put(Dst
, 1154, BC_FORI
, LJ_TFALSE
, ~LJ_TISNUM
+1, 31-3, Dt8(->upvalue
), LJ_TTAB
, Dt6(->metatable
));
7581 dasm_put(Dst
, 1217, LJ_TNIL
, DISPATCH_GL(gcroot
[GCROOT_MMNAME
+MM_metatable
]), Dt6(->hmask
), LJ_TTAB
, Dt5(->hash
), Dt6(->node
), 31-5, 31-3, DtB(->key
), 4+offsetof(Node
, key
), DtB(->val
), 4+offsetof(Node
, val
), LJ_TSTR
, DtB(->next
));
7582 dasm_put(Dst
, 1265, LJ_TNIL
, LJ_TUDATA
, ~LJ_TISNUM
+1, 31-2, DISPATCH_GL(gcroot
[GCROOT_BASEMT
]), LJ_TTAB
, Dt6(->metatable
), LJ_TTAB
, Dt6(->marked
), LJ_GC_BLACK
, Dt6(->metatable
));
7583 dasm_put(Dst
, 1320, DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
), LJ_TTAB
, LJ_TSTR
, DISPATCH_GL(gcroot
[GCROOT_BASEMT_NUM
]), Dt1(->base
));
7584 dasm_put(Dst
, 1380, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
7586 dasm_put(Dst
, 1390);
7588 dasm_put(Dst
, 1393);
7590 dasm_put(Dst
, 1396, LJ_TSTR
, LJ_TTAB
, Dt1(->base
), Dt1(->top
), LJ_TNIL
, (2+1)*8, LJ_TTAB
);
7591 #ifdef LUAJIT_ENABLE_LUA52COMPAT
7592 dasm_put(Dst
, 1447, Dt6(->metatable
), Dt8(->upvalue
[0]));
7594 dasm_put(Dst
, 1456, Dt8(->upvalue
[0]));
7596 dasm_put(Dst
, 1460, (3+1)*8);
7598 dasm_put(Dst
, 1472);
7600 dasm_put(Dst
, 1474);
7602 dasm_put(Dst
, 1476, LJ_TTAB
);
7604 dasm_put(Dst
, 1483);
7606 dasm_put(Dst
, 1488);
7608 dasm_put(Dst
, 1500, Dt6(->asize
), Dt6(->array
));
7610 dasm_put(Dst
, 1505);
7612 dasm_put(Dst
, 1507);
7614 dasm_put(Dst
, 1511, 31-3);
7616 dasm_put(Dst
, 1516, 31-3);
7618 dasm_put(Dst
, 1520, LJ_TNIL
, (0+1)*8, (2+1)*8, Dt6(->hmask
), (0+1)*8, (0+1)*8, LJ_TTAB
);
7619 #ifdef LUAJIT_ENABLE_LUA52COMPAT
7620 dasm_put(Dst
, 1568, Dt6(->metatable
), Dt8(->upvalue
[0]));
7622 dasm_put(Dst
, 1577, Dt8(->upvalue
[0]));
7625 dasm_put(Dst
, 1581);
7627 dasm_put(Dst
, 1583);
7629 dasm_put(Dst
, 1585, (3+1)*8, DISPATCH_GL(hookmask
), 32-HOOK_ACTIVE_SHIFT
, 8+FRAME_PCALL
, DISPATCH_GL(hookmask
), LJ_TFUNC
, 32-HOOK_ACTIVE_SHIFT
, 16+FRAME_PCALL
, LJ_TTHREAD
, Dt1(->status
), Dt1(->cframe
));
7630 dasm_put(Dst
, 1646, Dt1(->top
), LUA_YIELD
, Dt1(->base
), Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), Dt1(->top
), Dt1(->base
), LUA_YIELD
, Dt1(->top
), ~LJ_VMST_INTERP
, Dt1(->base
), DISPATCH_GL(vmstate
));
7631 dasm_put(Dst
, 1708, Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, LJ_TTRUE
, FRAME_TYPE
, LJ_TFALSE
, Dt1(->top
), (2+1)*8, 32-3);
7632 dasm_put(Dst
, 1771, Dt8(->upvalue
[0].gcr
), Dt1(->status
), Dt1(->cframe
), Dt1(->top
), LUA_YIELD
, Dt1(->base
), Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), Dt1(->top
), Dt1(->base
), LUA_YIELD
, Dt1(->top
), ~LJ_VMST_INTERP
);
7633 dasm_put(Dst
, 1830, Dt1(->base
), DISPATCH_GL(vmstate
), Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, 32-3, Dt1(->cframe
));
7634 dasm_put(Dst
, 1887, Dt1(->base
), CFRAME_RESUME
, Dt1(->top
), LUA_YIELD
, Dt1(->cframe
), Dt1(->status
));
7636 dasm_put(Dst
, 1912);
7638 dasm_put(Dst
, 1933, (1+1)*8, FRAME_TYPE
);
7640 dasm_put(Dst
, 1975, 31-11, 32-21, 31-11);
7641 dasm_put(Dst
, 2056, 31-11, 32-21, 31-11);
7643 dasm_put(Dst
, 2109);
7645 dasm_put(Dst
, 2136);
7646 dasm_put(Dst
, 2195);
7647 dasm_put(Dst
, 2253);
7648 dasm_put(Dst
, 2309, Dt8(->upvalue
[0]));
7649 dasm_put(Dst
, 2375);
7651 dasm_put(Dst
, 2379);
7653 dasm_put(Dst
, 2394);
7655 dasm_put(Dst
, 2412, DISPATCH_GL(tmptv
), DISPATCH_GL(tmptv
));
7657 dasm_put(Dst
, 2434);
7659 dasm_put(Dst
, 2439, (2+1)*8);
7661 dasm_put(Dst
, 2443);
7663 dasm_put(Dst
, 2446);
7665 dasm_put(Dst
, 2448, (2+1)*8);
7667 dasm_put(Dst
, 2470);
7669 dasm_put(Dst
, 2539);
7672 dasm_put(Dst
, 2564);
7674 dasm_put(Dst
, 2633);
7676 dasm_put(Dst
, 2658, LJ_TSTR
, Dt5(->len
), LJ_TSTR
, Dt5(->len
));
7678 dasm_put(Dst
, 2685, Dt5([1]), (0+1)*8);
7680 dasm_put(Dst
, 2697, Dt5([1]), 31-3);
7682 dasm_put(Dst
, 2713, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
7684 dasm_put(Dst
, 2724);
7686 dasm_put(Dst
, 2732);
7688 dasm_put(Dst
, 2743, Dt1(->base
), Dt1(->base
), LJ_TSTR
, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
7690 dasm_put(Dst
, 2771);
7692 dasm_put(Dst
, 2773);
7694 dasm_put(Dst
, 2779);
7696 dasm_put(Dst
, 2781);
7698 dasm_put(Dst
, 2783);
7700 dasm_put(Dst
, 2787);
7702 dasm_put(Dst
, 2796);
7704 dasm_put(Dst
, 2807, LJ_TSTR
);
7706 dasm_put(Dst
, 2812);
7708 dasm_put(Dst
, 2816, Dt5(->len
), sizeof(GCstr
)-1, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
7710 dasm_put(Dst
, 2866);
7712 dasm_put(Dst
, 2868);
7714 dasm_put(Dst
, 2870, LJ_TSTR
);
7716 dasm_put(Dst
, 2877);
7718 dasm_put(Dst
, 2881);
7720 dasm_put(Dst
, 2888, Dt5(->len
), DISPATCH_GL(tmpbuf
.sz
), Dt5([1]), DISPATCH_GL(tmpbuf
.buf
), DISPATCH_GL(strempty
), LJ_TSTR
, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), LJ_TSTR
, DISPATCH_GL(tmpbuf
.sz
));
7721 dasm_put(Dst
, 2941, Dt5(->len
), sizeof(GCstr
), DISPATCH_GL(tmpbuf
.buf
), DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), LJ_TSTR
, DISPATCH_GL(tmpbuf
.sz
), Dt5(->len
), sizeof(GCstr
), DISPATCH_GL(tmpbuf
.buf
));
7722 dasm_put(Dst
, 2999, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), LJ_TSTR
, DISPATCH_GL(tmpbuf
.sz
), Dt5(->len
), sizeof(GCstr
), DISPATCH_GL(tmpbuf
.buf
), LJ_TTAB
);
7724 dasm_put(Dst
, 3068);
7726 dasm_put(Dst
, 3078);
7728 dasm_put(Dst
, 3091);
7730 dasm_put(Dst
, 3097);
7732 dasm_put(Dst
, 3099);
7734 dasm_put(Dst
, 3101);
7736 dasm_put(Dst
, 3105);
7738 dasm_put(Dst
, 3108);
7740 dasm_put(Dst
, 3114);
7742 dasm_put(Dst
, 3119);
7744 dasm_put(Dst
, 3129);
7746 dasm_put(Dst
, 3142);
7748 dasm_put(Dst
, 3148);
7750 dasm_put(Dst
, 3150);
7752 dasm_put(Dst
, 3152);
7754 dasm_put(Dst
, 3156);
7756 dasm_put(Dst
, 3159);
7758 dasm_put(Dst
, 3165);
7760 dasm_put(Dst
, 3170);
7762 dasm_put(Dst
, 3180);
7764 dasm_put(Dst
, 3193);
7766 dasm_put(Dst
, 3199);
7768 dasm_put(Dst
, 3201);
7770 dasm_put(Dst
, 3203);
7772 dasm_put(Dst
, 3207);
7774 dasm_put(Dst
, 3210);
7776 dasm_put(Dst
, 3216);
7778 dasm_put(Dst
, 3221);
7780 dasm_put(Dst
, 3231);
7782 dasm_put(Dst
, 3244);
7784 dasm_put(Dst
, 3251);
7786 dasm_put(Dst
, 3261);
7788 dasm_put(Dst
, 3274);
7790 dasm_put(Dst
, 3278);
7792 dasm_put(Dst
, 3293);
7794 dasm_put(Dst
, 3314);
7796 dasm_put(Dst
, 3319);
7798 dasm_put(Dst
, 3334);
7800 dasm_put(Dst
, 3355);
7802 dasm_put(Dst
, 3360);
7804 dasm_put(Dst
, 3375);
7806 dasm_put(Dst
, 3396);
7808 dasm_put(Dst
, 3401);
7810 dasm_put(Dst
, 3416);
7812 dasm_put(Dst
, 3437);
7814 dasm_put(Dst
, 3441);
7816 dasm_put(Dst
, 3456);
7818 dasm_put(Dst
, 3477);
7820 dasm_put(Dst
, 3482);
7822 dasm_put(Dst
, 3492);
7825 dasm_put(Dst
, 3505);
7827 dasm_put(Dst
, 3508);
7829 dasm_put(Dst
, 3514);
7831 dasm_put(Dst
, 3522);
7833 dasm_put(Dst
, 3530);
7835 dasm_put(Dst
, 3532);
7837 dasm_put(Dst
, 3540, Dt8(->f
), 8*LUA_MINSTACK
, Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), Dt1(->base
), 31-3, Dt1(->top
), Dt7(->pc
), FRAME_TYPE
, LUA_MINSTACK
);
7838 dasm_put(Dst
, 3603, Dt1(->base
), Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
7840 dasm_put(Dst
, 3629);
7842 dasm_put(Dst
, 3631, DISPATCH_GL(hookmask
), HOOK_ACTIVE
, GG_DISP2STATIC
, DISPATCH_GL(hookmask
), DISPATCH_GL(hookcount
), HOOK_ACTIVE
, 31-LUA_HOOKLINE
, DISPATCH_GL(hookcount
), Dt1(->base
), Dt1(->base
));
7843 dasm_put(Dst
, 3678, GG_DISP2STATIC
);
7845 dasm_put(Dst
, 3696);
7847 dasm_put(Dst
, 3698);
7849 dasm_put(Dst
, 3701);
7851 dasm_put(Dst
, 3704);
7853 dasm_put(Dst
, 3706);
7855 dasm_put(Dst
, 3709, Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
7857 dasm_put(Dst
, 3731);
7859 dasm_put(Dst
, 3733);
7861 dasm_put(Dst
, 3735);
7863 dasm_put(Dst
, 3737);
7865 dasm_put(Dst
, 3745);
7867 dasm_put(Dst
, 3748);
7869 dasm_put(Dst
, 3761);
7871 dasm_put(Dst
, 3763);
7873 dasm_put(Dst
, 3765);
7875 dasm_put(Dst
, 3767);
7877 dasm_put(Dst
, 3831);
7881 /* Generate the code for a single instruction. */
7882 static void build_ins(BuildCtx
*ctx
, BCOp op
, int defop
)
7885 dasm_put(Dst
, 3833, defop
);
7889 /* -- Comparison ops ---------------------------------------------------- */
7891 /* Remember: all ops branch for a true comparison, fall through otherwise. */
7893 case BC_ISLT
: case BC_ISGE
: case BC_ISLE
: case BC_ISGT
:
7895 dasm_put(Dst
, 3835, -(BCBIAS_J
*4 >> 16));
7896 if (op
== BC_ISLT
) {
7897 dasm_put(Dst
, 3852);
7898 } else if (op
== BC_ISGE
) {
7899 dasm_put(Dst
, 3855);
7900 } else if (op
== BC_ISLE
) {
7901 dasm_put(Dst
, 3858);
7903 dasm_put(Dst
, 3861);
7905 dasm_put(Dst
, 3864);
7906 if (op
== BC_ISLT
) {
7907 dasm_put(Dst
, 3901);
7908 } else if (op
== BC_ISGE
) {
7909 dasm_put(Dst
, 3904);
7910 } else if (op
== BC_ISLE
) {
7911 dasm_put(Dst
, 3907);
7913 dasm_put(Dst
, 3911);
7915 dasm_put(Dst
, 3915);
7917 dasm_put(Dst
, 3918, -(BCBIAS_J
*4 >> 16));
7918 if (op
== BC_ISLT
) {
7919 dasm_put(Dst
, 3935);
7920 } else if (op
== BC_ISGE
) {
7921 dasm_put(Dst
, 3938);
7922 } else if (op
== BC_ISLE
) {
7923 dasm_put(Dst
, 3941);
7925 dasm_put(Dst
, 3945);
7927 dasm_put(Dst
, 3949);
7931 case BC_ISEQV
: case BC_ISNEV
:
7932 vk
= op
== BC_ISEQV
;
7934 dasm_put(Dst
, 3962, -(BCBIAS_J
*4 >> 16));
7936 dasm_put(Dst
, 3975);
7938 dasm_put(Dst
, 3978);
7941 dasm_put(Dst
, 3981, -(BCBIAS_J
*4 >> 16));
7943 dasm_put(Dst
, 3998);
7945 dasm_put(Dst
, 4002);
7947 dasm_put(Dst
, 4006);
7949 dasm_put(Dst
, 4018);
7951 dasm_put(Dst
, 4020);
7953 dasm_put(Dst
, 4023, ~LJ_TISPRI
, ~LJ_TISTABUD
);
7955 dasm_put(Dst
, 4037);
7957 dasm_put(Dst
, 4042);
7960 dasm_put(Dst
, 4047);
7962 dasm_put(Dst
, 4062);
7964 dasm_put(Dst
, 4065, Dt6(->metatable
), 1-vk
, Dt6(->nomm
), 1<<MM_eq
);
7967 case BC_ISEQS
: case BC_ISNES
:
7968 vk
= op
== BC_ISEQS
;
7969 dasm_put(Dst
, 4084, 32-1, LJ_TSTR
, -(BCBIAS_J
*4 >> 16));
7971 dasm_put(Dst
, 4102);
7973 dasm_put(Dst
, 4104);
7975 dasm_put(Dst
, 4106);
7978 case BC_ISEQN
: case BC_ISNEN
:
7979 vk
= op
== BC_ISEQN
;
7981 dasm_put(Dst
, 4118, -(BCBIAS_J
*4 >> 16));
7983 dasm_put(Dst
, 4130);
7985 dasm_put(Dst
, 4132);
7987 dasm_put(Dst
, 4134);
7990 dasm_put(Dst
, 4141);
7992 dasm_put(Dst
, 4143);
7994 dasm_put(Dst
, 4145, -(BCBIAS_J
*4 >> 16));
7997 dasm_put(Dst
, 4158);
7999 dasm_put(Dst
, 4163);
8002 dasm_put(Dst
, 4165);
8004 dasm_put(Dst
, 4169);
8006 dasm_put(Dst
, 4171);
8008 dasm_put(Dst
, 4174);
8010 dasm_put(Dst
, 4185, LJ_TCDATA
);
8013 dasm_put(Dst
, 4193);
8017 case BC_ISEQP
: case BC_ISNEP
:
8018 vk
= op
== BC_ISEQP
;
8019 dasm_put(Dst
, 4217, 32-3, -(BCBIAS_J
*4 >> 16));
8021 dasm_put(Dst
, 4230);
8023 dasm_put(Dst
, 4232);
8025 dasm_put(Dst
, 4234);
8028 /* -- Unary test and copy ops ------------------------------------------- */
8030 case BC_ISTC
: case BC_ISFC
: case BC_IST
: case BC_ISF
:
8031 dasm_put(Dst
, 4246);
8032 if (op
== BC_IST
|| op
== BC_ISF
) {
8033 dasm_put(Dst
, 4250, LJ_TTRUE
, -(BCBIAS_J
*4 >> 16));
8035 dasm_put(Dst
, 4257);
8037 dasm_put(Dst
, 4259);
8039 dasm_put(Dst
, 4261);
8041 dasm_put(Dst
, 4263, LJ_TFALSE
);
8042 if (op
== BC_ISTC
) {
8043 dasm_put(Dst
, 4268);
8045 dasm_put(Dst
, 4271);
8047 dasm_put(Dst
, 4274, -(BCBIAS_J
*4 >> 16));
8049 dasm_put(Dst
, 4281);
8052 /* -- Unary ops --------------------------------------------------------- */
8055 dasm_put(Dst
, 4292);
8058 dasm_put(Dst
, 4305, LJ_TTRUE
);
8061 dasm_put(Dst
, 4321);
8063 dasm_put(Dst
, 4325);
8065 dasm_put(Dst
, 4353);
8067 dasm_put(Dst
, 4363);
8069 dasm_put(Dst
, 4366);
8073 dasm_put(Dst
, 4375, LJ_TSTR
, Dt5(->len
));
8075 dasm_put(Dst
, 4385);
8077 dasm_put(Dst
, 4390);
8079 dasm_put(Dst
, 4397, LJ_TTAB
);
8080 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8081 dasm_put(Dst
, 4411, Dt6(->metatable
));
8083 dasm_put(Dst
, 4418);
8084 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8085 dasm_put(Dst
, 4424, Dt6(->nomm
), 1<<MM_len
);
8089 /* -- Binary ops -------------------------------------------------------- */
8092 case BC_ADDVN
: case BC_ADDNV
: case BC_ADDVV
:
8094 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8097 dasm_put(Dst
, 4434);
8100 dasm_put(Dst
, 4440);
8103 dasm_put(Dst
, 4446);
8106 dasm_put(Dst
, 4452);
8109 dasm_put(Dst
, 4478);
8112 dasm_put(Dst
, 4481);
8115 dasm_put(Dst
, 4484);
8118 dasm_put(Dst
, 4487);
8120 dasm_put(Dst
, 4489);
8122 dasm_put(Dst
, 4493);
8126 dasm_put(Dst
, 4497);
8129 dasm_put(Dst
, 4500);
8132 dasm_put(Dst
, 4503);
8135 dasm_put(Dst
, 4506);
8137 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8140 dasm_put(Dst
, 4513);
8142 dasm_put(Dst
, 4515);
8144 dasm_put(Dst
, 4517);
8146 dasm_put(Dst
, 4520);
8148 dasm_put(Dst
, 4526);
8152 dasm_put(Dst
, 4530);
8154 dasm_put(Dst
, 4532);
8156 dasm_put(Dst
, 4534);
8158 dasm_put(Dst
, 4537);
8160 dasm_put(Dst
, 4543);
8164 dasm_put(Dst
, 4547);
8167 dasm_put(Dst
, 4557);
8170 case BC_SUBVN
: case BC_SUBNV
: case BC_SUBVV
:
8172 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8175 dasm_put(Dst
, 4570);
8178 dasm_put(Dst
, 4576);
8181 dasm_put(Dst
, 4582);
8184 dasm_put(Dst
, 4588);
8187 dasm_put(Dst
, 4614);
8190 dasm_put(Dst
, 4617);
8193 dasm_put(Dst
, 4620);
8196 dasm_put(Dst
, 4623);
8198 dasm_put(Dst
, 4625);
8200 dasm_put(Dst
, 4629);
8204 dasm_put(Dst
, 4633);
8207 dasm_put(Dst
, 4636);
8210 dasm_put(Dst
, 4639);
8213 dasm_put(Dst
, 4642);
8215 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8218 dasm_put(Dst
, 4649);
8220 dasm_put(Dst
, 4651);
8222 dasm_put(Dst
, 4653);
8224 dasm_put(Dst
, 4656);
8226 dasm_put(Dst
, 4662);
8230 dasm_put(Dst
, 4666);
8232 dasm_put(Dst
, 4668);
8234 dasm_put(Dst
, 4670);
8236 dasm_put(Dst
, 4673);
8238 dasm_put(Dst
, 4679);
8242 dasm_put(Dst
, 4683);
8245 dasm_put(Dst
, 4693);
8248 case BC_MULVN
: case BC_MULNV
: case BC_MULVV
:
8250 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8253 dasm_put(Dst
, 4706);
8256 dasm_put(Dst
, 4712);
8259 dasm_put(Dst
, 4718);
8262 dasm_put(Dst
, 4724);
8265 dasm_put(Dst
, 4750);
8268 dasm_put(Dst
, 4753);
8271 dasm_put(Dst
, 4756);
8274 dasm_put(Dst
, 4759);
8276 dasm_put(Dst
, 4761);
8278 dasm_put(Dst
, 4765);
8282 dasm_put(Dst
, 4769);
8285 dasm_put(Dst
, 4772);
8288 dasm_put(Dst
, 4775);
8291 dasm_put(Dst
, 4778);
8293 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8296 dasm_put(Dst
, 4785);
8298 dasm_put(Dst
, 4787);
8300 dasm_put(Dst
, 4789);
8302 dasm_put(Dst
, 4792);
8304 dasm_put(Dst
, 4798);
8308 dasm_put(Dst
, 4802);
8310 dasm_put(Dst
, 4804);
8312 dasm_put(Dst
, 4806);
8314 dasm_put(Dst
, 4809);
8316 dasm_put(Dst
, 4815);
8320 dasm_put(Dst
, 4819);
8323 dasm_put(Dst
, 4829);
8326 case BC_DIVVN
: case BC_DIVNV
: case BC_DIVVV
:
8327 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8330 dasm_put(Dst
, 4842);
8332 dasm_put(Dst
, 4844);
8334 dasm_put(Dst
, 4846);
8336 dasm_put(Dst
, 4849);
8338 dasm_put(Dst
, 4855);
8342 dasm_put(Dst
, 4859);
8344 dasm_put(Dst
, 4861);
8346 dasm_put(Dst
, 4863);
8348 dasm_put(Dst
, 4866);
8350 dasm_put(Dst
, 4872);
8354 dasm_put(Dst
, 4876);
8357 dasm_put(Dst
, 4886);
8361 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8364 dasm_put(Dst
, 4899);
8367 dasm_put(Dst
, 4905);
8370 dasm_put(Dst
, 4911);
8373 dasm_put(Dst
, 4917);
8376 dasm_put(Dst
, 4945);
8379 dasm_put(Dst
, 4948);
8382 dasm_put(Dst
, 4951);
8385 dasm_put(Dst
, 4954);
8387 dasm_put(Dst
, 4956);
8389 dasm_put(Dst
, 4960);
8393 dasm_put(Dst
, 4964);
8396 dasm_put(Dst
, 4967);
8399 dasm_put(Dst
, 4970);
8403 dasm_put(Dst
, 4973);
8405 dasm_put(Dst
, 4975);
8407 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8410 dasm_put(Dst
, 4987);
8412 dasm_put(Dst
, 4989);
8414 dasm_put(Dst
, 4991);
8416 dasm_put(Dst
, 4994);
8418 dasm_put(Dst
, 5000);
8422 dasm_put(Dst
, 5004);
8424 dasm_put(Dst
, 5006);
8426 dasm_put(Dst
, 5008);
8428 dasm_put(Dst
, 5011);
8430 dasm_put(Dst
, 5017);
8434 dasm_put(Dst
, 5021);
8438 dasm_put(Dst
, 5031);
8440 dasm_put(Dst
, 5033);
8443 case BC_MODNV
: case BC_MODVV
:
8445 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8448 dasm_put(Dst
, 5051);
8451 dasm_put(Dst
, 5057);
8454 dasm_put(Dst
, 5063);
8457 dasm_put(Dst
, 5069);
8459 dasm_put(Dst
, 5077);
8461 dasm_put(Dst
, 5081);
8465 dasm_put(Dst
, 5085);
8468 dasm_put(Dst
, 5088);
8471 dasm_put(Dst
, 5091);
8474 dasm_put(Dst
, 5094);
8476 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8479 dasm_put(Dst
, 5097);
8481 dasm_put(Dst
, 5099);
8483 dasm_put(Dst
, 5101);
8485 dasm_put(Dst
, 5104);
8487 dasm_put(Dst
, 5110);
8491 dasm_put(Dst
, 5114);
8493 dasm_put(Dst
, 5116);
8495 dasm_put(Dst
, 5118);
8497 dasm_put(Dst
, 5121);
8499 dasm_put(Dst
, 5127);
8503 dasm_put(Dst
, 5131);
8506 dasm_put(Dst
, 5141);
8510 dasm_put(Dst
, 5144);
8514 dasm_put(Dst
, 5167, Dt1(->base
), 32-3, Dt1(->base
));
8517 /* -- Constant ops ------------------------------------------------------ */
8520 dasm_put(Dst
, 5197, 32-1, LJ_TSTR
);
8524 dasm_put(Dst
, 5216, 32-1, LJ_TCDATA
);
8529 dasm_put(Dst
, 5235, 31-13);
8531 dasm_put(Dst
, 5251, 31-13);
8535 dasm_put(Dst
, 5270);
8538 dasm_put(Dst
, 5283, 32-3);
8541 dasm_put(Dst
, 5298);
8544 /* -- Upvalue and function ops ------------------------------------------ */
8547 dasm_put(Dst
, 5317, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->v
));
8550 dasm_put(Dst
, 5338, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->marked
), DtA(->v
), LJ_GC_BLACK
, DtA(->closed
), -(LJ_TISNUM
+1), LJ_TISGCV
- (LJ_TISNUM
+1), Dt4(->gch
.marked
), LJ_GC_WHITES
, GG_DISP2G
);
8553 dasm_put(Dst
, 5391, 32-1, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->marked
), DtA(->v
), LJ_GC_BLACK
, Dt5(->marked
), DtA(->closed
), LJ_TSTR
, LJ_GC_WHITES
, GG_DISP2G
);
8556 dasm_put(Dst
, 5442, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->v
));
8559 dasm_put(Dst
, 5463, 32-1, offsetof(GCfuncL
, uvptr
), 32-3, DtA(->v
));
8563 dasm_put(Dst
, 5486, Dt1(->openupval
), 32-1, -(BCBIAS_J
*4 >> 16), Dt1(->base
), Dt1(->base
));
8567 dasm_put(Dst
, 5516, 32-1, Dt1(->base
), Dt1(->base
), LJ_TFUNC
);
8570 /* -- Table ops --------------------------------------------------------- */
8574 dasm_put(Dst
, 5544, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), Dt1(->base
));
8575 if (op
== BC_TNEW
) {
8576 dasm_put(Dst
, 5557);
8578 dasm_put(Dst
, 5566, 32-1);
8580 dasm_put(Dst
, 5573, Dt1(->base
), LJ_TTAB
);
8581 if (op
== BC_TNEW
) {
8582 dasm_put(Dst
, 5590);
8584 dasm_put(Dst
, 5595);
8589 dasm_put(Dst
, 5604, 32-1, Dt7(->env
));
8590 if (op
== BC_GGET
) {
8591 dasm_put(Dst
, 5612);
8593 dasm_put(Dst
, 5615);
8598 dasm_put(Dst
, 5618);
8600 dasm_put(Dst
, 5622);
8602 dasm_put(Dst
, 5624);
8604 dasm_put(Dst
, 5626, LJ_TTAB
);
8606 dasm_put(Dst
, 5632, Dt6(->asize
), Dt6(->array
), 31-3);
8608 dasm_put(Dst
, 5642, Dt6(->asize
), Dt6(->array
), 31-3);
8610 dasm_put(Dst
, 5659, LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
, LJ_TSTR
);
8612 dasm_put(Dst
, 5699);
8614 dasm_put(Dst
, 5701);
8617 dasm_put(Dst
, 5704, 32-1, LJ_TTAB
, Dt6(->hmask
), Dt5(->hash
), Dt6(->node
), 31-5, 31-3, DtB(->key
), 4+offsetof(Node
, key
), DtB(->val
), 4+offsetof(Node
, val
), LJ_TSTR
, LJ_TNIL
, DtB(->next
));
8618 dasm_put(Dst
, 5765, LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
8621 dasm_put(Dst
, 5785, 32-3, LJ_TTAB
, Dt6(->asize
), Dt6(->array
), LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
8625 dasm_put(Dst
, 5833);
8627 dasm_put(Dst
, 5837);
8629 dasm_put(Dst
, 5839);
8631 dasm_put(Dst
, 5841, LJ_TTAB
);
8633 dasm_put(Dst
, 5847, Dt6(->asize
), Dt6(->array
), 31-3);
8635 dasm_put(Dst
, 5857, Dt6(->asize
), Dt6(->array
), 31-3);
8637 dasm_put(Dst
, 5874, Dt6(->marked
), LJ_TNIL
, LJ_GC_BLACK
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, LJ_TSTR
);
8639 dasm_put(Dst
, 5921);
8641 dasm_put(Dst
, 5923, DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
8643 dasm_put(Dst
, 5938, LJ_TSTR
, LJ_TNIL
);
8645 dasm_put(Dst
, 5964, 32-1, LJ_TTAB
, Dt6(->hmask
), Dt5(->hash
), Dt6(->node
), Dt6(->nomm
), 31-5, 31-3, Dt6(->marked
), DtB(->key
), 4+offsetof(Node
, key
), DtB(->val
), 4+offsetof(Node
, val
), LJ_TSTR
, LJ_TNIL
);
8646 dasm_put(Dst
, 6015, LJ_GC_BLACK
, DtB(->val
), Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, DtB(->next
), Dt6(->metatable
), DISPATCH_GL(tmptv
), Dt1(->base
), Dt6(->nomm
), 1<<MM_newindex
);
8647 dasm_put(Dst
, 6071, LJ_TSTR
, Dt1(->base
), DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
8650 dasm_put(Dst
, 6096, 32-3, LJ_TTAB
, Dt6(->asize
), Dt6(->array
), Dt6(->marked
), LJ_TNIL
, LJ_GC_BLACK
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, DISPATCH_GL(gc
.grayagain
));
8651 dasm_put(Dst
, 6154, DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
8655 dasm_put(Dst
, 6164, 32-3, Dt6(->asize
), 31-3, Dt6(->marked
), Dt6(->array
), LJ_GC_BLACK
, Dt1(->base
), DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
8656 dasm_put(Dst
, 6233);
8659 /* -- Calls and vararg handling ----------------------------------------- */
8662 dasm_put(Dst
, 6236);
8665 dasm_put(Dst
, 6238, LJ_TFUNC
, Dt7(->pc
));
8669 dasm_put(Dst
, 6259);
8672 dasm_put(Dst
, 6261, LJ_TFUNC
, FRAME_TYPE
, Dt7(->ffid
), FRAME_VARG
, Dt7(->pc
), -4-8, Dt7(->pc
), PC2PROTO(k
), FRAME_TYPEP
);
8673 dasm_put(Dst
, 6325, FRAME_TYPE
);
8677 dasm_put(Dst
, 6334, LJ_TFUNC
, Dt7(->pc
));
8683 dasm_put(Dst
, 6361, Dt6(->asize
), Dt6(->array
), 31-3, LJ_TNIL
);
8685 dasm_put(Dst
, 6383);
8687 dasm_put(Dst
, 6386);
8689 dasm_put(Dst
, 6390, -(BCBIAS_J
*4 >> 16));
8691 dasm_put(Dst
, 6398);
8693 dasm_put(Dst
, 6400, Dt6(->hmask
), Dt6(->node
), 31-5, 31-3, LJ_TNIL
, DtB(->key
), -(BCBIAS_J
*4 >> 16));
8697 dasm_put(Dst
, 6456, LJ_TTAB
, LJ_TFUNC
, LJ_TNIL
, Dt8(->ffid
), FF_next_N
, 32-1, -(BCBIAS_J
*4 >> 16), BC_JMP
, BC_ITERC
, -(BCBIAS_J
*4 >> 16));
8701 dasm_put(Dst
, 6506, FRAME_VARG
, Dt1(->maxstack
), Dt1(->top
), Dt1(->base
), 32-3, Dt1(->base
));
8702 dasm_put(Dst
, 6586);
8705 /* -- Returns ----------------------------------------------------------- */
8708 dasm_put(Dst
, 6592);
8712 dasm_put(Dst
, 6594, FRAME_TYPE
, FRAME_VARG
, Dt7(->pc
), PC2PROTO(k
), FRAME_TYPEP
);
8715 case BC_RET0
: case BC_RET1
:
8716 dasm_put(Dst
, 6664, FRAME_TYPE
, FRAME_VARG
);
8717 if (op
== BC_RET1
) {
8718 dasm_put(Dst
, 6677);
8720 dasm_put(Dst
, 6680, Dt7(->pc
), PC2PROTO(k
));
8723 /* -- Loops and branches ------------------------------------------------ */
8727 dasm_put(Dst
, 6708);
8738 vk
= (op
== BC_IFORL
|| op
== BC_JFORL
);
8740 dasm_put(Dst
, 6710, FORL_IDX
*8+4);
8742 dasm_put(Dst
, 6715, FORL_STEP
*8+4, FORL_STOP
*8+4, FORL_IDX
*8+4);
8744 dasm_put(Dst
, 6729, FORL_STEP
*8, FORL_STEP
*8+4, FORL_STOP
*8, FORL_STOP
*8+4);
8746 dasm_put(Dst
, 6745, FORL_EXT
*8);
8747 if (op
!= BC_JFORL
) {
8748 dasm_put(Dst
, 6752, 32-1);
8750 dasm_put(Dst
, 6755, FORL_EXT
*8+4);
8751 if (op
!= BC_JFORL
) {
8752 dasm_put(Dst
, 6758);
8754 if (op
== BC_FORI
) {
8755 dasm_put(Dst
, 6760);
8756 } else if (op
== BC_JFORI
) {
8757 dasm_put(Dst
, 6763, -(BCBIAS_J
*4 >> 16), BC_JLOOP
);
8758 } else if (op
== BC_IFORL
) {
8759 dasm_put(Dst
, 6768, -(BCBIAS_J
*4 >> 16));
8761 dasm_put(Dst
, 6773, BC_JLOOP
);
8763 dasm_put(Dst
, 6776);
8765 dasm_put(Dst
, 6792);
8770 dasm_put(Dst
, 6799, FORL_IDX
*8);
8772 dasm_put(Dst
, 6803);
8774 dasm_put(Dst
, 6805, FORL_STEP
*8, FORL_STOP
*8, FORL_STEP
*8, FORL_IDX
*8);
8777 dasm_put(Dst
, 6815);
8779 dasm_put(Dst
, 6817, FORL_STEP
*8, FORL_STOP
*8);
8781 dasm_put(Dst
, 6826, FORL_IDX
*8, FORL_STEP
*8, FORL_STOP
*8);
8783 dasm_put(Dst
, 6837);
8784 if (op
!= BC_JFORL
) {
8785 dasm_put(Dst
, 6839, 32-1);
8787 dasm_put(Dst
, 6842, FORL_EXT
*8);
8788 if (op
!= BC_JFORL
) {
8789 dasm_put(Dst
, 6845);
8791 dasm_put(Dst
, 6847);
8792 if (op
== BC_JFORI
) {
8793 dasm_put(Dst
, 6849, -(BCBIAS_J
*4 >> 16));
8795 dasm_put(Dst
, 6852);
8796 if (op
== BC_FORI
) {
8797 dasm_put(Dst
, 6855);
8798 } else if (op
== BC_IFORL
) {
8800 dasm_put(Dst
, 6858);
8802 dasm_put(Dst
, 6861);
8804 dasm_put(Dst
, 6864, -(BCBIAS_J
*4 >> 16));
8806 dasm_put(Dst
, 6868, BC_JLOOP
);
8809 dasm_put(Dst
, 6871);
8811 dasm_put(Dst
, 6874);
8813 dasm_put(Dst
, 6886);
8814 if (op
== BC_FORI
) {
8815 dasm_put(Dst
, 6888, -(BCBIAS_J
*4 >> 16));
8816 } else if (op
== BC_IFORL
) {
8817 dasm_put(Dst
, 6894);
8819 dasm_put(Dst
, 6897, BC_JLOOP
);
8821 dasm_put(Dst
, 6900);
8826 dasm_put(Dst
, 6903);
8835 dasm_put(Dst
, 6905, LJ_TNIL
);
8836 if (op
== BC_JITERL
) {
8837 dasm_put(Dst
, 6912);
8839 dasm_put(Dst
, 6914, 32-1, -(BCBIAS_J
*4 >> 16));
8841 dasm_put(Dst
, 6922);
8846 dasm_put(Dst
, 6934);
8851 dasm_put(Dst
, 6936);
8856 dasm_put(Dst
, 6947);
8861 dasm_put(Dst
, 6949, 32-1, -(BCBIAS_J
*4 >> 16));
8864 /* -- Function headers -------------------------------------------------- */
8868 dasm_put(Dst
, 6965);
8870 case BC_FUNCV
: /* NYI: compiled vararg functions. */
8878 dasm_put(Dst
, 6967, Dt1(->maxstack
), -4+PC2PROTO(numparams
), -4+PC2PROTO(k
), 31-3);
8879 if (op
== BC_JFUNCF
) {
8880 dasm_put(Dst
, 6985);
8882 dasm_put(Dst
, 6987);
8884 dasm_put(Dst
, 6996);
8891 dasm_put(Dst
, 7002);
8892 break; /* NYI: compiled vararg functions. */
8895 dasm_put(Dst
, 7004, Dt1(->maxstack
), 8+FRAME_VARG
, -4+PC2PROTO(k
), -4+PC2PROTO(numparams
), LJ_TNIL
);
8900 if (op
== BC_FUNCC
) {
8901 dasm_put(Dst
, 7057, Dt8(->f
));
8903 dasm_put(Dst
, 7060, DISPATCH_GL(wrapf
));
8905 dasm_put(Dst
, 7063, Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), ~LJ_VMST_C
);
8906 if (op
== BC_FUNCCW
) {
8907 dasm_put(Dst
, 7076, Dt8(->f
));
8909 dasm_put(Dst
, 7079, DISPATCH_GL(vmstate
), Dt1(->top
), 31-3, Dt1(->base
), ~LJ_VMST_INTERP
, DISPATCH_GL(vmstate
));
8912 /* ---------------------------------------------------------------------- */
8915 fprintf(stderr
, "Error: undefined opcode BC_%s\n", bc_names
[op
]);
8921 static int build_backend(BuildCtx
*ctx
)
8925 dasm_growpc(Dst
, BC__MAX
);
8927 build_subroutines(ctx
);
8929 dasm_put(Dst
, 7100);
8930 for (op
= 0; op
< BC__MAX
; op
++)
8931 build_ins(ctx
, (BCOp
)op
, op
);
8936 /* Emit pseudo frame-info for all assembler functions. */
8937 static void emit_asm_debug(BuildCtx
*ctx
)
8940 switch (ctx
->mode
) {
8942 fprintf(ctx
->fp
, "\t.section .debug_frame,\"\",@progbits\n");
8945 "\t.long .LECIE0-.LSCIE0\n"
8947 "\t.long 0xffffffff\n"
8953 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
8958 "\t.long .LEFDE0-.LASFDE0\n"
8960 "\t.long .Lframe0\n"
8963 "\t.byte 0xe\n\t.uleb128 %d\n"
8964 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n",
8965 (int)ctx
->codesz
, CFRAME_SIZE
);
8966 for (i
= 14; i
<= 31; i
++)
8968 "\t.byte %d\n\t.uleb128 %d\n"
8969 "\t.byte %d\n\t.uleb128 %d\n",
8970 0x80+i
, 37+(31-i
), 0x80+32+i
, 2+2*(31-i
));
8974 fprintf(ctx
->fp
, "\t.section .eh_frame,\"a\",@progbits\n");
8977 "\t.long .LECIE1-.LSCIE1\n"
8981 "\t.string \"zPR\"\n"
8985 "\t.uleb128 6\n" /* augmentation length */
8986 "\t.byte 0x1b\n" /* pcrel|sdata4 */
8987 "\t.long lj_err_unwind_dwarf-.\n"
8988 "\t.byte 0x1b\n" /* pcrel|sdata4 */
8989 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
8994 "\t.long .LEFDE1-.LASFDE1\n"
8996 "\t.long .LASFDE1-.Lframe1\n"
8997 "\t.long .Lbegin-.\n"
8999 "\t.uleb128 0\n" /* augmentation length */
9000 "\t.byte 0xe\n\t.uleb128 %d\n"
9001 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n",
9002 (int)ctx
->codesz
, CFRAME_SIZE
);
9003 for (i
= 14; i
<= 31; i
++)
9005 "\t.byte %d\n\t.uleb128 %d\n"
9006 "\t.byte %d\n\t.uleb128 %d\n",
9007 0x80+i
, 37+(31-i
), 0x80+32+i
, 2+2*(31-i
));