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
[7562] = {
7589 GLOB_vm_unwind_c_eh
,
7591 GLOB_vm_unwind_ff_eh
,
7592 GLOB_vm_growstack_c
,
7593 GLOB_vm_growstack_l
,
7597 GLOB_vm_call_dispatch
,
7599 GLOB_vm_call_dispatch_f
,
7619 GLOB_vmeta_equal_cd
,
7620 GLOB_vmeta_arith_nv
,
7621 GLOB_vmeta_arith_nv2
,
7623 GLOB_vmeta_arith_vn
,
7624 GLOB_vmeta_arith_vv
,
7625 GLOB_vmeta_arith_vn2
,
7626 GLOB_vmeta_arith_vv2
,
7637 GLOB_ff_getmetatable
,
7639 GLOB_ff_setmetatable
,
7650 GLOB_ff_coroutine_resume
,
7651 GLOB_ff_coroutine_wrap_aux
,
7652 GLOB_ff_coroutine_yield
,
7682 GLOB_ff_string_byte
,
7683 GLOB_ff_string_char
,
7687 GLOB_ff_string_reverse
,
7688 GLOB_ff_string_lower
,
7689 GLOB_ff_string_upper
,
7700 GLOB_ff_bit_arshift
,
7711 GLOB_vm_exit_handler
,
7712 GLOB_vm_exit_interp
,
7727 static const char *const globnames
[] = {
7746 "vm_call_dispatch_f",
7797 "ff_coroutine_resume",
7798 "ff_coroutine_wrap_aux",
7799 "ff_coroutine_yield",
7834 "ff_string_reverse",
7874 static const char *const extnames
[] = {
7875 "lj_state_growstack",
7886 "lj_str_fromnumber",
7890 "lj_ffh_coroutine_wrap_err",
7927 "lj_gc_step_fixtop",
7932 #define Dt1(_V) (int)(ptrdiff_t)&(((lua_State *)0)_V)
7933 #define Dt2(_V) (int)(ptrdiff_t)&(((global_State *)0)_V)
7934 #define Dt3(_V) (int)(ptrdiff_t)&(((TValue *)0)_V)
7935 #define Dt4(_V) (int)(ptrdiff_t)&(((GCobj *)0)_V)
7936 #define Dt5(_V) (int)(ptrdiff_t)&(((GCstr *)0)_V)
7937 #define Dt6(_V) (int)(ptrdiff_t)&(((GCtab *)0)_V)
7938 #define Dt7(_V) (int)(ptrdiff_t)&(((GCfuncL *)0)_V)
7939 #define Dt8(_V) (int)(ptrdiff_t)&(((GCfuncC *)0)_V)
7940 #define Dt9(_V) (int)(ptrdiff_t)&(((GCproto *)0)_V)
7941 #define DtA(_V) (int)(ptrdiff_t)&(((GCupval *)0)_V)
7942 #define DtB(_V) (int)(ptrdiff_t)&(((Node *)0)_V)
7943 #define DtC(_V) (int)(ptrdiff_t)&(((int *)0)_V)
7944 #define DtD(_V) (int)(ptrdiff_t)&(((GCtrace *)0)_V)
7945 #define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
7946 #define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
7947 #define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
7949 /* Generate subroutines used by opcodes and other parts of the VM. */
7950 /* The .code_sub section should be last to help static branch prediction. */
7951 static void build_subroutines(BuildCtx
*ctx
)
7954 dasm_put(Dst
, 1, FRAME_P
, LJ_TTRUE
, FRAME_TYPE
, FRAME_C
, ~LJ_VMST_C
, Dt1(->base
), DISPATCH_GL(vmstate
), 31-3, Dt1(->top
));
7955 dasm_put(Dst
, 55, Dt1(->cframe
), 56+(14-14)*4, 128+(14-14)*8, 56+(15-14)*4, 128+(15-14)*8, 56+(16-14)*4, 128+(16-14)*8, 56+(17-14)*4, 128+(17-14)*8, 56+(18-14)*4, 128+(18-14)*8, 56+(19-14)*4, 128+(19-14)*8, 56+(20-14)*4, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4, 128+(23-14)*8);
7956 dasm_put(Dst
, 105, 56+(24-14)*4, 128+(24-14)*8, 56+(25-14)*4, 128+(25-14)*8, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4, 128+(31-14)*8, Dt1(->maxstack
));
7957 dasm_put(Dst
, 154, 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
);
7958 dasm_put(Dst
, 217, DISPATCH_GL(vmstate
), LUA_MINSTACK
, Dt1(->base
), Dt1(->top
), 32-3, Dt1(->base
), Dt1(->top
), Dt7(->pc
), 56+(14-14)*4, 128+(14-14)*8, 56+(15-14)*4, 128+(15-14)*8, 56+(16-14)*4, 128+(16-14)*8, 56+(17-14)*4);
7959 dasm_put(Dst
, 277, 128+(17-14)*8, 56+(18-14)*4, 128+(18-14)*8, 56+(19-14)*4, 128+(19-14)*8, 56+(20-14)*4, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4, 128+(23-14)*8, 56+(24-14)*4, 128+(24-14)*8, 56+(25-14)*4, 128+(25-14)*8, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4);
7960 dasm_put(Dst
, 326, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4, 128+(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
));
7961 dasm_put(Dst
, 393, 56+(14-14)*4, 128+(14-14)*8, 56+(15-14)*4, 128+(15-14)*8, 56+(16-14)*4, 128+(16-14)*8, 56+(17-14)*4, 128+(17-14)*8, 56+(18-14)*4, 128+(18-14)*8, 56+(19-14)*4, 128+(19-14)*8, 56+(20-14)*4, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4);
7962 dasm_put(Dst
, 440, 128+(23-14)*8, 56+(24-14)*4, 128+(24-14)*8, 56+(25-14)*4, 128+(25-14)*8, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4, 128+(31-14)*8, FRAME_CP
, 56+(14-14)*4, 128+(14-14)*8);
7963 dasm_put(Dst
, 488, 56+(15-14)*4, 128+(15-14)*8, 56+(16-14)*4, 128+(16-14)*8, 56+(17-14)*4, 128+(17-14)*8, 56+(18-14)*4, 128+(18-14)*8, 56+(19-14)*4, 128+(19-14)*8, 56+(20-14)*4, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4, 128+(23-14)*8, 56+(24-14)*4, 128+(24-14)*8, 56+(25-14)*4, 128+(25-14)*8);
7964 dasm_put(Dst
, 535, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4, 128+(31-14)*8, FRAME_C
, Dt1(->cframe
), Dt1(->cframe
), Dt1(->glref
), GG_G2DISP
, Dt1(->base
), LJ_TISNUM
, Dt1(->top
));
7965 dasm_put(Dst
, 586, ~LJ_VMST_INTERP
, LJ_TNIL
, DISPATCH_GL(vmstate
), LJ_TFUNC
, Dt7(->pc
), 56+(14-14)*4, 128+(14-14)*8, 56+(15-14)*4, 128+(15-14)*8, 56+(16-14)*4, 128+(16-14)*8, 56+(17-14)*4, 128+(17-14)*8, 56+(18-14)*4, 128+(18-14)*8, 56+(19-14)*4, 128+(19-14)*8, 56+(20-14)*4);
7966 dasm_put(Dst
, 654, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4, 128+(23-14)*8, 56+(24-14)*4, 128+(24-14)*8, 56+(25-14)*4, 128+(25-14)*8, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4);
7967 dasm_put(Dst
, 701, 128+(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
));
7968 dasm_put(Dst
, 775, LJ_TSTR
, DISPATCH_GL(tmptv
), LJ_TTAB
, DISPATCH_GL(tmptv2
), LJ_TSTR
);
7972 dasm_put(Dst
, 804, DISPATCH_GL(tmptv
));
7978 dasm_put(Dst
, 814, Dt1(->base
), FRAME_CONT
, Dt1(->top
), DISPATCH_GL(tmptv
), LJ_TSTR
, DISPATCH_GL(tmptv
), LJ_TTAB
, DISPATCH_GL(tmptv2
), LJ_TSTR
);
7982 dasm_put(Dst
, 886, DISPATCH_GL(tmptv
));
7988 dasm_put(Dst
, 896, Dt1(->base
), FRAME_CONT
, Dt1(->top
));
8000 dasm_put(Dst
, 951, Dt1(->base
), -(BCBIAS_J
*4 >> 16), LJ_TTRUE
, LJ_TTRUE
, Dt1(->base
));
8002 dasm_put(Dst
, 1014, Dt1(->base
));
8004 dasm_put(Dst
, 1025);
8006 dasm_put(Dst
, 1032);
8008 dasm_put(Dst
, 1037);
8010 dasm_put(Dst
, 1051);
8012 dasm_put(Dst
, 1054);
8014 dasm_put(Dst
, 1057);
8016 dasm_put(Dst
, 1060, Dt1(->base
), FRAME_CONT
);
8017 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8018 dasm_put(Dst
, 1084);
8020 dasm_put(Dst
, 1086, Dt1(->base
));
8021 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8022 dasm_put(Dst
, 1094);
8024 dasm_put(Dst
, 1101);
8026 dasm_put(Dst
, 1104, Dt1(->base
), Dt7(->pc
), Dt1(->base
), Dt1(->base
));
8028 dasm_put(Dst
, 1152);
8030 dasm_put(Dst
, 1154);
8032 dasm_put(Dst
, 1156, BC_JFORI
);
8034 dasm_put(Dst
, 1159);
8036 dasm_put(Dst
, 1161, BC_JFORI
);
8038 dasm_put(Dst
, 1164, BC_FORI
, LJ_TFALSE
, ~LJ_TISNUM
+1, 31-3, Dt8(->upvalue
), LJ_TTAB
, Dt6(->metatable
));
8039 dasm_put(Dst
, 1227, 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
));
8040 dasm_put(Dst
, 1275, 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
));
8041 dasm_put(Dst
, 1330, DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
), LJ_TTAB
, LJ_TSTR
, DISPATCH_GL(gcroot
[GCROOT_BASEMT_NUM
]), Dt1(->base
));
8042 dasm_put(Dst
, 1390, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8044 dasm_put(Dst
, 1400);
8046 dasm_put(Dst
, 1403);
8048 dasm_put(Dst
, 1406, LJ_TSTR
, LJ_TTAB
, Dt1(->base
), Dt1(->top
), LJ_TNIL
, (2+1)*8, LJ_TTAB
);
8049 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8050 dasm_put(Dst
, 1457, Dt6(->metatable
), Dt8(->upvalue
[0]));
8052 dasm_put(Dst
, 1466, Dt8(->upvalue
[0]));
8054 dasm_put(Dst
, 1470, (3+1)*8);
8056 dasm_put(Dst
, 1482);
8058 dasm_put(Dst
, 1484);
8060 dasm_put(Dst
, 1486, LJ_TTAB
);
8062 dasm_put(Dst
, 1493);
8064 dasm_put(Dst
, 1498);
8066 dasm_put(Dst
, 1510, Dt6(->asize
), Dt6(->array
));
8068 dasm_put(Dst
, 1515);
8070 dasm_put(Dst
, 1517);
8072 dasm_put(Dst
, 1521, 31-3);
8074 dasm_put(Dst
, 1526, 31-3);
8076 dasm_put(Dst
, 1530, LJ_TNIL
, (0+1)*8, (2+1)*8, Dt6(->hmask
), (0+1)*8, (0+1)*8, LJ_TTAB
);
8077 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8078 dasm_put(Dst
, 1578, Dt6(->metatable
), Dt8(->upvalue
[0]));
8080 dasm_put(Dst
, 1587, Dt8(->upvalue
[0]));
8083 dasm_put(Dst
, 1591);
8085 dasm_put(Dst
, 1593);
8087 dasm_put(Dst
, 1595, (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
));
8088 dasm_put(Dst
, 1656, 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
));
8089 dasm_put(Dst
, 1718, Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, LJ_TTRUE
, FRAME_TYPE
, LJ_TFALSE
, Dt1(->top
), (2+1)*8, 32-3);
8090 dasm_put(Dst
, 1781, 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
);
8091 dasm_put(Dst
, 1840, Dt1(->base
), DISPATCH_GL(vmstate
), Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, 32-3, Dt1(->cframe
));
8092 dasm_put(Dst
, 1897, Dt1(->base
), CFRAME_RESUME
, Dt1(->top
), LUA_YIELD
, Dt1(->cframe
), Dt1(->status
));
8094 dasm_put(Dst
, 1922);
8096 dasm_put(Dst
, 1943, (1+1)*8, FRAME_TYPE
);
8098 dasm_put(Dst
, 1985, 31-11, 32-21, 31-11);
8099 dasm_put(Dst
, 2067, 31-11, 32-21, 31-11);
8101 dasm_put(Dst
, 2121);
8103 dasm_put(Dst
, 2148);
8104 dasm_put(Dst
, 2207);
8105 dasm_put(Dst
, 2265);
8106 dasm_put(Dst
, 2321, Dt8(->upvalue
[0]));
8107 dasm_put(Dst
, 2387);
8109 dasm_put(Dst
, 2391);
8111 dasm_put(Dst
, 2406);
8113 dasm_put(Dst
, 2424, DISPATCH_GL(tmptv
), DISPATCH_GL(tmptv
));
8115 dasm_put(Dst
, 2446);
8117 dasm_put(Dst
, 2451, (2+1)*8);
8119 dasm_put(Dst
, 2455);
8121 dasm_put(Dst
, 2458);
8123 dasm_put(Dst
, 2460, (2+1)*8);
8125 dasm_put(Dst
, 2482);
8127 dasm_put(Dst
, 2551);
8130 dasm_put(Dst
, 2576);
8132 dasm_put(Dst
, 2645);
8134 dasm_put(Dst
, 2670, LJ_TSTR
, Dt5(->len
), LJ_TSTR
, Dt5(->len
));
8136 dasm_put(Dst
, 2697, Dt5([1]), (0+1)*8);
8138 dasm_put(Dst
, 2709, Dt5([1]), 31-3);
8140 dasm_put(Dst
, 2725, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8142 dasm_put(Dst
, 2736);
8144 dasm_put(Dst
, 2744);
8146 dasm_put(Dst
, 2755, Dt1(->base
), Dt1(->base
), LJ_TSTR
, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8148 dasm_put(Dst
, 2783);
8150 dasm_put(Dst
, 2785);
8152 dasm_put(Dst
, 2791);
8154 dasm_put(Dst
, 2793);
8156 dasm_put(Dst
, 2795);
8158 dasm_put(Dst
, 2799);
8160 dasm_put(Dst
, 2808);
8162 dasm_put(Dst
, 2819, LJ_TSTR
);
8164 dasm_put(Dst
, 2824);
8166 dasm_put(Dst
, 2828, Dt5(->len
), sizeof(GCstr
)-1, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8168 dasm_put(Dst
, 2878);
8170 dasm_put(Dst
, 2880);
8172 dasm_put(Dst
, 2882, LJ_TSTR
);
8174 dasm_put(Dst
, 2889);
8176 dasm_put(Dst
, 2893);
8178 dasm_put(Dst
, 2900, 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
));
8179 dasm_put(Dst
, 2953, 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
));
8180 dasm_put(Dst
, 3011, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), LJ_TSTR
, DISPATCH_GL(tmpbuf
.sz
), Dt5(->len
), sizeof(GCstr
), DISPATCH_GL(tmpbuf
.buf
), LJ_TTAB
);
8182 dasm_put(Dst
, 3080);
8184 dasm_put(Dst
, 3090);
8186 dasm_put(Dst
, 3103);
8188 dasm_put(Dst
, 3109);
8190 dasm_put(Dst
, 3111);
8192 dasm_put(Dst
, 3113);
8194 dasm_put(Dst
, 3117);
8196 dasm_put(Dst
, 3120);
8198 dasm_put(Dst
, 3126);
8200 dasm_put(Dst
, 3131);
8202 dasm_put(Dst
, 3141);
8204 dasm_put(Dst
, 3154);
8206 dasm_put(Dst
, 3160);
8208 dasm_put(Dst
, 3162);
8210 dasm_put(Dst
, 3164);
8212 dasm_put(Dst
, 3168);
8214 dasm_put(Dst
, 3171);
8216 dasm_put(Dst
, 3177);
8218 dasm_put(Dst
, 3182);
8220 dasm_put(Dst
, 3192);
8222 dasm_put(Dst
, 3205);
8224 dasm_put(Dst
, 3211);
8226 dasm_put(Dst
, 3213);
8228 dasm_put(Dst
, 3215);
8230 dasm_put(Dst
, 3219);
8232 dasm_put(Dst
, 3222);
8234 dasm_put(Dst
, 3228);
8236 dasm_put(Dst
, 3233);
8238 dasm_put(Dst
, 3243);
8240 dasm_put(Dst
, 3256);
8242 dasm_put(Dst
, 3263);
8244 dasm_put(Dst
, 3273);
8246 dasm_put(Dst
, 3286);
8248 dasm_put(Dst
, 3290);
8250 dasm_put(Dst
, 3305);
8252 dasm_put(Dst
, 3326);
8254 dasm_put(Dst
, 3331);
8256 dasm_put(Dst
, 3346);
8258 dasm_put(Dst
, 3367);
8260 dasm_put(Dst
, 3372);
8262 dasm_put(Dst
, 3387);
8264 dasm_put(Dst
, 3408);
8266 dasm_put(Dst
, 3413);
8268 dasm_put(Dst
, 3428);
8270 dasm_put(Dst
, 3449);
8272 dasm_put(Dst
, 3453);
8274 dasm_put(Dst
, 3468);
8276 dasm_put(Dst
, 3489);
8278 dasm_put(Dst
, 3494);
8280 dasm_put(Dst
, 3504);
8283 dasm_put(Dst
, 3517);
8285 dasm_put(Dst
, 3520);
8287 dasm_put(Dst
, 3526);
8289 dasm_put(Dst
, 3534);
8291 dasm_put(Dst
, 3542);
8293 dasm_put(Dst
, 3544);
8295 dasm_put(Dst
, 3552, Dt8(->f
), 8*LUA_MINSTACK
, Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), Dt1(->base
), 31-3, Dt1(->top
), Dt7(->pc
), FRAME_TYPE
, LUA_MINSTACK
);
8296 dasm_put(Dst
, 3615, Dt1(->base
), Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
8298 dasm_put(Dst
, 3641, DISPATCH_GL(hookmask
), HOOK_VMEVENT
, DISPATCH_GL(hookcount
), HOOK_ACTIVE
, LUA_MASKLINE
|LUA_MASKCOUNT
, DISPATCH_GL(hookcount
));
8300 dasm_put(Dst
, 3663, 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
));
8301 dasm_put(Dst
, 3710, GG_DISP2STATIC
);
8303 dasm_put(Dst
, 3728, GG_DISP2J
, Dt7(->pc
), DISPATCH_J(L
), PC2PROTO(framesize
), Dt1(->base
), 31-3, Dt1(->top
));
8305 dasm_put(Dst
, 3751);
8307 dasm_put(Dst
, 3754);
8309 dasm_put(Dst
, 3757);
8311 dasm_put(Dst
, 3759);
8313 dasm_put(Dst
, 3762, Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
8315 dasm_put(Dst
, 3784, -(16+32*8+32*4), 16+32*8+2*4, -GG_DISP2G
-32768, ~LJ_VMST_EXIT
, 16+32*8+32*4, DISPATCH_GL(vmstate
), 16+0*8, 16+1*8, 16+2*8, 16+3*8, 16+4*8, 16+5*8, 16+6*8, 16+7*8, 16+32*8+32*4, 16+8*8, 16+9*8, 16+10*8, 16+11*8, 16+32*8+1*4, 16+12*8, 16+13*8);
8316 dasm_put(Dst
, 3831, 16+14*8, 16+15*8, 16+16*8, 16+17*8, 16+18*8, 16+19*8, 16+32*8+0*4, 16+20*8, 16+21*8, 16+22*8, 16+23*8, 16+24*8, 16+25*8, 16+26*8, 16+27*8, DISPATCH_GL(jit_L
), 16+28*8, 16+29*8, 16+30*8, 16+31*8, DISPATCH_GL(jit_base
), 32-2);
8317 dasm_put(Dst
, 3880, DISPATCH_J(L
), DISPATCH_GL(jit_L
), Dt1(->base
), GG_DISP2J
, DISPATCH_J(exitno
), DISPATCH_J(parent
), Dt1(->cframe
), Dt1(->base
));
8319 dasm_put(Dst
, 3909);
8321 dasm_put(Dst
, 3911, -GG_DISP2G
-32768, 31-3, Dt7(->pc
), DISPATCH_GL(jit_L
), PC2PROTO(k
), LJ_TISNUM
, LJ_TNIL
, DISPATCH_GL(vmstate
), BC_FUNCF
*4);
8323 dasm_put(Dst
, 3967);
8325 dasm_put(Dst
, 3975);
8327 dasm_put(Dst
, 3978);
8329 dasm_put(Dst
, 4058);
8331 dasm_put(Dst
, 4080);
8333 dasm_put(Dst
, 4082);
8335 #define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
8336 dasm_put(Dst
, 4084, DtE(->spadj
), DtE(->nsp
), DtE(->nfpr
), DtE(->stack
), 31-2, DtE(->fpr
[0]), DtE(->fpr
[1]), DtE(->fpr
[2]), DtE(->fpr
[3]), DtE(->fpr
[4]), DtE(->fpr
[5]), DtE(->fpr
[6]), DtE(->fpr
[7]), DtE(->func
), DtE(->gpr
[1]), DtE(->gpr
[2]));
8337 dasm_put(Dst
, 4140, DtE(->gpr
[3]), DtE(->gpr
[4]), DtE(->gpr
[5]), DtE(->gpr
[6]), DtE(->gpr
[7]), DtE(->gpr
[0]), DtE(->gpr
[0]), DtE(->fpr
[0]), DtE(->gpr
[1]), DtE(->gpr
[2]), DtE(->gpr
[3]));
8341 /* Generate the code for a single instruction. */
8342 static void build_ins(BuildCtx
*ctx
, BCOp op
, int defop
)
8345 dasm_put(Dst
, 4171, defop
);
8349 /* -- Comparison ops ---------------------------------------------------- */
8351 /* Remember: all ops branch for a true comparison, fall through otherwise. */
8353 case BC_ISLT
: case BC_ISGE
: case BC_ISLE
: case BC_ISGT
:
8355 dasm_put(Dst
, 4173, -(BCBIAS_J
*4 >> 16));
8356 if (op
== BC_ISLT
) {
8357 dasm_put(Dst
, 4190);
8358 } else if (op
== BC_ISGE
) {
8359 dasm_put(Dst
, 4193);
8360 } else if (op
== BC_ISLE
) {
8361 dasm_put(Dst
, 4196);
8363 dasm_put(Dst
, 4199);
8365 dasm_put(Dst
, 4202);
8366 if (op
== BC_ISLT
) {
8367 dasm_put(Dst
, 4241);
8368 } else if (op
== BC_ISGE
) {
8369 dasm_put(Dst
, 4244);
8370 } else if (op
== BC_ISLE
) {
8371 dasm_put(Dst
, 4247);
8373 dasm_put(Dst
, 4251);
8375 dasm_put(Dst
, 4255);
8377 dasm_put(Dst
, 4258, -(BCBIAS_J
*4 >> 16));
8378 if (op
== BC_ISLT
) {
8379 dasm_put(Dst
, 4275);
8380 } else if (op
== BC_ISGE
) {
8381 dasm_put(Dst
, 4278);
8382 } else if (op
== BC_ISLE
) {
8383 dasm_put(Dst
, 4281);
8385 dasm_put(Dst
, 4285);
8387 dasm_put(Dst
, 4289);
8391 case BC_ISEQV
: case BC_ISNEV
:
8392 vk
= op
== BC_ISEQV
;
8394 dasm_put(Dst
, 4302, -(BCBIAS_J
*4 >> 16));
8396 dasm_put(Dst
, 4315);
8398 dasm_put(Dst
, 4318);
8401 dasm_put(Dst
, 4321, -(BCBIAS_J
*4 >> 16));
8403 dasm_put(Dst
, 4338);
8405 dasm_put(Dst
, 4342);
8407 dasm_put(Dst
, 4346);
8409 dasm_put(Dst
, 4358);
8411 dasm_put(Dst
, 4360);
8414 dasm_put(Dst
, 4363, LJ_TCDATA
, LJ_TCDATA
);
8416 dasm_put(Dst
, 4368, ~LJ_TISPRI
);
8418 dasm_put(Dst
, 4373);
8420 dasm_put(Dst
, 4375, ~LJ_TISTABUD
);
8422 dasm_put(Dst
, 4378);
8424 dasm_put(Dst
, 4381);
8426 dasm_put(Dst
, 4389);
8428 dasm_put(Dst
, 4394);
8431 dasm_put(Dst
, 4399);
8433 dasm_put(Dst
, 4414);
8435 dasm_put(Dst
, 4417, Dt6(->metatable
), 1-vk
, Dt6(->nomm
), 1<<MM_eq
);
8438 case BC_ISEQS
: case BC_ISNES
:
8439 vk
= op
== BC_ISEQS
;
8440 dasm_put(Dst
, 4436, 32-1);
8442 dasm_put(Dst
, 4444, LJ_TCDATA
);
8444 dasm_put(Dst
, 4447, LJ_TSTR
);
8446 dasm_put(Dst
, 4451);
8448 dasm_put(Dst
, 4454, -(BCBIAS_J
*4 >> 16));
8450 dasm_put(Dst
, 4462);
8452 dasm_put(Dst
, 4464);
8454 dasm_put(Dst
, 4466);
8457 case BC_ISEQN
: case BC_ISNEN
:
8458 vk
= op
== BC_ISEQN
;
8460 dasm_put(Dst
, 4478, -(BCBIAS_J
*4 >> 16));
8462 dasm_put(Dst
, 4490);
8464 dasm_put(Dst
, 4492);
8466 dasm_put(Dst
, 4494);
8469 dasm_put(Dst
, 4501);
8471 dasm_put(Dst
, 4503);
8473 dasm_put(Dst
, 4505, -(BCBIAS_J
*4 >> 16));
8476 dasm_put(Dst
, 4518);
8478 dasm_put(Dst
, 4523);
8481 dasm_put(Dst
, 4525);
8483 dasm_put(Dst
, 4529);
8485 dasm_put(Dst
, 4531);
8487 dasm_put(Dst
, 4534);
8489 dasm_put(Dst
, 4545, LJ_TCDATA
);
8492 dasm_put(Dst
, 4553);
8496 case BC_ISEQP
: case BC_ISNEP
:
8497 vk
= op
== BC_ISEQP
;
8498 dasm_put(Dst
, 4577, 32-3);
8500 dasm_put(Dst
, 4584, LJ_TCDATA
);
8502 dasm_put(Dst
, 4587);
8504 dasm_put(Dst
, 4589);
8506 dasm_put(Dst
, 4592, -(BCBIAS_J
*4 >> 16));
8508 dasm_put(Dst
, 4598);
8510 dasm_put(Dst
, 4600);
8512 dasm_put(Dst
, 4602);
8515 /* -- Unary test and copy ops ------------------------------------------- */
8517 case BC_ISTC
: case BC_ISFC
: case BC_IST
: case BC_ISF
:
8518 dasm_put(Dst
, 4614);
8519 if (op
== BC_IST
|| op
== BC_ISF
) {
8520 dasm_put(Dst
, 4618, LJ_TTRUE
, -(BCBIAS_J
*4 >> 16));
8522 dasm_put(Dst
, 4625);
8524 dasm_put(Dst
, 4627);
8526 dasm_put(Dst
, 4629);
8528 dasm_put(Dst
, 4631, LJ_TFALSE
);
8529 if (op
== BC_ISTC
) {
8530 dasm_put(Dst
, 4636);
8532 dasm_put(Dst
, 4639);
8534 dasm_put(Dst
, 4642, -(BCBIAS_J
*4 >> 16));
8536 dasm_put(Dst
, 4649);
8539 /* -- Unary ops --------------------------------------------------------- */
8542 dasm_put(Dst
, 4660);
8545 dasm_put(Dst
, 4673, LJ_TTRUE
);
8548 dasm_put(Dst
, 4689);
8550 dasm_put(Dst
, 4693);
8552 dasm_put(Dst
, 4721);
8554 dasm_put(Dst
, 4731);
8556 dasm_put(Dst
, 4734);
8560 dasm_put(Dst
, 4743, LJ_TSTR
, Dt5(->len
));
8562 dasm_put(Dst
, 4753);
8564 dasm_put(Dst
, 4758);
8566 dasm_put(Dst
, 4765, LJ_TTAB
);
8567 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8568 dasm_put(Dst
, 4779, Dt6(->metatable
));
8570 dasm_put(Dst
, 4786);
8571 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8572 dasm_put(Dst
, 4792, Dt6(->nomm
), 1<<MM_len
);
8576 /* -- Binary ops -------------------------------------------------------- */
8579 case BC_ADDVN
: case BC_ADDNV
: case BC_ADDVV
:
8581 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8584 dasm_put(Dst
, 4802);
8587 dasm_put(Dst
, 4808);
8590 dasm_put(Dst
, 4814);
8593 dasm_put(Dst
, 4820);
8596 dasm_put(Dst
, 4847);
8599 dasm_put(Dst
, 4850);
8602 dasm_put(Dst
, 4853);
8605 dasm_put(Dst
, 4856);
8607 dasm_put(Dst
, 4858);
8609 dasm_put(Dst
, 4862);
8613 dasm_put(Dst
, 4866);
8616 dasm_put(Dst
, 4869);
8619 dasm_put(Dst
, 4872);
8622 dasm_put(Dst
, 4875);
8624 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8627 dasm_put(Dst
, 4882);
8629 dasm_put(Dst
, 4884);
8631 dasm_put(Dst
, 4886);
8633 dasm_put(Dst
, 4889);
8635 dasm_put(Dst
, 4895);
8639 dasm_put(Dst
, 4899);
8641 dasm_put(Dst
, 4901);
8643 dasm_put(Dst
, 4903);
8645 dasm_put(Dst
, 4906);
8647 dasm_put(Dst
, 4912);
8651 dasm_put(Dst
, 4916);
8654 dasm_put(Dst
, 4926);
8657 case BC_SUBVN
: case BC_SUBNV
: case BC_SUBVV
:
8659 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8662 dasm_put(Dst
, 4939);
8665 dasm_put(Dst
, 4945);
8668 dasm_put(Dst
, 4951);
8671 dasm_put(Dst
, 4957);
8674 dasm_put(Dst
, 4984);
8677 dasm_put(Dst
, 4987);
8680 dasm_put(Dst
, 4990);
8683 dasm_put(Dst
, 4993);
8685 dasm_put(Dst
, 4995);
8687 dasm_put(Dst
, 4999);
8691 dasm_put(Dst
, 5003);
8694 dasm_put(Dst
, 5006);
8697 dasm_put(Dst
, 5009);
8700 dasm_put(Dst
, 5012);
8702 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8705 dasm_put(Dst
, 5019);
8707 dasm_put(Dst
, 5021);
8709 dasm_put(Dst
, 5023);
8711 dasm_put(Dst
, 5026);
8713 dasm_put(Dst
, 5032);
8717 dasm_put(Dst
, 5036);
8719 dasm_put(Dst
, 5038);
8721 dasm_put(Dst
, 5040);
8723 dasm_put(Dst
, 5043);
8725 dasm_put(Dst
, 5049);
8729 dasm_put(Dst
, 5053);
8732 dasm_put(Dst
, 5063);
8735 case BC_MULVN
: case BC_MULNV
: case BC_MULVV
:
8737 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8740 dasm_put(Dst
, 5076);
8743 dasm_put(Dst
, 5082);
8746 dasm_put(Dst
, 5088);
8749 dasm_put(Dst
, 5094);
8752 dasm_put(Dst
, 5121);
8755 dasm_put(Dst
, 5124);
8758 dasm_put(Dst
, 5127);
8761 dasm_put(Dst
, 5130);
8763 dasm_put(Dst
, 5132);
8765 dasm_put(Dst
, 5136);
8769 dasm_put(Dst
, 5140);
8772 dasm_put(Dst
, 5143);
8775 dasm_put(Dst
, 5146);
8778 dasm_put(Dst
, 5149);
8780 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8783 dasm_put(Dst
, 5156);
8785 dasm_put(Dst
, 5158);
8787 dasm_put(Dst
, 5160);
8789 dasm_put(Dst
, 5163);
8791 dasm_put(Dst
, 5169);
8795 dasm_put(Dst
, 5173);
8797 dasm_put(Dst
, 5175);
8799 dasm_put(Dst
, 5177);
8801 dasm_put(Dst
, 5180);
8803 dasm_put(Dst
, 5186);
8807 dasm_put(Dst
, 5190);
8810 dasm_put(Dst
, 5200);
8813 case BC_DIVVN
: case BC_DIVNV
: case BC_DIVVV
:
8814 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8817 dasm_put(Dst
, 5213);
8819 dasm_put(Dst
, 5215);
8821 dasm_put(Dst
, 5217);
8823 dasm_put(Dst
, 5220);
8825 dasm_put(Dst
, 5226);
8829 dasm_put(Dst
, 5230);
8831 dasm_put(Dst
, 5232);
8833 dasm_put(Dst
, 5234);
8835 dasm_put(Dst
, 5237);
8837 dasm_put(Dst
, 5243);
8841 dasm_put(Dst
, 5247);
8844 dasm_put(Dst
, 5257);
8848 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8851 dasm_put(Dst
, 5270);
8854 dasm_put(Dst
, 5276);
8857 dasm_put(Dst
, 5282);
8860 dasm_put(Dst
, 5288);
8863 dasm_put(Dst
, 5316);
8866 dasm_put(Dst
, 5319);
8869 dasm_put(Dst
, 5322);
8872 dasm_put(Dst
, 5325);
8874 dasm_put(Dst
, 5327);
8876 dasm_put(Dst
, 5331);
8880 dasm_put(Dst
, 5335);
8883 dasm_put(Dst
, 5338);
8886 dasm_put(Dst
, 5341);
8889 dasm_put(Dst
, 5344);
8891 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8894 dasm_put(Dst
, 5356);
8896 dasm_put(Dst
, 5358);
8898 dasm_put(Dst
, 5360);
8900 dasm_put(Dst
, 5363);
8902 dasm_put(Dst
, 5369);
8906 dasm_put(Dst
, 5373);
8908 dasm_put(Dst
, 5375);
8910 dasm_put(Dst
, 5377);
8912 dasm_put(Dst
, 5380);
8914 dasm_put(Dst
, 5386);
8918 dasm_put(Dst
, 5390);
8921 dasm_put(Dst
, 5400);
8924 case BC_MODNV
: case BC_MODVV
:
8926 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8929 dasm_put(Dst
, 5418);
8932 dasm_put(Dst
, 5424);
8935 dasm_put(Dst
, 5430);
8938 dasm_put(Dst
, 5436);
8941 dasm_put(Dst
, 5464);
8944 dasm_put(Dst
, 5467);
8947 dasm_put(Dst
, 5470);
8950 dasm_put(Dst
, 5473);
8952 dasm_put(Dst
, 5475);
8954 dasm_put(Dst
, 5479);
8958 dasm_put(Dst
, 5483);
8961 dasm_put(Dst
, 5486);
8964 dasm_put(Dst
, 5489);
8967 dasm_put(Dst
, 5492);
8969 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8972 dasm_put(Dst
, 5495);
8974 dasm_put(Dst
, 5497);
8976 dasm_put(Dst
, 5499);
8978 dasm_put(Dst
, 5502);
8980 dasm_put(Dst
, 5508);
8984 dasm_put(Dst
, 5512);
8986 dasm_put(Dst
, 5514);
8988 dasm_put(Dst
, 5516);
8990 dasm_put(Dst
, 5519);
8992 dasm_put(Dst
, 5525);
8996 dasm_put(Dst
, 5529);
8999 dasm_put(Dst
, 5539);
9003 dasm_put(Dst
, 5542);
9007 dasm_put(Dst
, 5565, Dt1(->base
), 32-3, Dt1(->base
));
9010 /* -- Constant ops ------------------------------------------------------ */
9013 dasm_put(Dst
, 5595, 32-1, LJ_TSTR
);
9017 dasm_put(Dst
, 5614, 32-1, LJ_TCDATA
);
9022 dasm_put(Dst
, 5633, 31-13);
9024 dasm_put(Dst
, 5649, 31-13, 31-20);
9028 dasm_put(Dst
, 5677);
9031 dasm_put(Dst
, 5690, 32-3);
9034 dasm_put(Dst
, 5705);
9037 /* -- Upvalue and function ops ------------------------------------------ */
9040 dasm_put(Dst
, 5724, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9043 dasm_put(Dst
, 5745, 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
);
9046 dasm_put(Dst
, 5798, 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
);
9049 dasm_put(Dst
, 5849, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9052 dasm_put(Dst
, 5870, 32-1, 32-3, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9056 dasm_put(Dst
, 5893, Dt1(->openupval
), 32-1, -(BCBIAS_J
*4 >> 16), Dt1(->base
), Dt1(->base
));
9060 dasm_put(Dst
, 5923, 32-1, Dt1(->base
), Dt1(->base
), LJ_TFUNC
);
9063 /* -- Table ops --------------------------------------------------------- */
9067 dasm_put(Dst
, 5951, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), Dt1(->base
));
9068 if (op
== BC_TNEW
) {
9069 dasm_put(Dst
, 5964);
9071 dasm_put(Dst
, 5973, 32-1);
9073 dasm_put(Dst
, 5980, Dt1(->base
), LJ_TTAB
);
9074 if (op
== BC_TNEW
) {
9075 dasm_put(Dst
, 5997);
9077 dasm_put(Dst
, 6002);
9082 dasm_put(Dst
, 6011, 32-1, Dt7(->env
));
9083 if (op
== BC_GGET
) {
9084 dasm_put(Dst
, 6019);
9086 dasm_put(Dst
, 6022);
9091 dasm_put(Dst
, 6025);
9093 dasm_put(Dst
, 6029);
9095 dasm_put(Dst
, 6031);
9097 dasm_put(Dst
, 6033, LJ_TTAB
);
9099 dasm_put(Dst
, 6039, Dt6(->asize
), Dt6(->array
), 31-3);
9101 dasm_put(Dst
, 6049, Dt6(->asize
), Dt6(->array
), 31-3);
9103 dasm_put(Dst
, 6066, LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
, LJ_TSTR
);
9105 dasm_put(Dst
, 6106);
9107 dasm_put(Dst
, 6108);
9110 dasm_put(Dst
, 6111, 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
));
9111 dasm_put(Dst
, 6172, LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
9114 dasm_put(Dst
, 6192, 32-3, LJ_TTAB
, Dt6(->asize
), Dt6(->array
), LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
9118 dasm_put(Dst
, 6240);
9120 dasm_put(Dst
, 6244);
9122 dasm_put(Dst
, 6246);
9124 dasm_put(Dst
, 6248, LJ_TTAB
);
9126 dasm_put(Dst
, 6254, Dt6(->asize
), Dt6(->array
), 31-3);
9128 dasm_put(Dst
, 6264, Dt6(->asize
), Dt6(->array
), 31-3);
9130 dasm_put(Dst
, 6281, Dt6(->marked
), LJ_TNIL
, LJ_GC_BLACK
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, LJ_TSTR
);
9132 dasm_put(Dst
, 6328);
9134 dasm_put(Dst
, 6330, DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9136 dasm_put(Dst
, 6345, LJ_TSTR
, LJ_TNIL
);
9138 dasm_put(Dst
, 6371, 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
);
9139 dasm_put(Dst
, 6422, 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
);
9140 dasm_put(Dst
, 6478, LJ_TSTR
, Dt1(->base
), DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9143 dasm_put(Dst
, 6503, 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
));
9144 dasm_put(Dst
, 6561, DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9148 dasm_put(Dst
, 6571, 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
));
9149 dasm_put(Dst
, 6640);
9152 /* -- Calls and vararg handling ----------------------------------------- */
9155 dasm_put(Dst
, 6643);
9158 dasm_put(Dst
, 6645, LJ_TFUNC
, Dt7(->pc
));
9162 dasm_put(Dst
, 6666);
9165 dasm_put(Dst
, 6668, LJ_TFUNC
, FRAME_TYPE
, Dt7(->ffid
), FRAME_VARG
, Dt7(->pc
), -4-8, Dt7(->pc
), PC2PROTO(k
), FRAME_TYPEP
);
9166 dasm_put(Dst
, 6732, FRAME_TYPE
);
9170 dasm_put(Dst
, 6741, LJ_TFUNC
, Dt7(->pc
));
9176 dasm_put(Dst
, 6768, Dt6(->asize
), Dt6(->array
), 31-3, LJ_TNIL
);
9178 dasm_put(Dst
, 6790);
9180 dasm_put(Dst
, 6793);
9182 dasm_put(Dst
, 6797, -(BCBIAS_J
*4 >> 16));
9184 dasm_put(Dst
, 6805);
9186 dasm_put(Dst
, 6807, Dt6(->hmask
), Dt6(->node
), 31-5, 31-3, LJ_TNIL
, DtB(->key
), -(BCBIAS_J
*4 >> 16));
9190 dasm_put(Dst
, 6863, 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));
9194 dasm_put(Dst
, 6913, FRAME_VARG
, Dt1(->maxstack
), Dt1(->top
), Dt1(->base
), 32-3, Dt1(->base
));
9195 dasm_put(Dst
, 6993);
9198 /* -- Returns ----------------------------------------------------------- */
9201 dasm_put(Dst
, 6999);
9205 dasm_put(Dst
, 7001, FRAME_TYPE
, FRAME_VARG
, Dt7(->pc
), PC2PROTO(k
), FRAME_TYPEP
);
9208 case BC_RET0
: case BC_RET1
:
9209 dasm_put(Dst
, 7071, FRAME_TYPE
, FRAME_VARG
);
9210 if (op
== BC_RET1
) {
9211 dasm_put(Dst
, 7084);
9213 dasm_put(Dst
, 7087, Dt7(->pc
), PC2PROTO(k
));
9216 /* -- Loops and branches ------------------------------------------------ */
9220 dasm_put(Dst
, 7115, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9231 vk
= (op
== BC_IFORL
|| op
== BC_JFORL
);
9233 dasm_put(Dst
, 7125, FORL_IDX
*8+4);
9235 dasm_put(Dst
, 7130, FORL_STEP
*8+4, FORL_STOP
*8+4, FORL_IDX
*8+4);
9237 dasm_put(Dst
, 7144, FORL_STEP
*8, FORL_STEP
*8+4, FORL_STOP
*8, FORL_STOP
*8+4);
9239 dasm_put(Dst
, 7160, FORL_EXT
*8);
9240 if (op
!= BC_JFORL
) {
9241 dasm_put(Dst
, 7167, 32-1);
9243 dasm_put(Dst
, 7170, FORL_EXT
*8+4);
9244 if (op
!= BC_JFORL
) {
9245 dasm_put(Dst
, 7173);
9247 if (op
== BC_FORI
) {
9248 dasm_put(Dst
, 7175);
9249 } else if (op
== BC_JFORI
) {
9250 dasm_put(Dst
, 7178, -(BCBIAS_J
*4 >> 16), BC_JLOOP
);
9251 } else if (op
== BC_IFORL
) {
9252 dasm_put(Dst
, 7183, -(BCBIAS_J
*4 >> 16));
9254 dasm_put(Dst
, 7188, BC_JLOOP
);
9256 dasm_put(Dst
, 7191);
9258 dasm_put(Dst
, 7207);
9263 dasm_put(Dst
, 7214, FORL_IDX
*8);
9265 dasm_put(Dst
, 7218);
9267 dasm_put(Dst
, 7220, FORL_STEP
*8, FORL_STOP
*8, FORL_STEP
*8, FORL_IDX
*8);
9270 dasm_put(Dst
, 7230);
9272 dasm_put(Dst
, 7232, FORL_STEP
*8, FORL_STOP
*8);
9274 dasm_put(Dst
, 7241, FORL_IDX
*8, FORL_STEP
*8, FORL_STOP
*8);
9276 dasm_put(Dst
, 7252);
9277 if (op
!= BC_JFORL
) {
9278 dasm_put(Dst
, 7254, 32-1);
9280 dasm_put(Dst
, 7257, FORL_EXT
*8);
9281 if (op
!= BC_JFORL
) {
9282 dasm_put(Dst
, 7260);
9284 dasm_put(Dst
, 7262);
9285 if (op
== BC_JFORI
) {
9286 dasm_put(Dst
, 7264, -(BCBIAS_J
*4 >> 16));
9288 dasm_put(Dst
, 7267);
9289 if (op
== BC_FORI
) {
9290 dasm_put(Dst
, 7270);
9291 } else if (op
== BC_IFORL
) {
9293 dasm_put(Dst
, 7273);
9295 dasm_put(Dst
, 7276);
9297 dasm_put(Dst
, 7279, -(BCBIAS_J
*4 >> 16));
9299 dasm_put(Dst
, 7283, BC_JLOOP
);
9302 dasm_put(Dst
, 7286);
9304 dasm_put(Dst
, 7289);
9306 dasm_put(Dst
, 7301);
9307 if (op
== BC_FORI
) {
9308 dasm_put(Dst
, 7303, -(BCBIAS_J
*4 >> 16));
9309 } else if (op
== BC_IFORL
) {
9310 dasm_put(Dst
, 7309);
9312 dasm_put(Dst
, 7312, BC_JLOOP
);
9314 dasm_put(Dst
, 7315);
9319 dasm_put(Dst
, 7318, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9328 dasm_put(Dst
, 7328, LJ_TNIL
);
9329 if (op
== BC_JITERL
) {
9330 dasm_put(Dst
, 7335, BC_JLOOP
);
9332 dasm_put(Dst
, 7340, 32-1, -(BCBIAS_J
*4 >> 16));
9334 dasm_put(Dst
, 7348);
9339 dasm_put(Dst
, 7360, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9344 dasm_put(Dst
, 7370);
9349 dasm_put(Dst
, 7381, DISPATCH_J(trace
), 32-1, DtD(->mcode
), DISPATCH_GL(jit_base
), DISPATCH_GL(jit_L
), GG_DISP2G
+32768);
9354 dasm_put(Dst
, 7398, 32-1, -(BCBIAS_J
*4 >> 16));
9357 /* -- Function headers -------------------------------------------------- */
9361 dasm_put(Dst
, 7414, GG_DISP2HOT
, -HOTCOUNT_CALL
);
9363 case BC_FUNCV
: /* NYI: compiled vararg functions. */
9371 dasm_put(Dst
, 7424, Dt1(->maxstack
), -4+PC2PROTO(numparams
), -4+PC2PROTO(k
), 31-3);
9372 if (op
!= BC_JFUNCF
) {
9373 dasm_put(Dst
, 7436);
9375 dasm_put(Dst
, 7439);
9376 if (op
== BC_JFUNCF
) {
9377 dasm_put(Dst
, 7444, BC_JLOOP
);
9379 dasm_put(Dst
, 7448);
9381 dasm_put(Dst
, 7457);
9388 dasm_put(Dst
, 7463);
9389 break; /* NYI: compiled vararg functions. */
9392 dasm_put(Dst
, 7465, Dt1(->maxstack
), 8+FRAME_VARG
, -4+PC2PROTO(k
), -4+PC2PROTO(numparams
), LJ_TNIL
);
9397 if (op
== BC_FUNCC
) {
9398 dasm_put(Dst
, 7518, Dt8(->f
));
9400 dasm_put(Dst
, 7521, DISPATCH_GL(wrapf
));
9402 dasm_put(Dst
, 7524, Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), ~LJ_VMST_C
);
9403 if (op
== BC_FUNCCW
) {
9404 dasm_put(Dst
, 7537, Dt8(->f
));
9406 dasm_put(Dst
, 7540, DISPATCH_GL(vmstate
), Dt1(->base
), 31-3, Dt1(->top
), ~LJ_VMST_INTERP
, DISPATCH_GL(vmstate
));
9409 /* ---------------------------------------------------------------------- */
9412 fprintf(stderr
, "Error: undefined opcode BC_%s\n", bc_names
[op
]);
9418 static int build_backend(BuildCtx
*ctx
)
9422 dasm_growpc(Dst
, BC__MAX
);
9424 build_subroutines(ctx
);
9426 dasm_put(Dst
, 7561);
9427 for (op
= 0; op
< BC__MAX
; op
++)
9428 build_ins(ctx
, (BCOp
)op
, op
);
9433 /* Emit pseudo frame-info for all assembler functions. */
9434 static void emit_asm_debug(BuildCtx
*ctx
)
9437 switch (ctx
->mode
) {
9439 fprintf(ctx
->fp
, "\t.section .debug_frame,\"\",@progbits\n");
9442 "\t.long .LECIE0-.LSCIE0\n"
9444 "\t.long 0xffffffff\n"
9450 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9455 "\t.long .LEFDE0-.LASFDE0\n"
9457 "\t.long .Lframe0\n"
9460 "\t.byte 0xe\n\t.uleb128 %d\n"
9461 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9462 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
9463 (int)ctx
->codesz
, CFRAME_SIZE
);
9464 for (i
= 14; i
<= 31; i
++)
9466 "\t.byte %d\n\t.uleb128 %d\n"
9467 "\t.byte %d\n\t.uleb128 %d\n",
9468 0x80+i
, 37+(31-i
), 0x80+32+i
, 2+2*(31-i
));
9472 fprintf(ctx
->fp
, "\t.section .eh_frame,\"a\",@progbits\n");
9475 "\t.long .LECIE1-.LSCIE1\n"
9479 "\t.string \"zPR\"\n"
9483 "\t.uleb128 6\n" /* augmentation length */
9484 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9485 "\t.long lj_err_unwind_dwarf-.\n"
9486 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9487 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9492 "\t.long .LEFDE1-.LASFDE1\n"
9494 "\t.long .LASFDE1-.Lframe1\n"
9495 "\t.long .Lbegin-.\n"
9497 "\t.uleb128 0\n" /* augmentation length */
9498 "\t.byte 0xe\n\t.uleb128 %d\n"
9499 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9500 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
9501 (int)ctx
->codesz
, CFRAME_SIZE
);
9502 for (i
= 14; i
<= 31; i
++)
9504 "\t.byte %d\n\t.uleb128 %d\n"
9505 "\t.byte %d\n\t.uleb128 %d\n",
9506 0x80+i
, 37+(31-i
), 0x80+32+i
, 2+2*(31-i
));