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
[7740] = {
7767 GLOB_vm_unwind_c_eh
,
7769 GLOB_vm_unwind_ff_eh
,
7770 GLOB_vm_growstack_c
,
7771 GLOB_vm_growstack_l
,
7775 GLOB_vm_call_dispatch
,
7777 GLOB_vm_call_dispatch_f
,
7779 GLOB_cont_ffi_callback
,
7798 GLOB_vmeta_equal_cd
,
7799 GLOB_vmeta_arith_nv
,
7800 GLOB_vmeta_arith_nv2
,
7802 GLOB_vmeta_arith_vn
,
7803 GLOB_vmeta_arith_vv
,
7804 GLOB_vmeta_arith_vn2
,
7805 GLOB_vmeta_arith_vv2
,
7816 GLOB_ff_getmetatable
,
7818 GLOB_ff_setmetatable
,
7829 GLOB_ff_coroutine_resume
,
7830 GLOB_ff_coroutine_wrap_aux
,
7831 GLOB_ff_coroutine_yield
,
7861 GLOB_ff_string_byte
,
7862 GLOB_ff_string_char
,
7866 GLOB_ff_string_reverse
,
7867 GLOB_ff_string_lower
,
7868 GLOB_ff_string_upper
,
7879 GLOB_ff_bit_arshift
,
7890 GLOB_vm_exit_handler
,
7891 GLOB_vm_exit_interp
,
7897 GLOB_vm_ffi_callback
,
7907 static const char *const globnames
[] = {
7926 "vm_call_dispatch_f",
7928 "cont_ffi_callback",
7978 "ff_coroutine_resume",
7979 "ff_coroutine_wrap_aux",
7980 "ff_coroutine_yield",
8015 "ff_string_reverse",
8056 static const char *const extnames
[] = {
8057 "lj_state_growstack",
8068 "lj_str_fromnumber",
8072 "lj_ffh_coroutine_wrap_err",
8103 "lj_ccallback_enter",
8104 "lj_ccallback_leave",
8111 "lj_gc_step_fixtop",
8116 #define Dt1(_V) (int)(ptrdiff_t)&(((lua_State *)0)_V)
8117 #define Dt2(_V) (int)(ptrdiff_t)&(((global_State *)0)_V)
8118 #define Dt3(_V) (int)(ptrdiff_t)&(((TValue *)0)_V)
8119 #define Dt4(_V) (int)(ptrdiff_t)&(((GCobj *)0)_V)
8120 #define Dt5(_V) (int)(ptrdiff_t)&(((GCstr *)0)_V)
8121 #define Dt6(_V) (int)(ptrdiff_t)&(((GCtab *)0)_V)
8122 #define Dt7(_V) (int)(ptrdiff_t)&(((GCfuncL *)0)_V)
8123 #define Dt8(_V) (int)(ptrdiff_t)&(((GCfuncC *)0)_V)
8124 #define Dt9(_V) (int)(ptrdiff_t)&(((GCproto *)0)_V)
8125 #define DtA(_V) (int)(ptrdiff_t)&(((GCupval *)0)_V)
8126 #define DtB(_V) (int)(ptrdiff_t)&(((Node *)0)_V)
8127 #define DtC(_V) (int)(ptrdiff_t)&(((int *)0)_V)
8128 #define DtD(_V) (int)(ptrdiff_t)&(((GCtrace *)0)_V)
8129 #define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
8130 #define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
8131 #define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
8133 /* Generate subroutines used by opcodes and other parts of the VM. */
8134 /* The .code_sub section should be last to help static branch prediction. */
8135 static void build_subroutines(BuildCtx
*ctx
)
8138 dasm_put(Dst
, 1, FRAME_P
, LJ_TTRUE
, FRAME_TYPE
, FRAME_C
, ~LJ_VMST_C
, Dt1(->base
), DISPATCH_GL(vmstate
), 31-3, Dt1(->top
));
8139 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);
8140 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
));
8141 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
);
8142 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);
8143 dasm_put(Dst
, 278, 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);
8144 dasm_put(Dst
, 325, 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
), ~LJ_VMST_INTERP
, DISPATCH_GL(vmstate
), FRAME_TYPE
, LJ_TNIL
);
8145 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);
8146 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);
8147 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);
8148 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
));
8149 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);
8150 dasm_put(Dst
, 653, 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);
8151 dasm_put(Dst
, 700, 128+(31-14)*8, Dt1(->stack
), Dt1(->top
), Dt1(->cframe
), Dt1(->cframe
), Dt1(->glref
), FRAME_CP
, GG_G2DISP
);
8155 dasm_put(Dst
, 740, Dt7(->pc
));
8159 dasm_put(Dst
, 749, PC2PROTO(k
));
8163 dasm_put(Dst
, 762, Dt1(->base
), DISPATCH_GL(tmptv
), LJ_TSTR
, DISPATCH_GL(tmptv
), LJ_TTAB
, DISPATCH_GL(tmptv2
), LJ_TSTR
);
8167 dasm_put(Dst
, 811, DISPATCH_GL(tmptv
));
8173 dasm_put(Dst
, 821, Dt1(->base
), FRAME_CONT
, Dt1(->top
), DISPATCH_GL(tmptv
), LJ_TSTR
, DISPATCH_GL(tmptv
), LJ_TTAB
, DISPATCH_GL(tmptv2
), LJ_TSTR
);
8177 dasm_put(Dst
, 893, DISPATCH_GL(tmptv
));
8183 dasm_put(Dst
, 903, Dt1(->base
), FRAME_CONT
, Dt1(->top
));
8195 dasm_put(Dst
, 958, Dt1(->base
), -(BCBIAS_J
*4 >> 16), LJ_TTRUE
, LJ_TTRUE
, Dt1(->base
));
8197 dasm_put(Dst
, 1021, Dt1(->base
));
8199 dasm_put(Dst
, 1032);
8201 dasm_put(Dst
, 1039);
8203 dasm_put(Dst
, 1044);
8205 dasm_put(Dst
, 1058);
8207 dasm_put(Dst
, 1061);
8209 dasm_put(Dst
, 1064);
8211 dasm_put(Dst
, 1067, Dt1(->base
), FRAME_CONT
);
8212 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8213 dasm_put(Dst
, 1091);
8215 dasm_put(Dst
, 1093, Dt1(->base
));
8216 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8217 dasm_put(Dst
, 1101);
8219 dasm_put(Dst
, 1108);
8221 dasm_put(Dst
, 1111, Dt1(->base
), Dt7(->pc
), Dt1(->base
), Dt1(->base
));
8223 dasm_put(Dst
, 1159);
8225 dasm_put(Dst
, 1161);
8227 dasm_put(Dst
, 1163, BC_JFORI
);
8229 dasm_put(Dst
, 1166);
8231 dasm_put(Dst
, 1168, BC_JFORI
);
8233 dasm_put(Dst
, 1171, BC_FORI
, LJ_TFALSE
, ~LJ_TISNUM
+1, 31-3, Dt8(->upvalue
), LJ_TTAB
, Dt6(->metatable
));
8234 dasm_put(Dst
, 1234, 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
));
8235 dasm_put(Dst
, 1282, 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
));
8236 dasm_put(Dst
, 1337, DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
), LJ_TTAB
, LJ_TSTR
, DISPATCH_GL(gcroot
[GCROOT_BASEMT_NUM
]), Dt1(->base
));
8237 dasm_put(Dst
, 1397, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8239 dasm_put(Dst
, 1407);
8241 dasm_put(Dst
, 1410);
8243 dasm_put(Dst
, 1413, LJ_TSTR
, LJ_TTAB
, Dt1(->base
), Dt1(->top
), LJ_TNIL
, (2+1)*8, LJ_TTAB
);
8244 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8245 dasm_put(Dst
, 1464, Dt6(->metatable
), Dt8(->upvalue
[0]));
8247 dasm_put(Dst
, 1473, Dt8(->upvalue
[0]));
8249 dasm_put(Dst
, 1477, (3+1)*8);
8251 dasm_put(Dst
, 1489);
8253 dasm_put(Dst
, 1491);
8255 dasm_put(Dst
, 1493, LJ_TTAB
);
8257 dasm_put(Dst
, 1500);
8259 dasm_put(Dst
, 1505);
8261 dasm_put(Dst
, 1517, Dt6(->asize
), Dt6(->array
));
8263 dasm_put(Dst
, 1522);
8265 dasm_put(Dst
, 1524);
8267 dasm_put(Dst
, 1528, 31-3);
8269 dasm_put(Dst
, 1533, 31-3);
8271 dasm_put(Dst
, 1537, LJ_TNIL
, (0+1)*8, (2+1)*8, Dt6(->hmask
), (0+1)*8, (0+1)*8, LJ_TTAB
);
8272 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8273 dasm_put(Dst
, 1585, Dt6(->metatable
), Dt8(->upvalue
[0]));
8275 dasm_put(Dst
, 1594, Dt8(->upvalue
[0]));
8278 dasm_put(Dst
, 1598);
8280 dasm_put(Dst
, 1600);
8282 dasm_put(Dst
, 1602, (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
));
8283 dasm_put(Dst
, 1662, 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
));
8284 dasm_put(Dst
, 1724, Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, LJ_TTRUE
, FRAME_TYPE
, LJ_TFALSE
, Dt1(->top
), (2+1)*8, 32-3);
8285 dasm_put(Dst
, 1787, 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
);
8286 dasm_put(Dst
, 1846, Dt1(->base
), DISPATCH_GL(vmstate
), Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, 32-3, Dt1(->cframe
));
8287 dasm_put(Dst
, 1903, Dt1(->base
), CFRAME_RESUME
, Dt1(->top
), LUA_YIELD
, Dt1(->cframe
), Dt1(->status
));
8289 dasm_put(Dst
, 1928);
8291 dasm_put(Dst
, 1949, (1+1)*8, FRAME_TYPE
);
8293 dasm_put(Dst
, 1991, 31-11, 32-21, 31-11);
8294 dasm_put(Dst
, 2073, 31-11, 32-21, 31-11);
8296 dasm_put(Dst
, 2127);
8298 dasm_put(Dst
, 2154);
8299 dasm_put(Dst
, 2213);
8300 dasm_put(Dst
, 2271);
8301 dasm_put(Dst
, 2327, Dt8(->upvalue
[0]));
8302 dasm_put(Dst
, 2393);
8304 dasm_put(Dst
, 2397);
8306 dasm_put(Dst
, 2412);
8308 dasm_put(Dst
, 2430, DISPATCH_GL(tmptv
), DISPATCH_GL(tmptv
));
8310 dasm_put(Dst
, 2452);
8312 dasm_put(Dst
, 2457, (2+1)*8);
8314 dasm_put(Dst
, 2461);
8316 dasm_put(Dst
, 2464);
8318 dasm_put(Dst
, 2466, (2+1)*8);
8320 dasm_put(Dst
, 2488);
8322 dasm_put(Dst
, 2557);
8325 dasm_put(Dst
, 2582);
8327 dasm_put(Dst
, 2651);
8329 dasm_put(Dst
, 2676, LJ_TSTR
, Dt5(->len
), LJ_TSTR
, Dt5(->len
));
8331 dasm_put(Dst
, 2703, Dt5([1]), (0+1)*8);
8333 dasm_put(Dst
, 2715, Dt5([1]), 31-3);
8335 dasm_put(Dst
, 2731, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8337 dasm_put(Dst
, 2742);
8339 dasm_put(Dst
, 2750);
8341 dasm_put(Dst
, 2761, Dt1(->base
), Dt1(->base
), LJ_TSTR
, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8343 dasm_put(Dst
, 2789);
8345 dasm_put(Dst
, 2791);
8347 dasm_put(Dst
, 2797);
8349 dasm_put(Dst
, 2799);
8351 dasm_put(Dst
, 2801);
8353 dasm_put(Dst
, 2805);
8355 dasm_put(Dst
, 2814);
8357 dasm_put(Dst
, 2825, LJ_TSTR
);
8359 dasm_put(Dst
, 2830);
8361 dasm_put(Dst
, 2834, Dt5(->len
), sizeof(GCstr
)-1, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8363 dasm_put(Dst
, 2884);
8365 dasm_put(Dst
, 2886);
8367 dasm_put(Dst
, 2888, LJ_TSTR
);
8369 dasm_put(Dst
, 2895);
8371 dasm_put(Dst
, 2899);
8373 dasm_put(Dst
, 2906, 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
));
8374 dasm_put(Dst
, 2959, 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
));
8375 dasm_put(Dst
, 3017, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), LJ_TSTR
, DISPATCH_GL(tmpbuf
.sz
), Dt5(->len
), sizeof(GCstr
), DISPATCH_GL(tmpbuf
.buf
), LJ_TTAB
);
8377 dasm_put(Dst
, 3086);
8379 dasm_put(Dst
, 3096);
8381 dasm_put(Dst
, 3109);
8383 dasm_put(Dst
, 3115);
8385 dasm_put(Dst
, 3117);
8387 dasm_put(Dst
, 3119);
8389 dasm_put(Dst
, 3123);
8391 dasm_put(Dst
, 3126);
8393 dasm_put(Dst
, 3132);
8395 dasm_put(Dst
, 3137);
8397 dasm_put(Dst
, 3147);
8399 dasm_put(Dst
, 3160);
8401 dasm_put(Dst
, 3166);
8403 dasm_put(Dst
, 3168);
8405 dasm_put(Dst
, 3170);
8407 dasm_put(Dst
, 3174);
8409 dasm_put(Dst
, 3177);
8411 dasm_put(Dst
, 3183);
8413 dasm_put(Dst
, 3188);
8415 dasm_put(Dst
, 3198);
8417 dasm_put(Dst
, 3211);
8419 dasm_put(Dst
, 3217);
8421 dasm_put(Dst
, 3219);
8423 dasm_put(Dst
, 3221);
8425 dasm_put(Dst
, 3225);
8427 dasm_put(Dst
, 3228);
8429 dasm_put(Dst
, 3234);
8431 dasm_put(Dst
, 3239);
8433 dasm_put(Dst
, 3249);
8435 dasm_put(Dst
, 3262);
8437 dasm_put(Dst
, 3269);
8439 dasm_put(Dst
, 3279);
8441 dasm_put(Dst
, 3292);
8443 dasm_put(Dst
, 3296);
8445 dasm_put(Dst
, 3311);
8447 dasm_put(Dst
, 3332);
8449 dasm_put(Dst
, 3337);
8451 dasm_put(Dst
, 3352);
8453 dasm_put(Dst
, 3373);
8455 dasm_put(Dst
, 3378);
8457 dasm_put(Dst
, 3393);
8459 dasm_put(Dst
, 3414);
8461 dasm_put(Dst
, 3419);
8463 dasm_put(Dst
, 3434);
8465 dasm_put(Dst
, 3455);
8467 dasm_put(Dst
, 3459);
8469 dasm_put(Dst
, 3474);
8471 dasm_put(Dst
, 3495);
8473 dasm_put(Dst
, 3500);
8475 dasm_put(Dst
, 3510);
8478 dasm_put(Dst
, 3523);
8480 dasm_put(Dst
, 3526);
8482 dasm_put(Dst
, 3532);
8484 dasm_put(Dst
, 3540);
8486 dasm_put(Dst
, 3548);
8488 dasm_put(Dst
, 3550);
8490 dasm_put(Dst
, 3558, Dt8(->f
), 8*LUA_MINSTACK
, Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), Dt1(->base
), 31-3, Dt1(->top
), Dt7(->pc
), FRAME_TYPE
, LUA_MINSTACK
);
8491 dasm_put(Dst
, 3621, Dt1(->base
), Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
8493 dasm_put(Dst
, 3647, DISPATCH_GL(hookmask
), HOOK_VMEVENT
, DISPATCH_GL(hookcount
), HOOK_ACTIVE
, LUA_MASKLINE
|LUA_MASKCOUNT
, DISPATCH_GL(hookcount
));
8495 dasm_put(Dst
, 3669, 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
));
8496 dasm_put(Dst
, 3716, GG_DISP2STATIC
);
8498 dasm_put(Dst
, 3734, GG_DISP2J
, Dt7(->pc
), DISPATCH_J(L
), PC2PROTO(framesize
), Dt1(->base
), 31-3, Dt1(->top
));
8500 dasm_put(Dst
, 3757);
8502 dasm_put(Dst
, 3760);
8504 dasm_put(Dst
, 3763);
8506 dasm_put(Dst
, 3765);
8508 dasm_put(Dst
, 3768, Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
8510 dasm_put(Dst
, 3791, -(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);
8511 dasm_put(Dst
, 3838, 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);
8512 dasm_put(Dst
, 3887, DISPATCH_J(L
), DISPATCH_GL(jit_L
), DISPATCH_J(parent
), Dt1(->base
), GG_DISP2J
, DISPATCH_J(exitno
), Dt1(->cframe
), Dt1(->base
));
8514 dasm_put(Dst
, 3915);
8516 dasm_put(Dst
, 3917, -GG_DISP2G
-32768, 31-3, Dt7(->pc
), DISPATCH_GL(jit_L
), PC2PROTO(k
), LJ_TISNUM
, LJ_TNIL
, DISPATCH_GL(vmstate
), BC_FUNCF
*4);
8518 dasm_put(Dst
, 3974);
8520 dasm_put(Dst
, 3982);
8522 dasm_put(Dst
, 3985);
8524 dasm_put(Dst
, 4065);
8526 dasm_put(Dst
, 4087);
8528 dasm_put(Dst
, 4089);
8530 #define DtE(_V) (int)(ptrdiff_t)&(((CTState *)0)_V)
8531 dasm_put(Dst
, 4091, 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, 56+(24-14)*4, 128+(24-14)*8);
8532 dasm_put(Dst
, 4139, 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, Dt2(->ctype_state
), GG_G2DISP
, DtE(->cb
.slot
), DtE(->cb
.gpr
[0]), DtE(->cb
.fpr
[0]), DtE(->cb
.gpr
[1]), DtE(->cb
.fpr
[1]), DtE(->cb
.gpr
[2]));
8533 dasm_put(Dst
, 4186, DtE(->cb
.fpr
[2]), DtE(->cb
.gpr
[3]), DtE(->cb
.fpr
[3]), DtE(->cb
.gpr
[4]), DtE(->cb
.fpr
[4]), DtE(->cb
.gpr
[5]), DtE(->cb
.fpr
[5]), DtE(->cb
.gpr
[6]), DtE(->cb
.fpr
[6]), DtE(->cb
.gpr
[7]), DtE(->cb
.fpr
[7]), 272+8, DtE(->cb
.stack
), Dt1(->base
), LJ_TISNUM
, Dt1(->top
), LJ_TNIL
, ~LJ_VMST_INTERP
, DISPATCH_GL(vmstate
), Dt7(->pc
));
8535 dasm_put(Dst
, 4250);
8537 dasm_put(Dst
, 4252, DISPATCH_GL(ctype_state
), Dt1(->base
), Dt1(->top
), DtE(->L
), DtE(->cb
.gpr
[0]), DtE(->cb
.fpr
[0]), DtE(->cb
.gpr
[1]));
8539 dasm_put(Dst
, 4273);
8541 #define DtF(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
8542 dasm_put(Dst
, 4275, DtF(->spadj
), DtF(->nsp
), DtF(->nfpr
), DtF(->stack
), 31-2, DtF(->fpr
[0]), DtF(->fpr
[1]), DtF(->fpr
[2]), DtF(->fpr
[3]), DtF(->fpr
[4]), DtF(->fpr
[5]), DtF(->fpr
[6]), DtF(->fpr
[7]), DtF(->func
), DtF(->gpr
[1]), DtF(->gpr
[2]));
8543 dasm_put(Dst
, 4332, DtF(->gpr
[3]), DtF(->gpr
[4]), DtF(->gpr
[5]), DtF(->gpr
[6]), DtF(->gpr
[7]), DtF(->gpr
[0]), DtF(->gpr
[0]), DtF(->fpr
[0]), DtF(->gpr
[1]), DtF(->gpr
[2]), DtF(->gpr
[3]));
8547 /* Generate the code for a single instruction. */
8548 static void build_ins(BuildCtx
*ctx
, BCOp op
, int defop
)
8551 dasm_put(Dst
, 4364, defop
);
8555 /* -- Comparison ops ---------------------------------------------------- */
8557 /* Remember: all ops branch for a true comparison, fall through otherwise. */
8559 case BC_ISLT
: case BC_ISGE
: case BC_ISLE
: case BC_ISGT
:
8561 dasm_put(Dst
, 4366, -(BCBIAS_J
*4 >> 16));
8562 if (op
== BC_ISLT
) {
8563 dasm_put(Dst
, 4383);
8564 } else if (op
== BC_ISGE
) {
8565 dasm_put(Dst
, 4386);
8566 } else if (op
== BC_ISLE
) {
8567 dasm_put(Dst
, 4389);
8569 dasm_put(Dst
, 4392);
8571 dasm_put(Dst
, 4395);
8572 if (op
== BC_ISLT
) {
8573 dasm_put(Dst
, 4434);
8574 } else if (op
== BC_ISGE
) {
8575 dasm_put(Dst
, 4437);
8576 } else if (op
== BC_ISLE
) {
8577 dasm_put(Dst
, 4440);
8579 dasm_put(Dst
, 4444);
8581 dasm_put(Dst
, 4448);
8583 dasm_put(Dst
, 4451, -(BCBIAS_J
*4 >> 16));
8584 if (op
== BC_ISLT
) {
8585 dasm_put(Dst
, 4468);
8586 } else if (op
== BC_ISGE
) {
8587 dasm_put(Dst
, 4471);
8588 } else if (op
== BC_ISLE
) {
8589 dasm_put(Dst
, 4474);
8591 dasm_put(Dst
, 4478);
8593 dasm_put(Dst
, 4482);
8597 case BC_ISEQV
: case BC_ISNEV
:
8598 vk
= op
== BC_ISEQV
;
8600 dasm_put(Dst
, 4495, -(BCBIAS_J
*4 >> 16));
8602 dasm_put(Dst
, 4508);
8604 dasm_put(Dst
, 4511);
8607 dasm_put(Dst
, 4514, -(BCBIAS_J
*4 >> 16));
8609 dasm_put(Dst
, 4531);
8611 dasm_put(Dst
, 4535);
8613 dasm_put(Dst
, 4539);
8615 dasm_put(Dst
, 4551);
8617 dasm_put(Dst
, 4553);
8620 dasm_put(Dst
, 4556, LJ_TCDATA
, LJ_TCDATA
);
8622 dasm_put(Dst
, 4561, ~LJ_TISPRI
);
8624 dasm_put(Dst
, 4566);
8626 dasm_put(Dst
, 4568, ~LJ_TISTABUD
);
8628 dasm_put(Dst
, 4571);
8630 dasm_put(Dst
, 4574);
8632 dasm_put(Dst
, 4582);
8634 dasm_put(Dst
, 4587);
8637 dasm_put(Dst
, 4592);
8639 dasm_put(Dst
, 4607);
8641 dasm_put(Dst
, 4610, Dt6(->metatable
), 1-vk
, Dt6(->nomm
), 1<<MM_eq
);
8644 case BC_ISEQS
: case BC_ISNES
:
8645 vk
= op
== BC_ISEQS
;
8646 dasm_put(Dst
, 4629, 32-1);
8648 dasm_put(Dst
, 4637, LJ_TCDATA
);
8650 dasm_put(Dst
, 4640, LJ_TSTR
);
8652 dasm_put(Dst
, 4644);
8654 dasm_put(Dst
, 4647, -(BCBIAS_J
*4 >> 16));
8656 dasm_put(Dst
, 4655);
8658 dasm_put(Dst
, 4657);
8660 dasm_put(Dst
, 4659);
8663 case BC_ISEQN
: case BC_ISNEN
:
8664 vk
= op
== BC_ISEQN
;
8666 dasm_put(Dst
, 4671, -(BCBIAS_J
*4 >> 16));
8668 dasm_put(Dst
, 4683);
8670 dasm_put(Dst
, 4685);
8672 dasm_put(Dst
, 4687);
8675 dasm_put(Dst
, 4694);
8677 dasm_put(Dst
, 4696);
8679 dasm_put(Dst
, 4698, -(BCBIAS_J
*4 >> 16));
8682 dasm_put(Dst
, 4711);
8684 dasm_put(Dst
, 4716);
8687 dasm_put(Dst
, 4718);
8689 dasm_put(Dst
, 4722);
8691 dasm_put(Dst
, 4724);
8693 dasm_put(Dst
, 4727);
8695 dasm_put(Dst
, 4738, LJ_TCDATA
);
8698 dasm_put(Dst
, 4746);
8702 case BC_ISEQP
: case BC_ISNEP
:
8703 vk
= op
== BC_ISEQP
;
8704 dasm_put(Dst
, 4770, 32-3);
8706 dasm_put(Dst
, 4777, LJ_TCDATA
);
8708 dasm_put(Dst
, 4780);
8710 dasm_put(Dst
, 4782);
8712 dasm_put(Dst
, 4785, -(BCBIAS_J
*4 >> 16));
8714 dasm_put(Dst
, 4791);
8716 dasm_put(Dst
, 4793);
8718 dasm_put(Dst
, 4795);
8721 /* -- Unary test and copy ops ------------------------------------------- */
8723 case BC_ISTC
: case BC_ISFC
: case BC_IST
: case BC_ISF
:
8724 dasm_put(Dst
, 4807);
8725 if (op
== BC_IST
|| op
== BC_ISF
) {
8726 dasm_put(Dst
, 4811, LJ_TTRUE
, -(BCBIAS_J
*4 >> 16));
8728 dasm_put(Dst
, 4818);
8730 dasm_put(Dst
, 4820);
8732 dasm_put(Dst
, 4822);
8734 dasm_put(Dst
, 4824, LJ_TFALSE
);
8735 if (op
== BC_ISTC
) {
8736 dasm_put(Dst
, 4829);
8738 dasm_put(Dst
, 4832);
8740 dasm_put(Dst
, 4835, -(BCBIAS_J
*4 >> 16));
8742 dasm_put(Dst
, 4842);
8745 /* -- Unary ops --------------------------------------------------------- */
8748 dasm_put(Dst
, 4853);
8751 dasm_put(Dst
, 4866, LJ_TTRUE
);
8754 dasm_put(Dst
, 4882);
8756 dasm_put(Dst
, 4886);
8758 dasm_put(Dst
, 4914);
8760 dasm_put(Dst
, 4924);
8762 dasm_put(Dst
, 4927);
8766 dasm_put(Dst
, 4936, LJ_TSTR
, Dt5(->len
));
8768 dasm_put(Dst
, 4946);
8770 dasm_put(Dst
, 4951);
8772 dasm_put(Dst
, 4958, LJ_TTAB
);
8773 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8774 dasm_put(Dst
, 4972, Dt6(->metatable
));
8776 dasm_put(Dst
, 4979);
8777 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8778 dasm_put(Dst
, 4985, Dt6(->nomm
), 1<<MM_len
);
8782 /* -- Binary ops -------------------------------------------------------- */
8785 case BC_ADDVN
: case BC_ADDNV
: case BC_ADDVV
:
8787 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8790 dasm_put(Dst
, 4995);
8793 dasm_put(Dst
, 5001);
8796 dasm_put(Dst
, 5007);
8799 dasm_put(Dst
, 5013);
8802 dasm_put(Dst
, 5040);
8805 dasm_put(Dst
, 5043);
8808 dasm_put(Dst
, 5046);
8811 dasm_put(Dst
, 5049);
8813 dasm_put(Dst
, 5051);
8815 dasm_put(Dst
, 5055);
8819 dasm_put(Dst
, 5059);
8822 dasm_put(Dst
, 5062);
8825 dasm_put(Dst
, 5065);
8828 dasm_put(Dst
, 5068);
8830 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8833 dasm_put(Dst
, 5075);
8835 dasm_put(Dst
, 5077);
8837 dasm_put(Dst
, 5079);
8839 dasm_put(Dst
, 5082);
8841 dasm_put(Dst
, 5088);
8845 dasm_put(Dst
, 5092);
8847 dasm_put(Dst
, 5094);
8849 dasm_put(Dst
, 5096);
8851 dasm_put(Dst
, 5099);
8853 dasm_put(Dst
, 5105);
8857 dasm_put(Dst
, 5109);
8860 dasm_put(Dst
, 5119);
8863 case BC_SUBVN
: case BC_SUBNV
: case BC_SUBVV
:
8865 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8868 dasm_put(Dst
, 5132);
8871 dasm_put(Dst
, 5138);
8874 dasm_put(Dst
, 5144);
8877 dasm_put(Dst
, 5150);
8880 dasm_put(Dst
, 5177);
8883 dasm_put(Dst
, 5180);
8886 dasm_put(Dst
, 5183);
8889 dasm_put(Dst
, 5186);
8891 dasm_put(Dst
, 5188);
8893 dasm_put(Dst
, 5192);
8897 dasm_put(Dst
, 5196);
8900 dasm_put(Dst
, 5199);
8903 dasm_put(Dst
, 5202);
8906 dasm_put(Dst
, 5205);
8908 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8911 dasm_put(Dst
, 5212);
8913 dasm_put(Dst
, 5214);
8915 dasm_put(Dst
, 5216);
8917 dasm_put(Dst
, 5219);
8919 dasm_put(Dst
, 5225);
8923 dasm_put(Dst
, 5229);
8925 dasm_put(Dst
, 5231);
8927 dasm_put(Dst
, 5233);
8929 dasm_put(Dst
, 5236);
8931 dasm_put(Dst
, 5242);
8935 dasm_put(Dst
, 5246);
8938 dasm_put(Dst
, 5256);
8941 case BC_MULVN
: case BC_MULNV
: case BC_MULVV
:
8943 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8946 dasm_put(Dst
, 5269);
8949 dasm_put(Dst
, 5275);
8952 dasm_put(Dst
, 5281);
8955 dasm_put(Dst
, 5287);
8958 dasm_put(Dst
, 5314);
8961 dasm_put(Dst
, 5317);
8964 dasm_put(Dst
, 5320);
8967 dasm_put(Dst
, 5323);
8969 dasm_put(Dst
, 5325);
8971 dasm_put(Dst
, 5329);
8975 dasm_put(Dst
, 5333);
8978 dasm_put(Dst
, 5336);
8981 dasm_put(Dst
, 5339);
8984 dasm_put(Dst
, 5342);
8986 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8989 dasm_put(Dst
, 5349);
8991 dasm_put(Dst
, 5351);
8993 dasm_put(Dst
, 5353);
8995 dasm_put(Dst
, 5356);
8997 dasm_put(Dst
, 5362);
9001 dasm_put(Dst
, 5366);
9003 dasm_put(Dst
, 5368);
9005 dasm_put(Dst
, 5370);
9007 dasm_put(Dst
, 5373);
9009 dasm_put(Dst
, 5379);
9013 dasm_put(Dst
, 5383);
9016 dasm_put(Dst
, 5393);
9019 case BC_DIVVN
: case BC_DIVNV
: case BC_DIVVV
:
9020 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9023 dasm_put(Dst
, 5406);
9025 dasm_put(Dst
, 5408);
9027 dasm_put(Dst
, 5410);
9029 dasm_put(Dst
, 5413);
9031 dasm_put(Dst
, 5419);
9035 dasm_put(Dst
, 5423);
9037 dasm_put(Dst
, 5425);
9039 dasm_put(Dst
, 5427);
9041 dasm_put(Dst
, 5430);
9043 dasm_put(Dst
, 5436);
9047 dasm_put(Dst
, 5440);
9050 dasm_put(Dst
, 5450);
9054 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9057 dasm_put(Dst
, 5463);
9060 dasm_put(Dst
, 5469);
9063 dasm_put(Dst
, 5475);
9066 dasm_put(Dst
, 5481);
9069 dasm_put(Dst
, 5509);
9072 dasm_put(Dst
, 5512);
9075 dasm_put(Dst
, 5515);
9078 dasm_put(Dst
, 5518);
9080 dasm_put(Dst
, 5520);
9082 dasm_put(Dst
, 5524);
9086 dasm_put(Dst
, 5528);
9089 dasm_put(Dst
, 5531);
9092 dasm_put(Dst
, 5534);
9095 dasm_put(Dst
, 5537);
9097 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9100 dasm_put(Dst
, 5549);
9102 dasm_put(Dst
, 5551);
9104 dasm_put(Dst
, 5553);
9106 dasm_put(Dst
, 5556);
9108 dasm_put(Dst
, 5562);
9112 dasm_put(Dst
, 5566);
9114 dasm_put(Dst
, 5568);
9116 dasm_put(Dst
, 5570);
9118 dasm_put(Dst
, 5573);
9120 dasm_put(Dst
, 5579);
9124 dasm_put(Dst
, 5583);
9127 dasm_put(Dst
, 5593);
9130 case BC_MODNV
: case BC_MODVV
:
9132 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9135 dasm_put(Dst
, 5611);
9138 dasm_put(Dst
, 5617);
9141 dasm_put(Dst
, 5623);
9144 dasm_put(Dst
, 5629);
9147 dasm_put(Dst
, 5657);
9150 dasm_put(Dst
, 5660);
9153 dasm_put(Dst
, 5663);
9156 dasm_put(Dst
, 5666);
9158 dasm_put(Dst
, 5668);
9160 dasm_put(Dst
, 5672);
9164 dasm_put(Dst
, 5676);
9167 dasm_put(Dst
, 5679);
9170 dasm_put(Dst
, 5682);
9173 dasm_put(Dst
, 5685);
9175 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9178 dasm_put(Dst
, 5688);
9180 dasm_put(Dst
, 5690);
9182 dasm_put(Dst
, 5692);
9184 dasm_put(Dst
, 5695);
9186 dasm_put(Dst
, 5701);
9190 dasm_put(Dst
, 5705);
9192 dasm_put(Dst
, 5707);
9194 dasm_put(Dst
, 5709);
9196 dasm_put(Dst
, 5712);
9198 dasm_put(Dst
, 5718);
9202 dasm_put(Dst
, 5722);
9205 dasm_put(Dst
, 5732);
9209 dasm_put(Dst
, 5735);
9213 dasm_put(Dst
, 5758, Dt1(->base
), 32-3, Dt1(->base
));
9216 /* -- Constant ops ------------------------------------------------------ */
9219 dasm_put(Dst
, 5788, 32-1, LJ_TSTR
);
9223 dasm_put(Dst
, 5807, 32-1, LJ_TCDATA
);
9228 dasm_put(Dst
, 5826, 31-13);
9230 dasm_put(Dst
, 5842, 31-13, 31-20);
9234 dasm_put(Dst
, 5870);
9237 dasm_put(Dst
, 5883, 32-3);
9240 dasm_put(Dst
, 5898);
9243 /* -- Upvalue and function ops ------------------------------------------ */
9246 dasm_put(Dst
, 5917, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9249 dasm_put(Dst
, 5938, 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
);
9252 dasm_put(Dst
, 5991, 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
);
9255 dasm_put(Dst
, 6042, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9258 dasm_put(Dst
, 6063, 32-1, 32-3, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9262 dasm_put(Dst
, 6086, Dt1(->openupval
), 32-1, -(BCBIAS_J
*4 >> 16), Dt1(->base
), Dt1(->base
));
9266 dasm_put(Dst
, 6116, 32-1, Dt1(->base
), Dt1(->base
), LJ_TFUNC
);
9269 /* -- Table ops --------------------------------------------------------- */
9273 dasm_put(Dst
, 6144, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), Dt1(->base
));
9274 if (op
== BC_TNEW
) {
9275 dasm_put(Dst
, 6157);
9277 dasm_put(Dst
, 6166, 32-1);
9279 dasm_put(Dst
, 6173, Dt1(->base
), LJ_TTAB
);
9280 if (op
== BC_TNEW
) {
9281 dasm_put(Dst
, 6190);
9283 dasm_put(Dst
, 6195);
9288 dasm_put(Dst
, 6204, 32-1, Dt7(->env
));
9289 if (op
== BC_GGET
) {
9290 dasm_put(Dst
, 6212);
9292 dasm_put(Dst
, 6215);
9297 dasm_put(Dst
, 6218);
9299 dasm_put(Dst
, 6222);
9301 dasm_put(Dst
, 6224);
9303 dasm_put(Dst
, 6226, LJ_TTAB
);
9305 dasm_put(Dst
, 6232, Dt6(->asize
), Dt6(->array
), 31-3);
9307 dasm_put(Dst
, 6242, Dt6(->asize
), Dt6(->array
), 31-3);
9309 dasm_put(Dst
, 6259, LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
, LJ_TSTR
);
9311 dasm_put(Dst
, 6299);
9313 dasm_put(Dst
, 6301);
9316 dasm_put(Dst
, 6304, 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
));
9317 dasm_put(Dst
, 6365, LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
9320 dasm_put(Dst
, 6385, 32-3, LJ_TTAB
, Dt6(->asize
), Dt6(->array
), LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
9324 dasm_put(Dst
, 6433);
9326 dasm_put(Dst
, 6437);
9328 dasm_put(Dst
, 6439);
9330 dasm_put(Dst
, 6441, LJ_TTAB
);
9332 dasm_put(Dst
, 6447, Dt6(->asize
), Dt6(->array
), 31-3);
9334 dasm_put(Dst
, 6457, Dt6(->asize
), Dt6(->array
), 31-3);
9336 dasm_put(Dst
, 6474, Dt6(->marked
), LJ_TNIL
, LJ_GC_BLACK
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, LJ_TSTR
);
9338 dasm_put(Dst
, 6521);
9340 dasm_put(Dst
, 6523, DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9343 dasm_put(Dst
, 6538, 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
), DtB(->next
), LJ_TSTR
, LJ_TNIL
);
9344 dasm_put(Dst
, 6589, LJ_GC_BLACK
, DtB(->val
), Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, Dt6(->metatable
), DISPATCH_GL(tmptv
), Dt1(->base
), Dt6(->nomm
), 1<<MM_newindex
, LJ_TSTR
);
9345 dasm_put(Dst
, 6646, Dt1(->base
), DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9348 dasm_put(Dst
, 6669, 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
));
9349 dasm_put(Dst
, 6727, DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9353 dasm_put(Dst
, 6737, 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
));
9354 dasm_put(Dst
, 6806);
9357 /* -- Calls and vararg handling ----------------------------------------- */
9360 dasm_put(Dst
, 6809);
9363 dasm_put(Dst
, 6811, LJ_TFUNC
, Dt7(->pc
));
9367 dasm_put(Dst
, 6832);
9370 dasm_put(Dst
, 6834, LJ_TFUNC
, FRAME_TYPE
, Dt7(->ffid
), FRAME_VARG
, Dt7(->pc
), -4-8, Dt7(->pc
), PC2PROTO(k
), FRAME_TYPEP
);
9371 dasm_put(Dst
, 6898, FRAME_TYPE
);
9375 dasm_put(Dst
, 6907, LJ_TFUNC
, Dt7(->pc
));
9381 dasm_put(Dst
, 6934, Dt6(->asize
), Dt6(->array
), 31-3, LJ_TNIL
);
9383 dasm_put(Dst
, 6956);
9385 dasm_put(Dst
, 6959);
9387 dasm_put(Dst
, 6963, -(BCBIAS_J
*4 >> 16));
9389 dasm_put(Dst
, 6971);
9391 dasm_put(Dst
, 6973, Dt6(->hmask
), Dt6(->node
), 31-5, 31-3, LJ_TNIL
, DtB(->key
), -(BCBIAS_J
*4 >> 16));
9395 dasm_put(Dst
, 7029, 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));
9399 dasm_put(Dst
, 7079, FRAME_VARG
, Dt1(->maxstack
), Dt1(->top
), Dt1(->base
), 32-3, Dt1(->base
));
9400 dasm_put(Dst
, 7159);
9403 /* -- Returns ----------------------------------------------------------- */
9406 dasm_put(Dst
, 7165);
9410 dasm_put(Dst
, 7167, FRAME_TYPE
, FRAME_VARG
, Dt7(->pc
), PC2PROTO(k
), FRAME_TYPEP
);
9413 case BC_RET0
: case BC_RET1
:
9414 dasm_put(Dst
, 7237, FRAME_TYPE
, FRAME_VARG
);
9415 if (op
== BC_RET1
) {
9416 dasm_put(Dst
, 7250);
9418 dasm_put(Dst
, 7253, Dt7(->pc
), PC2PROTO(k
));
9421 /* -- Loops and branches ------------------------------------------------ */
9425 dasm_put(Dst
, 7281, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9436 vk
= (op
== BC_IFORL
|| op
== BC_JFORL
);
9438 dasm_put(Dst
, 7291, FORL_IDX
*8+4);
9440 dasm_put(Dst
, 7296, FORL_STEP
*8+4, FORL_STOP
*8+4, FORL_IDX
*8+4);
9442 dasm_put(Dst
, 7310, FORL_STEP
*8, FORL_STEP
*8+4, FORL_STOP
*8, FORL_STOP
*8+4);
9444 dasm_put(Dst
, 7326, FORL_EXT
*8);
9445 if (op
!= BC_JFORL
) {
9446 dasm_put(Dst
, 7333, 32-1);
9448 dasm_put(Dst
, 7336, FORL_EXT
*8+4);
9449 if (op
!= BC_JFORL
) {
9450 dasm_put(Dst
, 7339);
9452 if (op
== BC_FORI
) {
9453 dasm_put(Dst
, 7341);
9454 } else if (op
== BC_JFORI
) {
9455 dasm_put(Dst
, 7344, -(BCBIAS_J
*4 >> 16));
9456 } else if (op
== BC_IFORL
) {
9457 dasm_put(Dst
, 7349, -(BCBIAS_J
*4 >> 16));
9459 dasm_put(Dst
, 7354, BC_JLOOP
);
9461 dasm_put(Dst
, 7357);
9463 dasm_put(Dst
, 7373);
9468 dasm_put(Dst
, 7380, FORL_IDX
*8);
9470 dasm_put(Dst
, 7384);
9472 dasm_put(Dst
, 7386, FORL_STEP
*8, FORL_STOP
*8, FORL_STEP
*8, FORL_IDX
*8);
9475 dasm_put(Dst
, 7396);
9477 dasm_put(Dst
, 7398, FORL_STEP
*8, FORL_STOP
*8);
9479 dasm_put(Dst
, 7407, FORL_IDX
*8, FORL_STOP
*8);
9481 dasm_put(Dst
, 7416);
9482 if (op
!= BC_JFORL
) {
9483 dasm_put(Dst
, 7418, 32-1);
9485 dasm_put(Dst
, 7421, FORL_EXT
*8);
9486 if (op
!= BC_JFORL
) {
9487 dasm_put(Dst
, 7424);
9489 dasm_put(Dst
, 7426);
9490 if (op
== BC_JFORI
) {
9491 dasm_put(Dst
, 7428, -(BCBIAS_J
*4 >> 16));
9493 dasm_put(Dst
, 7431);
9494 if (op
== BC_FORI
) {
9495 dasm_put(Dst
, 7434);
9496 } else if (op
== BC_IFORL
) {
9498 dasm_put(Dst
, 7437);
9500 dasm_put(Dst
, 7440);
9502 dasm_put(Dst
, 7443, -(BCBIAS_J
*4 >> 16));
9503 } else if (op
== BC_JFORI
) {
9504 dasm_put(Dst
, 7447);
9506 dasm_put(Dst
, 7450, BC_JLOOP
);
9509 dasm_put(Dst
, 7453);
9511 dasm_put(Dst
, 7456);
9513 dasm_put(Dst
, 7468);
9514 if (op
== BC_FORI
) {
9515 dasm_put(Dst
, 7470, -(BCBIAS_J
*4 >> 16));
9516 } else if (op
== BC_IFORL
) {
9517 dasm_put(Dst
, 7476);
9518 } else if (op
== BC_JFORI
) {
9519 dasm_put(Dst
, 7479);
9521 dasm_put(Dst
, 7482, BC_JLOOP
);
9523 dasm_put(Dst
, 7485);
9524 if (op
== BC_JFORI
) {
9525 dasm_put(Dst
, 7488, BC_JLOOP
);
9531 dasm_put(Dst
, 7494, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9540 dasm_put(Dst
, 7504, LJ_TNIL
);
9541 if (op
== BC_JITERL
) {
9542 dasm_put(Dst
, 7511, BC_JLOOP
);
9544 dasm_put(Dst
, 7516, 32-1, -(BCBIAS_J
*4 >> 16));
9546 dasm_put(Dst
, 7524);
9551 dasm_put(Dst
, 7536, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9556 dasm_put(Dst
, 7546);
9561 dasm_put(Dst
, 7557, DISPATCH_J(trace
), 32-1, DISPATCH_GL(vmstate
), DtD(->mcode
), DISPATCH_GL(jit_base
), DISPATCH_GL(jit_L
), GG_DISP2G
+32768);
9566 dasm_put(Dst
, 7576, 32-1, -(BCBIAS_J
*4 >> 16));
9569 /* -- Function headers -------------------------------------------------- */
9573 dasm_put(Dst
, 7592, GG_DISP2HOT
, -HOTCOUNT_CALL
);
9575 case BC_FUNCV
: /* NYI: compiled vararg functions. */
9583 dasm_put(Dst
, 7602, Dt1(->maxstack
), -4+PC2PROTO(numparams
), -4+PC2PROTO(k
), 31-3);
9584 if (op
!= BC_JFUNCF
) {
9585 dasm_put(Dst
, 7614);
9587 dasm_put(Dst
, 7617);
9588 if (op
== BC_JFUNCF
) {
9589 dasm_put(Dst
, 7622, BC_JLOOP
);
9591 dasm_put(Dst
, 7626);
9593 dasm_put(Dst
, 7635);
9600 dasm_put(Dst
, 7641);
9601 break; /* NYI: compiled vararg functions. */
9604 dasm_put(Dst
, 7643, Dt1(->maxstack
), 8+FRAME_VARG
, -4+PC2PROTO(k
), -4+PC2PROTO(numparams
), LJ_TNIL
);
9609 if (op
== BC_FUNCC
) {
9610 dasm_put(Dst
, 7696, Dt8(->f
));
9612 dasm_put(Dst
, 7699, DISPATCH_GL(wrapf
));
9614 dasm_put(Dst
, 7702, Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), ~LJ_VMST_C
);
9615 if (op
== BC_FUNCCW
) {
9616 dasm_put(Dst
, 7715, Dt8(->f
));
9618 dasm_put(Dst
, 7718, DISPATCH_GL(vmstate
), Dt1(->base
), 31-3, Dt1(->top
), ~LJ_VMST_INTERP
, DISPATCH_GL(vmstate
));
9621 /* ---------------------------------------------------------------------- */
9624 fprintf(stderr
, "Error: undefined opcode BC_%s\n", bc_names
[op
]);
9630 static int build_backend(BuildCtx
*ctx
)
9634 dasm_growpc(Dst
, BC__MAX
);
9636 build_subroutines(ctx
);
9638 dasm_put(Dst
, 7739);
9639 for (op
= 0; op
< BC__MAX
; op
++)
9640 build_ins(ctx
, (BCOp
)op
, op
);
9645 /* Emit pseudo frame-info for all assembler functions. */
9646 static void emit_asm_debug(BuildCtx
*ctx
)
9648 int fcofs
= (int)((uint8_t *)ctx
->glob
[GLOB_vm_ffi_call
] - ctx
->code
);
9650 switch (ctx
->mode
) {
9652 fprintf(ctx
->fp
, "\t.section .debug_frame,\"\",@progbits\n");
9655 "\t.long .LECIE0-.LSCIE0\n"
9657 "\t.long 0xffffffff\n"
9663 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9668 "\t.long .LEFDE0-.LASFDE0\n"
9670 "\t.long .Lframe0\n"
9673 "\t.byte 0xe\n\t.uleb128 %d\n"
9674 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9675 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
9676 fcofs
, CFRAME_SIZE
);
9677 for (i
= 14; i
<= 31; i
++)
9679 "\t.byte %d\n\t.uleb128 %d\n"
9680 "\t.byte %d\n\t.uleb128 %d\n",
9681 0x80+i
, 37+(31-i
), 0x80+32+i
, 2+2*(31-i
));
9688 "\t.long .LEFDE1-.LASFDE1\n"
9690 "\t.long .Lframe0\n"
9691 "\t.long lj_vm_ffi_call\n"
9693 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9694 "\t.byte 0x8e\n\t.uleb128 2\n"
9695 "\t.byte 0xd\n\t.uleb128 0xe\n"
9697 ".LEFDE1:\n\n", (int)ctx
->codesz
- fcofs
);
9699 fprintf(ctx
->fp
, "\t.section .eh_frame,\"a\",@progbits\n");
9702 "\t.long .LECIE1-.LSCIE1\n"
9706 "\t.string \"zPR\"\n"
9710 "\t.uleb128 6\n" /* augmentation length */
9711 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9712 "\t.long lj_err_unwind_dwarf-.\n"
9713 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9714 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9719 "\t.long .LEFDE2-.LASFDE2\n"
9721 "\t.long .LASFDE2-.Lframe1\n"
9722 "\t.long .Lbegin-.\n"
9724 "\t.uleb128 0\n" /* augmentation length */
9725 "\t.byte 0xe\n\t.uleb128 %d\n"
9726 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9727 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
9728 fcofs
, CFRAME_SIZE
);
9729 for (i
= 14; i
<= 31; i
++)
9731 "\t.byte %d\n\t.uleb128 %d\n"
9732 "\t.byte %d\n\t.uleb128 %d\n",
9733 0x80+i
, 37+(31-i
), 0x80+32+i
, 2+2*(31-i
));
9740 "\t.long .LECIE2-.LSCIE2\n"
9744 "\t.string \"zR\"\n"
9748 "\t.uleb128 1\n" /* augmentation length */
9749 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9750 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9755 "\t.long .LEFDE3-.LASFDE3\n"
9757 "\t.long .LASFDE3-.Lframe2\n"
9758 "\t.long lj_vm_ffi_call-.\n"
9760 "\t.uleb128 0\n" /* augmentation length */
9761 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9762 "\t.byte 0x8e\n\t.uleb128 2\n"
9763 "\t.byte 0xd\n\t.uleb128 0xe\n"
9765 ".LEFDE3:\n\n", (int)ctx
->codesz
- fcofs
);