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
[7762] = {
7789 GLOB_vm_unwind_c_eh
,
7791 GLOB_vm_unwind_ff_eh
,
7792 GLOB_vm_growstack_c
,
7793 GLOB_vm_growstack_l
,
7797 GLOB_vm_call_dispatch
,
7799 GLOB_vm_call_dispatch_f
,
7801 GLOB_cont_ffi_callback
,
7820 GLOB_vmeta_equal_cd
,
7821 GLOB_vmeta_arith_nv
,
7822 GLOB_vmeta_arith_nv2
,
7824 GLOB_vmeta_arith_vn
,
7825 GLOB_vmeta_arith_vv
,
7826 GLOB_vmeta_arith_vn2
,
7827 GLOB_vmeta_arith_vv2
,
7838 GLOB_ff_getmetatable
,
7840 GLOB_ff_setmetatable
,
7851 GLOB_ff_coroutine_resume
,
7852 GLOB_ff_coroutine_wrap_aux
,
7853 GLOB_ff_coroutine_yield
,
7883 GLOB_ff_string_byte
,
7884 GLOB_ff_string_char
,
7888 GLOB_ff_string_reverse
,
7889 GLOB_ff_string_lower
,
7890 GLOB_ff_string_upper
,
7901 GLOB_ff_bit_arshift
,
7912 GLOB_vm_exit_handler
,
7913 GLOB_vm_exit_interp
,
7920 GLOB_vm_ffi_callback
,
7930 static const char *const globnames
[] = {
7949 "vm_call_dispatch_f",
7951 "cont_ffi_callback",
8001 "ff_coroutine_resume",
8002 "ff_coroutine_wrap_aux",
8003 "ff_coroutine_yield",
8038 "ff_string_reverse",
8080 static const char *const extnames
[] = {
8081 "lj_state_growstack",
8092 "lj_str_fromnumber",
8096 "lj_ffh_coroutine_wrap_err",
8127 "lj_ccallback_enter",
8128 "lj_ccallback_leave",
8135 "lj_gc_step_fixtop",
8140 #define Dt1(_V) (int)(ptrdiff_t)&(((lua_State *)0)_V)
8141 #define Dt2(_V) (int)(ptrdiff_t)&(((global_State *)0)_V)
8142 #define Dt3(_V) (int)(ptrdiff_t)&(((TValue *)0)_V)
8143 #define Dt4(_V) (int)(ptrdiff_t)&(((GCobj *)0)_V)
8144 #define Dt5(_V) (int)(ptrdiff_t)&(((GCstr *)0)_V)
8145 #define Dt6(_V) (int)(ptrdiff_t)&(((GCtab *)0)_V)
8146 #define Dt7(_V) (int)(ptrdiff_t)&(((GCfuncL *)0)_V)
8147 #define Dt8(_V) (int)(ptrdiff_t)&(((GCfuncC *)0)_V)
8148 #define Dt9(_V) (int)(ptrdiff_t)&(((GCproto *)0)_V)
8149 #define DtA(_V) (int)(ptrdiff_t)&(((GCupval *)0)_V)
8150 #define DtB(_V) (int)(ptrdiff_t)&(((Node *)0)_V)
8151 #define DtC(_V) (int)(ptrdiff_t)&(((int *)0)_V)
8152 #define DtD(_V) (int)(ptrdiff_t)&(((GCtrace *)0)_V)
8153 #define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
8154 #define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
8155 #define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
8157 /* Generate subroutines used by opcodes and other parts of the VM. */
8158 /* The .code_sub section should be last to help static branch prediction. */
8159 static void build_subroutines(BuildCtx
*ctx
)
8162 dasm_put(Dst
, 1, FRAME_P
, LJ_TTRUE
, FRAME_TYPE
, FRAME_C
, ~LJ_VMST_C
, Dt1(->base
), DISPATCH_GL(vmstate
), 31-3, Dt1(->top
));
8163 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);
8164 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
));
8165 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
);
8166 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);
8167 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);
8168 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
);
8169 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);
8170 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);
8171 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);
8172 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
));
8173 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);
8174 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);
8175 dasm_put(Dst
, 700, 128+(31-14)*8, Dt1(->stack
), Dt1(->top
), Dt1(->cframe
), Dt1(->cframe
), Dt1(->glref
), FRAME_CP
, GG_G2DISP
);
8179 dasm_put(Dst
, 740, Dt7(->pc
));
8183 dasm_put(Dst
, 749, PC2PROTO(k
));
8187 dasm_put(Dst
, 762, Dt1(->base
), DISPATCH_GL(tmptv
), LJ_TSTR
, DISPATCH_GL(tmptv
), LJ_TTAB
, DISPATCH_GL(tmptv2
), LJ_TSTR
);
8191 dasm_put(Dst
, 811, DISPATCH_GL(tmptv
));
8197 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
);
8201 dasm_put(Dst
, 893, DISPATCH_GL(tmptv
));
8207 dasm_put(Dst
, 903, Dt1(->base
), FRAME_CONT
, Dt1(->top
));
8219 dasm_put(Dst
, 958, Dt1(->base
), -(BCBIAS_J
*4 >> 16), LJ_TTRUE
, LJ_TTRUE
, Dt1(->base
));
8221 dasm_put(Dst
, 1021, Dt1(->base
));
8223 dasm_put(Dst
, 1032);
8225 dasm_put(Dst
, 1039);
8227 dasm_put(Dst
, 1044);
8229 dasm_put(Dst
, 1058);
8231 dasm_put(Dst
, 1061);
8233 dasm_put(Dst
, 1064);
8235 dasm_put(Dst
, 1067, Dt1(->base
), FRAME_CONT
);
8236 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8237 dasm_put(Dst
, 1091);
8239 dasm_put(Dst
, 1093, Dt1(->base
));
8240 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8241 dasm_put(Dst
, 1101);
8243 dasm_put(Dst
, 1108);
8245 dasm_put(Dst
, 1111, Dt1(->base
), Dt7(->pc
), Dt1(->base
), Dt1(->base
));
8247 dasm_put(Dst
, 1159);
8249 dasm_put(Dst
, 1161);
8251 dasm_put(Dst
, 1163, BC_JFORI
);
8253 dasm_put(Dst
, 1166);
8255 dasm_put(Dst
, 1168, BC_JFORI
);
8257 dasm_put(Dst
, 1171, BC_FORI
, LJ_TFALSE
, ~LJ_TISNUM
+1, 31-3, Dt8(->upvalue
), LJ_TTAB
, Dt6(->metatable
));
8258 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
));
8259 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
));
8260 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
));
8261 dasm_put(Dst
, 1397, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8263 dasm_put(Dst
, 1407);
8265 dasm_put(Dst
, 1410);
8267 dasm_put(Dst
, 1413, LJ_TSTR
, LJ_TTAB
, Dt1(->base
), Dt1(->top
), LJ_TNIL
, (2+1)*8, LJ_TTAB
);
8268 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8269 dasm_put(Dst
, 1464, Dt6(->metatable
), Dt8(->upvalue
[0]));
8271 dasm_put(Dst
, 1473, Dt8(->upvalue
[0]));
8273 dasm_put(Dst
, 1477, (3+1)*8);
8275 dasm_put(Dst
, 1489);
8277 dasm_put(Dst
, 1491);
8279 dasm_put(Dst
, 1493, LJ_TTAB
);
8281 dasm_put(Dst
, 1500);
8283 dasm_put(Dst
, 1505);
8285 dasm_put(Dst
, 1517, Dt6(->asize
), Dt6(->array
));
8287 dasm_put(Dst
, 1522);
8289 dasm_put(Dst
, 1524);
8291 dasm_put(Dst
, 1528, 31-3);
8293 dasm_put(Dst
, 1533, 31-3);
8295 dasm_put(Dst
, 1537, LJ_TNIL
, (0+1)*8, (2+1)*8, Dt6(->hmask
), (0+1)*8, (0+1)*8, LJ_TTAB
);
8296 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8297 dasm_put(Dst
, 1585, Dt6(->metatable
), Dt8(->upvalue
[0]));
8299 dasm_put(Dst
, 1594, Dt8(->upvalue
[0]));
8302 dasm_put(Dst
, 1598);
8304 dasm_put(Dst
, 1600);
8306 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
));
8307 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
));
8308 dasm_put(Dst
, 1724, Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, LJ_TTRUE
, FRAME_TYPE
, LJ_TFALSE
, Dt1(->top
), (2+1)*8, 32-3);
8309 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
);
8310 dasm_put(Dst
, 1846, Dt1(->base
), DISPATCH_GL(vmstate
), Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, 32-3, Dt1(->cframe
));
8311 dasm_put(Dst
, 1903, Dt1(->base
), CFRAME_RESUME
, Dt1(->top
), LUA_YIELD
, Dt1(->cframe
), Dt1(->status
));
8313 dasm_put(Dst
, 1928);
8315 dasm_put(Dst
, 1949, (1+1)*8, FRAME_TYPE
);
8317 dasm_put(Dst
, 1991, 31-11, 32-21, 31-11);
8318 dasm_put(Dst
, 2073, 31-11, 32-21, 31-11);
8320 dasm_put(Dst
, 2127);
8322 dasm_put(Dst
, 2154);
8323 dasm_put(Dst
, 2213);
8324 dasm_put(Dst
, 2271);
8325 dasm_put(Dst
, 2327, Dt8(->upvalue
[0]));
8326 dasm_put(Dst
, 2393);
8328 dasm_put(Dst
, 2397);
8330 dasm_put(Dst
, 2412);
8332 dasm_put(Dst
, 2430, DISPATCH_GL(tmptv
), DISPATCH_GL(tmptv
));
8334 dasm_put(Dst
, 2452);
8336 dasm_put(Dst
, 2457, (2+1)*8);
8338 dasm_put(Dst
, 2461);
8340 dasm_put(Dst
, 2464);
8342 dasm_put(Dst
, 2466, (2+1)*8);
8344 dasm_put(Dst
, 2488);
8346 dasm_put(Dst
, 2557);
8349 dasm_put(Dst
, 2582);
8351 dasm_put(Dst
, 2651);
8353 dasm_put(Dst
, 2676, LJ_TSTR
, Dt5(->len
), LJ_TSTR
, Dt5(->len
));
8355 dasm_put(Dst
, 2703, Dt5([1]), (0+1)*8);
8357 dasm_put(Dst
, 2715, Dt5([1]), 31-3);
8359 dasm_put(Dst
, 2731, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8361 dasm_put(Dst
, 2742);
8363 dasm_put(Dst
, 2750);
8365 dasm_put(Dst
, 2761, Dt1(->base
), Dt1(->base
), LJ_TSTR
, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8367 dasm_put(Dst
, 2789);
8369 dasm_put(Dst
, 2791);
8371 dasm_put(Dst
, 2797);
8373 dasm_put(Dst
, 2799);
8375 dasm_put(Dst
, 2801);
8377 dasm_put(Dst
, 2805);
8379 dasm_put(Dst
, 2814);
8381 dasm_put(Dst
, 2825, LJ_TSTR
);
8383 dasm_put(Dst
, 2830);
8385 dasm_put(Dst
, 2834, Dt5(->len
), sizeof(GCstr
)-1, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8387 dasm_put(Dst
, 2884);
8389 dasm_put(Dst
, 2886);
8391 dasm_put(Dst
, 2888, LJ_TSTR
);
8393 dasm_put(Dst
, 2895);
8395 dasm_put(Dst
, 2899);
8397 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
));
8398 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
));
8399 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
);
8401 dasm_put(Dst
, 3086);
8403 dasm_put(Dst
, 3096);
8405 dasm_put(Dst
, 3109);
8407 dasm_put(Dst
, 3115);
8409 dasm_put(Dst
, 3117);
8411 dasm_put(Dst
, 3119);
8413 dasm_put(Dst
, 3123);
8415 dasm_put(Dst
, 3126);
8417 dasm_put(Dst
, 3132);
8419 dasm_put(Dst
, 3137);
8421 dasm_put(Dst
, 3147);
8423 dasm_put(Dst
, 3160);
8425 dasm_put(Dst
, 3166);
8427 dasm_put(Dst
, 3168);
8429 dasm_put(Dst
, 3170);
8431 dasm_put(Dst
, 3174);
8433 dasm_put(Dst
, 3177);
8435 dasm_put(Dst
, 3183);
8437 dasm_put(Dst
, 3188);
8439 dasm_put(Dst
, 3198);
8441 dasm_put(Dst
, 3211);
8443 dasm_put(Dst
, 3217);
8445 dasm_put(Dst
, 3219);
8447 dasm_put(Dst
, 3221);
8449 dasm_put(Dst
, 3225);
8451 dasm_put(Dst
, 3228);
8453 dasm_put(Dst
, 3234);
8455 dasm_put(Dst
, 3239);
8457 dasm_put(Dst
, 3249);
8459 dasm_put(Dst
, 3262);
8461 dasm_put(Dst
, 3269);
8463 dasm_put(Dst
, 3279);
8465 dasm_put(Dst
, 3292);
8467 dasm_put(Dst
, 3296);
8469 dasm_put(Dst
, 3311);
8471 dasm_put(Dst
, 3332);
8473 dasm_put(Dst
, 3337);
8475 dasm_put(Dst
, 3352);
8477 dasm_put(Dst
, 3373);
8479 dasm_put(Dst
, 3378);
8481 dasm_put(Dst
, 3393);
8483 dasm_put(Dst
, 3414);
8485 dasm_put(Dst
, 3419);
8487 dasm_put(Dst
, 3434);
8489 dasm_put(Dst
, 3455);
8491 dasm_put(Dst
, 3459);
8493 dasm_put(Dst
, 3474);
8495 dasm_put(Dst
, 3495);
8497 dasm_put(Dst
, 3500);
8499 dasm_put(Dst
, 3510);
8502 dasm_put(Dst
, 3523);
8504 dasm_put(Dst
, 3526);
8506 dasm_put(Dst
, 3532);
8508 dasm_put(Dst
, 3540);
8510 dasm_put(Dst
, 3548);
8512 dasm_put(Dst
, 3550);
8514 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
);
8515 dasm_put(Dst
, 3621, Dt1(->base
), Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
8517 dasm_put(Dst
, 3647, DISPATCH_GL(hookmask
), HOOK_VMEVENT
, DISPATCH_GL(hookcount
), HOOK_ACTIVE
, LUA_MASKLINE
|LUA_MASKCOUNT
, DISPATCH_GL(hookcount
));
8519 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
));
8520 dasm_put(Dst
, 3716, GG_DISP2STATIC
);
8522 dasm_put(Dst
, 3734, GG_DISP2J
, Dt7(->pc
), DISPATCH_J(L
), PC2PROTO(framesize
), Dt1(->base
), 31-3, Dt1(->top
));
8524 dasm_put(Dst
, 3757);
8526 dasm_put(Dst
, 3760);
8528 dasm_put(Dst
, 3763);
8530 dasm_put(Dst
, 3765);
8532 dasm_put(Dst
, 3768, Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
8534 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);
8535 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);
8536 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
));
8538 dasm_put(Dst
, 3915);
8540 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);
8542 dasm_put(Dst
, 3974);
8544 dasm_put(Dst
, 3982);
8546 dasm_put(Dst
, 3985);
8548 dasm_put(Dst
, 4065);
8550 dasm_put(Dst
, 4087);
8552 dasm_put(Dst
, 4089);
8554 #define DtE(_V) (int)(ptrdiff_t)&(((CTState *)0)_V)
8555 dasm_put(Dst
, 4113, 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);
8556 dasm_put(Dst
, 4161, 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]));
8557 dasm_put(Dst
, 4208, 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
));
8559 dasm_put(Dst
, 4272);
8561 dasm_put(Dst
, 4274, DISPATCH_GL(ctype_state
), Dt1(->base
), Dt1(->top
), DtE(->L
), DtE(->cb
.gpr
[0]), DtE(->cb
.fpr
[0]), DtE(->cb
.gpr
[1]));
8563 dasm_put(Dst
, 4295);
8565 #define DtF(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
8566 dasm_put(Dst
, 4297, 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]));
8567 dasm_put(Dst
, 4354, 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]));
8571 /* Generate the code for a single instruction. */
8572 static void build_ins(BuildCtx
*ctx
, BCOp op
, int defop
)
8575 dasm_put(Dst
, 4386, defop
);
8579 /* -- Comparison ops ---------------------------------------------------- */
8581 /* Remember: all ops branch for a true comparison, fall through otherwise. */
8583 case BC_ISLT
: case BC_ISGE
: case BC_ISLE
: case BC_ISGT
:
8585 dasm_put(Dst
, 4388, -(BCBIAS_J
*4 >> 16));
8586 if (op
== BC_ISLT
) {
8587 dasm_put(Dst
, 4405);
8588 } else if (op
== BC_ISGE
) {
8589 dasm_put(Dst
, 4408);
8590 } else if (op
== BC_ISLE
) {
8591 dasm_put(Dst
, 4411);
8593 dasm_put(Dst
, 4414);
8595 dasm_put(Dst
, 4417);
8596 if (op
== BC_ISLT
) {
8597 dasm_put(Dst
, 4456);
8598 } else if (op
== BC_ISGE
) {
8599 dasm_put(Dst
, 4459);
8600 } else if (op
== BC_ISLE
) {
8601 dasm_put(Dst
, 4462);
8603 dasm_put(Dst
, 4466);
8605 dasm_put(Dst
, 4470);
8607 dasm_put(Dst
, 4473, -(BCBIAS_J
*4 >> 16));
8608 if (op
== BC_ISLT
) {
8609 dasm_put(Dst
, 4490);
8610 } else if (op
== BC_ISGE
) {
8611 dasm_put(Dst
, 4493);
8612 } else if (op
== BC_ISLE
) {
8613 dasm_put(Dst
, 4496);
8615 dasm_put(Dst
, 4500);
8617 dasm_put(Dst
, 4504);
8621 case BC_ISEQV
: case BC_ISNEV
:
8622 vk
= op
== BC_ISEQV
;
8624 dasm_put(Dst
, 4517, -(BCBIAS_J
*4 >> 16));
8626 dasm_put(Dst
, 4530);
8628 dasm_put(Dst
, 4533);
8631 dasm_put(Dst
, 4536, -(BCBIAS_J
*4 >> 16));
8633 dasm_put(Dst
, 4553);
8635 dasm_put(Dst
, 4557);
8637 dasm_put(Dst
, 4561);
8639 dasm_put(Dst
, 4573);
8641 dasm_put(Dst
, 4575);
8644 dasm_put(Dst
, 4578, LJ_TCDATA
, LJ_TCDATA
);
8646 dasm_put(Dst
, 4583, ~LJ_TISPRI
);
8648 dasm_put(Dst
, 4588);
8650 dasm_put(Dst
, 4590, ~LJ_TISTABUD
);
8652 dasm_put(Dst
, 4593);
8654 dasm_put(Dst
, 4596);
8656 dasm_put(Dst
, 4604);
8658 dasm_put(Dst
, 4609);
8661 dasm_put(Dst
, 4614);
8663 dasm_put(Dst
, 4629);
8665 dasm_put(Dst
, 4632, Dt6(->metatable
), 1-vk
, Dt6(->nomm
), 1<<MM_eq
);
8668 case BC_ISEQS
: case BC_ISNES
:
8669 vk
= op
== BC_ISEQS
;
8670 dasm_put(Dst
, 4651, 32-1);
8672 dasm_put(Dst
, 4659, LJ_TCDATA
);
8674 dasm_put(Dst
, 4662, LJ_TSTR
);
8676 dasm_put(Dst
, 4666);
8678 dasm_put(Dst
, 4669, -(BCBIAS_J
*4 >> 16));
8680 dasm_put(Dst
, 4677);
8682 dasm_put(Dst
, 4679);
8684 dasm_put(Dst
, 4681);
8687 case BC_ISEQN
: case BC_ISNEN
:
8688 vk
= op
== BC_ISEQN
;
8690 dasm_put(Dst
, 4693, -(BCBIAS_J
*4 >> 16));
8692 dasm_put(Dst
, 4705);
8694 dasm_put(Dst
, 4707);
8696 dasm_put(Dst
, 4709);
8699 dasm_put(Dst
, 4716);
8701 dasm_put(Dst
, 4718);
8703 dasm_put(Dst
, 4720, -(BCBIAS_J
*4 >> 16));
8706 dasm_put(Dst
, 4733);
8708 dasm_put(Dst
, 4738);
8711 dasm_put(Dst
, 4740);
8713 dasm_put(Dst
, 4744);
8715 dasm_put(Dst
, 4746);
8717 dasm_put(Dst
, 4749);
8719 dasm_put(Dst
, 4760, LJ_TCDATA
);
8722 dasm_put(Dst
, 4768);
8726 case BC_ISEQP
: case BC_ISNEP
:
8727 vk
= op
== BC_ISEQP
;
8728 dasm_put(Dst
, 4792, 32-3);
8730 dasm_put(Dst
, 4799, LJ_TCDATA
);
8732 dasm_put(Dst
, 4802);
8734 dasm_put(Dst
, 4804);
8736 dasm_put(Dst
, 4807, -(BCBIAS_J
*4 >> 16));
8738 dasm_put(Dst
, 4813);
8740 dasm_put(Dst
, 4815);
8742 dasm_put(Dst
, 4817);
8745 /* -- Unary test and copy ops ------------------------------------------- */
8747 case BC_ISTC
: case BC_ISFC
: case BC_IST
: case BC_ISF
:
8748 dasm_put(Dst
, 4829);
8749 if (op
== BC_IST
|| op
== BC_ISF
) {
8750 dasm_put(Dst
, 4833, LJ_TTRUE
, -(BCBIAS_J
*4 >> 16));
8752 dasm_put(Dst
, 4840);
8754 dasm_put(Dst
, 4842);
8756 dasm_put(Dst
, 4844);
8758 dasm_put(Dst
, 4846, LJ_TFALSE
);
8759 if (op
== BC_ISTC
) {
8760 dasm_put(Dst
, 4851);
8762 dasm_put(Dst
, 4854);
8764 dasm_put(Dst
, 4857, -(BCBIAS_J
*4 >> 16));
8766 dasm_put(Dst
, 4864);
8769 /* -- Unary ops --------------------------------------------------------- */
8772 dasm_put(Dst
, 4875);
8775 dasm_put(Dst
, 4888, LJ_TTRUE
);
8778 dasm_put(Dst
, 4904);
8780 dasm_put(Dst
, 4908);
8782 dasm_put(Dst
, 4936);
8784 dasm_put(Dst
, 4946);
8786 dasm_put(Dst
, 4949);
8790 dasm_put(Dst
, 4958, LJ_TSTR
, Dt5(->len
));
8792 dasm_put(Dst
, 4968);
8794 dasm_put(Dst
, 4973);
8796 dasm_put(Dst
, 4980, LJ_TTAB
);
8797 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8798 dasm_put(Dst
, 4994, Dt6(->metatable
));
8800 dasm_put(Dst
, 5001);
8801 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8802 dasm_put(Dst
, 5007, Dt6(->nomm
), 1<<MM_len
);
8806 /* -- Binary ops -------------------------------------------------------- */
8809 case BC_ADDVN
: case BC_ADDNV
: case BC_ADDVV
:
8811 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8814 dasm_put(Dst
, 5017);
8817 dasm_put(Dst
, 5023);
8820 dasm_put(Dst
, 5029);
8823 dasm_put(Dst
, 5035);
8826 dasm_put(Dst
, 5062);
8829 dasm_put(Dst
, 5065);
8832 dasm_put(Dst
, 5068);
8835 dasm_put(Dst
, 5071);
8837 dasm_put(Dst
, 5073);
8839 dasm_put(Dst
, 5077);
8843 dasm_put(Dst
, 5081);
8846 dasm_put(Dst
, 5084);
8849 dasm_put(Dst
, 5087);
8852 dasm_put(Dst
, 5090);
8854 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8857 dasm_put(Dst
, 5097);
8859 dasm_put(Dst
, 5099);
8861 dasm_put(Dst
, 5101);
8863 dasm_put(Dst
, 5104);
8865 dasm_put(Dst
, 5110);
8869 dasm_put(Dst
, 5114);
8871 dasm_put(Dst
, 5116);
8873 dasm_put(Dst
, 5118);
8875 dasm_put(Dst
, 5121);
8877 dasm_put(Dst
, 5127);
8881 dasm_put(Dst
, 5131);
8884 dasm_put(Dst
, 5141);
8887 case BC_SUBVN
: case BC_SUBNV
: case BC_SUBVV
:
8889 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8892 dasm_put(Dst
, 5154);
8895 dasm_put(Dst
, 5160);
8898 dasm_put(Dst
, 5166);
8901 dasm_put(Dst
, 5172);
8904 dasm_put(Dst
, 5199);
8907 dasm_put(Dst
, 5202);
8910 dasm_put(Dst
, 5205);
8913 dasm_put(Dst
, 5208);
8915 dasm_put(Dst
, 5210);
8917 dasm_put(Dst
, 5214);
8921 dasm_put(Dst
, 5218);
8924 dasm_put(Dst
, 5221);
8927 dasm_put(Dst
, 5224);
8930 dasm_put(Dst
, 5227);
8932 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8935 dasm_put(Dst
, 5234);
8937 dasm_put(Dst
, 5236);
8939 dasm_put(Dst
, 5238);
8941 dasm_put(Dst
, 5241);
8943 dasm_put(Dst
, 5247);
8947 dasm_put(Dst
, 5251);
8949 dasm_put(Dst
, 5253);
8951 dasm_put(Dst
, 5255);
8953 dasm_put(Dst
, 5258);
8955 dasm_put(Dst
, 5264);
8959 dasm_put(Dst
, 5268);
8962 dasm_put(Dst
, 5278);
8965 case BC_MULVN
: case BC_MULNV
: case BC_MULVV
:
8967 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8970 dasm_put(Dst
, 5291);
8973 dasm_put(Dst
, 5297);
8976 dasm_put(Dst
, 5303);
8979 dasm_put(Dst
, 5309);
8982 dasm_put(Dst
, 5336);
8985 dasm_put(Dst
, 5339);
8988 dasm_put(Dst
, 5342);
8991 dasm_put(Dst
, 5345);
8993 dasm_put(Dst
, 5347);
8995 dasm_put(Dst
, 5351);
8999 dasm_put(Dst
, 5355);
9002 dasm_put(Dst
, 5358);
9005 dasm_put(Dst
, 5361);
9008 dasm_put(Dst
, 5364);
9010 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9013 dasm_put(Dst
, 5371);
9015 dasm_put(Dst
, 5373);
9017 dasm_put(Dst
, 5375);
9019 dasm_put(Dst
, 5378);
9021 dasm_put(Dst
, 5384);
9025 dasm_put(Dst
, 5388);
9027 dasm_put(Dst
, 5390);
9029 dasm_put(Dst
, 5392);
9031 dasm_put(Dst
, 5395);
9033 dasm_put(Dst
, 5401);
9037 dasm_put(Dst
, 5405);
9040 dasm_put(Dst
, 5415);
9043 case BC_DIVVN
: case BC_DIVNV
: case BC_DIVVV
:
9044 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9047 dasm_put(Dst
, 5428);
9049 dasm_put(Dst
, 5430);
9051 dasm_put(Dst
, 5432);
9053 dasm_put(Dst
, 5435);
9055 dasm_put(Dst
, 5441);
9059 dasm_put(Dst
, 5445);
9061 dasm_put(Dst
, 5447);
9063 dasm_put(Dst
, 5449);
9065 dasm_put(Dst
, 5452);
9067 dasm_put(Dst
, 5458);
9071 dasm_put(Dst
, 5462);
9074 dasm_put(Dst
, 5472);
9078 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9081 dasm_put(Dst
, 5485);
9084 dasm_put(Dst
, 5491);
9087 dasm_put(Dst
, 5497);
9090 dasm_put(Dst
, 5503);
9093 dasm_put(Dst
, 5531);
9096 dasm_put(Dst
, 5534);
9099 dasm_put(Dst
, 5537);
9102 dasm_put(Dst
, 5540);
9104 dasm_put(Dst
, 5542);
9106 dasm_put(Dst
, 5546);
9110 dasm_put(Dst
, 5550);
9113 dasm_put(Dst
, 5553);
9116 dasm_put(Dst
, 5556);
9119 dasm_put(Dst
, 5559);
9121 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9124 dasm_put(Dst
, 5571);
9126 dasm_put(Dst
, 5573);
9128 dasm_put(Dst
, 5575);
9130 dasm_put(Dst
, 5578);
9132 dasm_put(Dst
, 5584);
9136 dasm_put(Dst
, 5588);
9138 dasm_put(Dst
, 5590);
9140 dasm_put(Dst
, 5592);
9142 dasm_put(Dst
, 5595);
9144 dasm_put(Dst
, 5601);
9148 dasm_put(Dst
, 5605);
9151 dasm_put(Dst
, 5615);
9154 case BC_MODNV
: case BC_MODVV
:
9156 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9159 dasm_put(Dst
, 5633);
9162 dasm_put(Dst
, 5639);
9165 dasm_put(Dst
, 5645);
9168 dasm_put(Dst
, 5651);
9171 dasm_put(Dst
, 5679);
9174 dasm_put(Dst
, 5682);
9177 dasm_put(Dst
, 5685);
9180 dasm_put(Dst
, 5688);
9182 dasm_put(Dst
, 5690);
9184 dasm_put(Dst
, 5694);
9188 dasm_put(Dst
, 5698);
9191 dasm_put(Dst
, 5701);
9194 dasm_put(Dst
, 5704);
9197 dasm_put(Dst
, 5707);
9199 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
9202 dasm_put(Dst
, 5710);
9204 dasm_put(Dst
, 5712);
9206 dasm_put(Dst
, 5714);
9208 dasm_put(Dst
, 5717);
9210 dasm_put(Dst
, 5723);
9214 dasm_put(Dst
, 5727);
9216 dasm_put(Dst
, 5729);
9218 dasm_put(Dst
, 5731);
9220 dasm_put(Dst
, 5734);
9222 dasm_put(Dst
, 5740);
9226 dasm_put(Dst
, 5744);
9229 dasm_put(Dst
, 5754);
9233 dasm_put(Dst
, 5757);
9237 dasm_put(Dst
, 5780, Dt1(->base
), 32-3, Dt1(->base
));
9240 /* -- Constant ops ------------------------------------------------------ */
9243 dasm_put(Dst
, 5810, 32-1, LJ_TSTR
);
9247 dasm_put(Dst
, 5829, 32-1, LJ_TCDATA
);
9252 dasm_put(Dst
, 5848, 31-13);
9254 dasm_put(Dst
, 5864, 31-13, 31-20);
9258 dasm_put(Dst
, 5892);
9261 dasm_put(Dst
, 5905, 32-3);
9264 dasm_put(Dst
, 5920);
9267 /* -- Upvalue and function ops ------------------------------------------ */
9270 dasm_put(Dst
, 5939, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9273 dasm_put(Dst
, 5960, 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
);
9276 dasm_put(Dst
, 6013, 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
);
9279 dasm_put(Dst
, 6064, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9282 dasm_put(Dst
, 6085, 32-1, 32-3, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9286 dasm_put(Dst
, 6108, Dt1(->openupval
), 32-1, -(BCBIAS_J
*4 >> 16), Dt1(->base
), Dt1(->base
));
9290 dasm_put(Dst
, 6138, 32-1, Dt1(->base
), Dt1(->base
), LJ_TFUNC
);
9293 /* -- Table ops --------------------------------------------------------- */
9297 dasm_put(Dst
, 6166, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), Dt1(->base
));
9298 if (op
== BC_TNEW
) {
9299 dasm_put(Dst
, 6179);
9301 dasm_put(Dst
, 6188, 32-1);
9303 dasm_put(Dst
, 6195, Dt1(->base
), LJ_TTAB
);
9304 if (op
== BC_TNEW
) {
9305 dasm_put(Dst
, 6212);
9307 dasm_put(Dst
, 6217);
9312 dasm_put(Dst
, 6226, 32-1, Dt7(->env
));
9313 if (op
== BC_GGET
) {
9314 dasm_put(Dst
, 6234);
9316 dasm_put(Dst
, 6237);
9321 dasm_put(Dst
, 6240);
9323 dasm_put(Dst
, 6244);
9325 dasm_put(Dst
, 6246);
9327 dasm_put(Dst
, 6248, LJ_TTAB
);
9329 dasm_put(Dst
, 6254, Dt6(->asize
), Dt6(->array
), 31-3);
9331 dasm_put(Dst
, 6264, Dt6(->asize
), Dt6(->array
), 31-3);
9333 dasm_put(Dst
, 6281, LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
, LJ_TSTR
);
9335 dasm_put(Dst
, 6321);
9337 dasm_put(Dst
, 6323);
9340 dasm_put(Dst
, 6326, 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
));
9341 dasm_put(Dst
, 6387, LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
9344 dasm_put(Dst
, 6407, 32-3, LJ_TTAB
, Dt6(->asize
), Dt6(->array
), LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
9348 dasm_put(Dst
, 6455);
9350 dasm_put(Dst
, 6459);
9352 dasm_put(Dst
, 6461);
9354 dasm_put(Dst
, 6463, LJ_TTAB
);
9356 dasm_put(Dst
, 6469, Dt6(->asize
), Dt6(->array
), 31-3);
9358 dasm_put(Dst
, 6479, Dt6(->asize
), Dt6(->array
), 31-3);
9360 dasm_put(Dst
, 6496, Dt6(->marked
), LJ_TNIL
, LJ_GC_BLACK
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, LJ_TSTR
);
9362 dasm_put(Dst
, 6543);
9364 dasm_put(Dst
, 6545, DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9367 dasm_put(Dst
, 6560, 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
);
9368 dasm_put(Dst
, 6611, 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
);
9369 dasm_put(Dst
, 6668, Dt1(->base
), DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9372 dasm_put(Dst
, 6691, 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
));
9373 dasm_put(Dst
, 6749, DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9377 dasm_put(Dst
, 6759, 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
));
9378 dasm_put(Dst
, 6828);
9381 /* -- Calls and vararg handling ----------------------------------------- */
9384 dasm_put(Dst
, 6831);
9387 dasm_put(Dst
, 6833, LJ_TFUNC
, Dt7(->pc
));
9391 dasm_put(Dst
, 6854);
9394 dasm_put(Dst
, 6856, LJ_TFUNC
, FRAME_TYPE
, Dt7(->ffid
), FRAME_VARG
, Dt7(->pc
), -4-8, Dt7(->pc
), PC2PROTO(k
), FRAME_TYPEP
);
9395 dasm_put(Dst
, 6920, FRAME_TYPE
);
9399 dasm_put(Dst
, 6929, LJ_TFUNC
, Dt7(->pc
));
9405 dasm_put(Dst
, 6956, Dt6(->asize
), Dt6(->array
), 31-3, LJ_TNIL
);
9407 dasm_put(Dst
, 6978);
9409 dasm_put(Dst
, 6981);
9411 dasm_put(Dst
, 6985, -(BCBIAS_J
*4 >> 16));
9413 dasm_put(Dst
, 6993);
9415 dasm_put(Dst
, 6995, Dt6(->hmask
), Dt6(->node
), 31-5, 31-3, LJ_TNIL
, DtB(->key
), -(BCBIAS_J
*4 >> 16));
9419 dasm_put(Dst
, 7051, 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));
9423 dasm_put(Dst
, 7101, FRAME_VARG
, Dt1(->maxstack
), Dt1(->top
), Dt1(->base
), 32-3, Dt1(->base
));
9424 dasm_put(Dst
, 7181);
9427 /* -- Returns ----------------------------------------------------------- */
9430 dasm_put(Dst
, 7187);
9434 dasm_put(Dst
, 7189, FRAME_TYPE
, FRAME_VARG
, Dt7(->pc
), PC2PROTO(k
), FRAME_TYPEP
);
9437 case BC_RET0
: case BC_RET1
:
9438 dasm_put(Dst
, 7259, FRAME_TYPE
, FRAME_VARG
);
9439 if (op
== BC_RET1
) {
9440 dasm_put(Dst
, 7272);
9442 dasm_put(Dst
, 7275, Dt7(->pc
), PC2PROTO(k
));
9445 /* -- Loops and branches ------------------------------------------------ */
9449 dasm_put(Dst
, 7303, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9460 vk
= (op
== BC_IFORL
|| op
== BC_JFORL
);
9462 dasm_put(Dst
, 7313, FORL_IDX
*8+4);
9464 dasm_put(Dst
, 7318, FORL_STEP
*8+4, FORL_STOP
*8+4, FORL_IDX
*8+4);
9466 dasm_put(Dst
, 7332, FORL_STEP
*8, FORL_STEP
*8+4, FORL_STOP
*8, FORL_STOP
*8+4);
9468 dasm_put(Dst
, 7348, FORL_EXT
*8);
9469 if (op
!= BC_JFORL
) {
9470 dasm_put(Dst
, 7355, 32-1);
9472 dasm_put(Dst
, 7358, FORL_EXT
*8+4);
9473 if (op
!= BC_JFORL
) {
9474 dasm_put(Dst
, 7361);
9476 if (op
== BC_FORI
) {
9477 dasm_put(Dst
, 7363);
9478 } else if (op
== BC_JFORI
) {
9479 dasm_put(Dst
, 7366, -(BCBIAS_J
*4 >> 16));
9480 } else if (op
== BC_IFORL
) {
9481 dasm_put(Dst
, 7371, -(BCBIAS_J
*4 >> 16));
9483 dasm_put(Dst
, 7376, BC_JLOOP
);
9485 dasm_put(Dst
, 7379);
9487 dasm_put(Dst
, 7395);
9492 dasm_put(Dst
, 7402, FORL_IDX
*8);
9494 dasm_put(Dst
, 7406);
9496 dasm_put(Dst
, 7408, FORL_STEP
*8, FORL_STOP
*8, FORL_STEP
*8, FORL_IDX
*8);
9499 dasm_put(Dst
, 7418);
9501 dasm_put(Dst
, 7420, FORL_STEP
*8, FORL_STOP
*8);
9503 dasm_put(Dst
, 7429, FORL_IDX
*8, FORL_STOP
*8);
9505 dasm_put(Dst
, 7438);
9506 if (op
!= BC_JFORL
) {
9507 dasm_put(Dst
, 7440, 32-1);
9509 dasm_put(Dst
, 7443, FORL_EXT
*8);
9510 if (op
!= BC_JFORL
) {
9511 dasm_put(Dst
, 7446);
9513 dasm_put(Dst
, 7448);
9514 if (op
== BC_JFORI
) {
9515 dasm_put(Dst
, 7450, -(BCBIAS_J
*4 >> 16));
9517 dasm_put(Dst
, 7453);
9518 if (op
== BC_FORI
) {
9519 dasm_put(Dst
, 7456);
9520 } else if (op
== BC_IFORL
) {
9522 dasm_put(Dst
, 7459);
9524 dasm_put(Dst
, 7462);
9526 dasm_put(Dst
, 7465, -(BCBIAS_J
*4 >> 16));
9527 } else if (op
== BC_JFORI
) {
9528 dasm_put(Dst
, 7469);
9530 dasm_put(Dst
, 7472, BC_JLOOP
);
9533 dasm_put(Dst
, 7475);
9535 dasm_put(Dst
, 7478);
9537 dasm_put(Dst
, 7490);
9538 if (op
== BC_FORI
) {
9539 dasm_put(Dst
, 7492, -(BCBIAS_J
*4 >> 16));
9540 } else if (op
== BC_IFORL
) {
9541 dasm_put(Dst
, 7498);
9542 } else if (op
== BC_JFORI
) {
9543 dasm_put(Dst
, 7501);
9545 dasm_put(Dst
, 7504, BC_JLOOP
);
9547 dasm_put(Dst
, 7507);
9548 if (op
== BC_JFORI
) {
9549 dasm_put(Dst
, 7510, BC_JLOOP
);
9555 dasm_put(Dst
, 7516, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9564 dasm_put(Dst
, 7526, LJ_TNIL
);
9565 if (op
== BC_JITERL
) {
9566 dasm_put(Dst
, 7533, BC_JLOOP
);
9568 dasm_put(Dst
, 7538, 32-1, -(BCBIAS_J
*4 >> 16));
9570 dasm_put(Dst
, 7546);
9575 dasm_put(Dst
, 7558, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9580 dasm_put(Dst
, 7568);
9585 dasm_put(Dst
, 7579, DISPATCH_J(trace
), 32-1, DISPATCH_GL(vmstate
), DtD(->mcode
), DISPATCH_GL(jit_base
), DISPATCH_GL(jit_L
), GG_DISP2G
+32768);
9590 dasm_put(Dst
, 7598, 32-1, -(BCBIAS_J
*4 >> 16));
9593 /* -- Function headers -------------------------------------------------- */
9597 dasm_put(Dst
, 7614, GG_DISP2HOT
, -HOTCOUNT_CALL
);
9599 case BC_FUNCV
: /* NYI: compiled vararg functions. */
9607 dasm_put(Dst
, 7624, Dt1(->maxstack
), -4+PC2PROTO(numparams
), -4+PC2PROTO(k
), 31-3);
9608 if (op
!= BC_JFUNCF
) {
9609 dasm_put(Dst
, 7636);
9611 dasm_put(Dst
, 7639);
9612 if (op
== BC_JFUNCF
) {
9613 dasm_put(Dst
, 7644, BC_JLOOP
);
9615 dasm_put(Dst
, 7648);
9617 dasm_put(Dst
, 7657);
9624 dasm_put(Dst
, 7663);
9625 break; /* NYI: compiled vararg functions. */
9628 dasm_put(Dst
, 7665, Dt1(->maxstack
), 8+FRAME_VARG
, -4+PC2PROTO(k
), -4+PC2PROTO(numparams
), LJ_TNIL
);
9633 if (op
== BC_FUNCC
) {
9634 dasm_put(Dst
, 7718, Dt8(->f
));
9636 dasm_put(Dst
, 7721, DISPATCH_GL(wrapf
));
9638 dasm_put(Dst
, 7724, Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), ~LJ_VMST_C
);
9639 if (op
== BC_FUNCCW
) {
9640 dasm_put(Dst
, 7737, Dt8(->f
));
9642 dasm_put(Dst
, 7740, DISPATCH_GL(vmstate
), Dt1(->base
), 31-3, Dt1(->top
), ~LJ_VMST_INTERP
, DISPATCH_GL(vmstate
));
9645 /* ---------------------------------------------------------------------- */
9648 fprintf(stderr
, "Error: undefined opcode BC_%s\n", bc_names
[op
]);
9654 static int build_backend(BuildCtx
*ctx
)
9658 dasm_growpc(Dst
, BC__MAX
);
9660 build_subroutines(ctx
);
9662 dasm_put(Dst
, 7761);
9663 for (op
= 0; op
< BC__MAX
; op
++)
9664 build_ins(ctx
, (BCOp
)op
, op
);
9669 /* Emit pseudo frame-info for all assembler functions. */
9670 static void emit_asm_debug(BuildCtx
*ctx
)
9672 int fcofs
= (int)((uint8_t *)ctx
->glob
[GLOB_vm_ffi_call
] - ctx
->code
);
9674 switch (ctx
->mode
) {
9676 fprintf(ctx
->fp
, "\t.section .debug_frame,\"\",@progbits\n");
9679 "\t.long .LECIE0-.LSCIE0\n"
9681 "\t.long 0xffffffff\n"
9687 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9692 "\t.long .LEFDE0-.LASFDE0\n"
9694 "\t.long .Lframe0\n"
9697 "\t.byte 0xe\n\t.uleb128 %d\n"
9698 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9699 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
9700 fcofs
, CFRAME_SIZE
);
9701 for (i
= 14; i
<= 31; i
++)
9703 "\t.byte %d\n\t.uleb128 %d\n"
9704 "\t.byte %d\n\t.uleb128 %d\n",
9705 0x80+i
, 37+(31-i
), 0x80+32+i
, 2+2*(31-i
));
9712 "\t.long .LEFDE1-.LASFDE1\n"
9714 "\t.long .Lframe0\n"
9715 "\t.long lj_vm_ffi_call\n"
9717 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9718 "\t.byte 0x8e\n\t.uleb128 2\n"
9719 "\t.byte 0xd\n\t.uleb128 0xe\n"
9721 ".LEFDE1:\n\n", (int)ctx
->codesz
- fcofs
);
9723 fprintf(ctx
->fp
, "\t.section .eh_frame,\"a\",@progbits\n");
9726 "\t.long .LECIE1-.LSCIE1\n"
9730 "\t.string \"zPR\"\n"
9734 "\t.uleb128 6\n" /* augmentation length */
9735 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9736 "\t.long lj_err_unwind_dwarf-.\n"
9737 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9738 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9743 "\t.long .LEFDE2-.LASFDE2\n"
9745 "\t.long .LASFDE2-.Lframe1\n"
9746 "\t.long .Lbegin-.\n"
9748 "\t.uleb128 0\n" /* augmentation length */
9749 "\t.byte 0xe\n\t.uleb128 %d\n"
9750 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9751 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
9752 fcofs
, CFRAME_SIZE
);
9753 for (i
= 14; i
<= 31; i
++)
9755 "\t.byte %d\n\t.uleb128 %d\n"
9756 "\t.byte %d\n\t.uleb128 %d\n",
9757 0x80+i
, 37+(31-i
), 0x80+32+i
, 2+2*(31-i
));
9764 "\t.long .LECIE2-.LSCIE2\n"
9768 "\t.string \"zR\"\n"
9772 "\t.uleb128 1\n" /* augmentation length */
9773 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9774 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9779 "\t.long .LEFDE3-.LASFDE3\n"
9781 "\t.long .LASFDE3-.Lframe2\n"
9782 "\t.long lj_vm_ffi_call-.\n"
9784 "\t.uleb128 0\n" /* augmentation length */
9785 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9786 "\t.byte 0x8e\n\t.uleb128 2\n"
9787 "\t.byte 0xd\n\t.uleb128 0xe\n"
9789 ".LEFDE3:\n\n", (int)ctx
->codesz
- fcofs
);