2 ** This file has been pre-processed with DynASM.
3 ** http://luajit.org/dynasm.html
4 ** DynASM version 1.3.0, DynASM arm version 1.3.0
5 ** DO NOT EDIT! The original file is in "buildvm_arm.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
[5777] = {
5804 GLOB_vm_unwind_c_eh
,
5806 GLOB_vm_unwind_ff_eh
,
5807 GLOB_vm_growstack_c
,
5808 GLOB_vm_growstack_l
,
5812 GLOB_vm_call_dispatch
,
5814 GLOB_vm_call_dispatch_f
,
5816 GLOB_cont_ffi_callback
,
5835 GLOB_vmeta_equal_cd
,
5836 GLOB_vmeta_arith_vn
,
5837 GLOB_vmeta_arith_nv
,
5839 GLOB_vmeta_arith_vv
,
5850 GLOB_ff_getmetatable
,
5851 GLOB_ff_setmetatable
,
5862 GLOB_ff_coroutine_resume
,
5863 GLOB_ff_coroutine_wrap_aux
,
5864 GLOB_ff_coroutine_yield
,
5895 GLOB_ff_string_byte
,
5896 GLOB_ff_string_char
,
5901 GLOB_ff_string_reverse
,
5902 GLOB_ff_string_lower
,
5903 GLOB_ff_string_upper
,
5915 GLOB_ff_bit_arshift
,
5925 GLOB_vm_exit_handler
,
5926 GLOB_vm_exit_interp
,
5931 GLOB_vm_ffi_callback
,
5944 static const char *const globnames
[] = {
5963 "vm_call_dispatch_f",
5965 "cont_ffi_callback",
6011 "ff_coroutine_resume",
6012 "ff_coroutine_wrap_aux",
6013 "ff_coroutine_yield",
6050 "ff_string_reverse",
6093 static const char *const extnames
[] = {
6094 "lj_state_growstack",
6105 "lj_str_fromnumber",
6108 "lj_ffh_coroutine_wrap_err",
6142 "lj_ccallback_enter",
6143 "lj_ccallback_leave",
6151 "lj_gc_step_fixtop",
6156 #define Dt1(_V) (int)(ptrdiff_t)&(((lua_State *)0)_V)
6157 #define Dt2(_V) (int)(ptrdiff_t)&(((global_State *)0)_V)
6158 #define Dt3(_V) (int)(ptrdiff_t)&(((TValue *)0)_V)
6159 #define Dt4(_V) (int)(ptrdiff_t)&(((GCobj *)0)_V)
6160 #define Dt5(_V) (int)(ptrdiff_t)&(((GCstr *)0)_V)
6161 #define Dt6(_V) (int)(ptrdiff_t)&(((GCtab *)0)_V)
6162 #define Dt7(_V) (int)(ptrdiff_t)&(((GCfuncL *)0)_V)
6163 #define Dt8(_V) (int)(ptrdiff_t)&(((GCfuncC *)0)_V)
6164 #define Dt9(_V) (int)(ptrdiff_t)&(((GCproto *)0)_V)
6165 #define DtA(_V) (int)(ptrdiff_t)&(((GCupval *)0)_V)
6166 #define DtB(_V) (int)(ptrdiff_t)&(((Node *)0)_V)
6167 #define DtC(_V) (int)(ptrdiff_t)&(((int *)0)_V)
6168 #define DtD(_V) (int)(ptrdiff_t)&(((GCtrace *)0)_V)
6170 #define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
6171 #define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
6172 #define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
6175 #error "Only dual-number mode supported for ARM target"
6178 /* Generate subroutines used by opcodes and other parts of the VM. */
6179 /* The .code_sub section should be last to help static branch prediction. */
6180 static void build_subroutines(BuildCtx
*ctx
)
6183 dasm_put(Dst
, 1, FRAME_P
, ~LJ_TTRUE
, FRAME_TYPE
, FRAME_TYPEP
, FRAME_C
, Dt1(->base
), LJ_VMST_C
, DISPATCH_GL(vmstate
), Dt1(->top
));
6184 dasm_put(Dst
, 54, Dt1(->cframe
), Dt1(->maxstack
), ~LJ_TNIL
, Dt1(->top
), Dt1(->top
), LJ_VMST_C
, Dt1(->glref
), Dt2(->vmstate
));
6185 dasm_put(Dst
, 108, ~CFRAME_RAWMASK
, Dt1(->base
), Dt1(->glref
), ~LJ_TFALSE
, GG_G2DISP
, LJ_VMST_INTERP
, DISPATCH_GL(vmstate
), LUA_MINSTACK
, Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
), Dt7(->field_pc
), Dt1(->glref
));
6186 dasm_put(Dst
, 173, GG_G2DISP
, FRAME_CP
, CFRAME_RESUME
, Dt1(->status
), Dt1(->cframe
), Dt1(->base
), Dt1(->top
), Dt1(->status
), LJ_VMST_INTERP
, FRAME_TYPE
, DISPATCH_GL(vmstate
), FRAME_CP
, FRAME_C
, Dt1(->cframe
), Dt1(->cframe
));
6187 dasm_put(Dst
, 238, Dt1(->glref
), GG_G2DISP
, Dt1(->base
), Dt1(->top
), LJ_VMST_INTERP
, DISPATCH_GL(vmstate
), -LJ_TFUNC
, Dt7(->field_pc
), Dt1(->stack
), Dt1(->top
), Dt1(->cframe
), Dt1(->cframe
), Dt1(->glref
), FRAME_CP
, GG_G2DISP
);
6192 dasm_put(Dst
, 314, Dt7(->field_pc
), ~LJ_TNIL
);
6196 dasm_put(Dst
, 325, PC2PROTO(k
));
6200 dasm_put(Dst
, 338, Dt1(->base
), -DISPATCH_GL(tmptv
), ~LJ_TTAB
, ~LJ_TSTR
, ~LJ_TISNUM
, Dt1(->base
));
6201 if (LJ_TARGET_OSX
) {
6202 dasm_put(Dst
, 395, Dt1(->base
));
6204 dasm_put(Dst
, 398, FRAME_CONT
, Dt1(->top
), -DISPATCH_GL(tmptv
), ~LJ_TTAB
, ~LJ_TSTR
, ~LJ_TISNUM
, Dt1(->base
));
6205 if (LJ_TARGET_OSX
) {
6206 dasm_put(Dst
, 460, Dt1(->base
));
6208 dasm_put(Dst
, 463, FRAME_CONT
, Dt1(->top
), Dt1(->base
));
6209 if (LJ_TARGET_OSX
) {
6210 dasm_put(Dst
, 499, Dt1(->base
));
6212 dasm_put(Dst
, 502, ~LJ_TTRUE
, -LJ_TFALSE
, Dt1(->base
));
6214 dasm_put(Dst
, 549, Dt1(->base
));
6216 dasm_put(Dst
, 560, Dt1(->base
));
6217 if (LJ_TARGET_OSX
) {
6218 dasm_put(Dst
, 597, Dt1(->base
));
6220 dasm_put(Dst
, 600, FRAME_CONT
, Dt1(->base
));
6221 if (LJ_TARGET_OSX
) {
6222 dasm_put(Dst
, 621, Dt1(->base
));
6224 #ifdef LUAJIT_ENABLE_LUA52COMPAT
6229 dasm_put(Dst
, 634, Dt1(->base
));
6230 if (LJ_TARGET_OSX
) {
6234 if (LJ_TARGET_OSX
) {
6237 dasm_put(Dst
, 649, Dt7(->field_pc
), Dt1(->base
));
6238 if (LJ_TARGET_OSX
) {
6239 dasm_put(Dst
, 670, Dt1(->base
));
6241 dasm_put(Dst
, 673, Dt1(->base
));
6242 if (LJ_TARGET_OSX
) {
6243 dasm_put(Dst
, 687, Dt1(->base
));
6250 dasm_put(Dst
, 694, BC_JFORI
);
6254 dasm_put(Dst
, 700, BC_JFORI
);
6256 dasm_put(Dst
, 703, BC_FORI
, -LJ_TTRUE
, -LJ_TISNUM
, ~LJ_TISNUM
, (int)(offsetof(GCfuncC
, upvalue
)>>3)-1, -LJ_TTAB
, -LJ_TUDATA
, Dt6(->metatable
));
6257 dasm_put(Dst
, 760, ~LJ_TNIL
, DISPATCH_GL(gcroot
[GCROOT_MMNAME
+MM_metatable
]), Dt6(->hmask
), Dt5(->hash
), Dt6(->node
), DtB(->key
), DtB(->val
), DtB(->next
), -LJ_TSTR
, ~LJ_TTAB
, -LJ_TNIL
, -LJ_TISNUM
);
6258 dasm_put(Dst
, 808, ~LJ_TISNUM
, DISPATCH_GL(gcroot
[GCROOT_BASEMT
]), -LJ_TTAB
, Dt6(->metatable
), -LJ_TTAB
, Dt6(->marked
), LJ_GC_BLACK
, Dt6(->metatable
), DISPATCH_GL(gc
.grayagain
), LJ_GC_BLACK
, DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
), -LJ_TTAB
);
6260 if (LJ_TARGET_OSX
) {
6264 if (LJ_TARGET_OSX
) {
6267 dasm_put(Dst
, 872, -LJ_TISNUM
, -LJ_TSTR
, DISPATCH_GL(gcroot
[GCROOT_BASEMT_NUM
]), Dt1(->base
), -LJ_TISNUM
, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), Dt1(->base
), ~LJ_TSTR
);
6268 dasm_put(Dst
, 924, ~LJ_TNIL
, -LJ_TTAB
, Dt1(->base
), Dt1(->top
));
6269 if (LJ_TARGET_OSX
) {
6270 dasm_put(Dst
, 947, Dt1(->base
));
6272 dasm_put(Dst
, 950, ~LJ_TNIL
, (2+1)*8, -LJ_TTAB
);
6273 #ifdef LUAJIT_ENABLE_LUA52COMPAT
6274 dasm_put(Dst
, 973, Dt6(->metatable
));
6276 dasm_put(Dst
, 976, Dt8(->upvalue
[0]));
6277 #ifdef LUAJIT_ENABLE_LUA52COMPAT
6280 dasm_put(Dst
, 984, ~LJ_TNIL
, (3+1)*8, -LJ_TTAB
, -LJ_TISNUM
, Dt6(->asize
), Dt6(->array
), (0+1)*8, -LJ_TNIL
, (2+1)*8, Dt6(->hmask
));
6281 if (LJ_TARGET_OSX
) {
6282 dasm_put(Dst
, 1034);
6284 dasm_put(Dst
, 1036);
6285 if (LJ_TARGET_OSX
) {
6286 dasm_put(Dst
, 1039);
6288 dasm_put(Dst
, 1041, -LJ_TTAB
);
6289 #ifdef LUAJIT_ENABLE_LUA52COMPAT
6290 dasm_put(Dst
, 1057, Dt6(->metatable
));
6292 dasm_put(Dst
, 1060, Dt8(->upvalue
[0]));
6293 #ifdef LUAJIT_ENABLE_LUA52COMPAT
6294 dasm_put(Dst
, 1064);
6296 dasm_put(Dst
, 1068, ~LJ_TISNUM
, (3+1)*8, DISPATCH_GL(hookmask
), HOOK_ACTIVE
, 8+FRAME_PCALL
, 8+FRAME_PCALLH
, DISPATCH_GL(hookmask
), -LJ_TFUNC
, HOOK_ACTIVE
, 16+FRAME_PCALL
, 16+FRAME_PCALLH
, -LJ_TTHREAD
);
6297 dasm_put(Dst
, 1127, Dt1(->base
), Dt1(->top
), Dt1(->status
), Dt1(->base
), Dt1(->maxstack
), Dt1(->cframe
), LUA_YIELD
, Dt1(->top
), Dt1(->top
), Dt1(->base
), LJ_VMST_INTERP
, Dt1(->top
), DISPATCH_GL(vmstate
), LUA_YIELD
);
6298 dasm_put(Dst
, 1186, Dt1(->base
), Dt1(->maxstack
), Dt1(->top
), ~LJ_TTRUE
, FRAME_TYPE
, ~LJ_TFALSE
, (2+1)*8, Dt1(->top
));
6299 dasm_put(Dst
, 1246, Dt8(->upvalue
[0].gcr
), Dt1(->base
), Dt1(->top
), Dt1(->status
), Dt1(->base
), Dt1(->maxstack
), Dt1(->cframe
), LUA_YIELD
, Dt1(->top
), Dt1(->top
), Dt1(->base
), LJ_VMST_INTERP
, Dt1(->top
), DISPATCH_GL(vmstate
), LUA_YIELD
);
6300 dasm_put(Dst
, 1302, Dt1(->base
), Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, Dt1(->cframe
), Dt1(->base
), CFRAME_RESUME
, Dt1(->top
));
6301 dasm_put(Dst
, 1361, LUA_YIELD
, Dt1(->cframe
), Dt1(->status
), -LJ_TISNUM
, ~LJ_TISNUM
, ~LJ_TISNUM
);
6302 dasm_put(Dst
, 1427, -LJ_TISNUM
, ~LJ_TISNUM
, ~LJ_TISNUM
);
6303 dasm_put(Dst
, 1491, -LJ_TISNUM
, (1+1)*8, FRAME_TYPE
, ~LJ_TNIL
);
6304 dasm_put(Dst
, 1555, -LJ_TISNUM
);
6305 if (LJ_TARGET_OSX
) {
6306 dasm_put(Dst
, 1560);
6308 dasm_put(Dst
, 1562);
6309 if (LJ_TARGET_OSX
) {
6310 dasm_put(Dst
, 1565);
6312 dasm_put(Dst
, 1567, -LJ_TISNUM
);
6313 if (LJ_TARGET_OSX
) {
6314 dasm_put(Dst
, 1579);
6316 dasm_put(Dst
, 1581);
6317 if (LJ_TARGET_OSX
) {
6318 dasm_put(Dst
, 1584);
6320 dasm_put(Dst
, 1586, -LJ_TISNUM
);
6321 if (LJ_TARGET_OSX
) {
6322 dasm_put(Dst
, 1598);
6324 dasm_put(Dst
, 1600);
6325 if (LJ_TARGET_OSX
) {
6326 dasm_put(Dst
, 1603);
6328 dasm_put(Dst
, 1605, -LJ_TISNUM
);
6329 if (LJ_TARGET_OSX
) {
6330 dasm_put(Dst
, 1617);
6332 dasm_put(Dst
, 1619);
6333 if (LJ_TARGET_OSX
) {
6334 dasm_put(Dst
, 1622);
6336 dasm_put(Dst
, 1624, -LJ_TISNUM
);
6337 if (LJ_TARGET_OSX
) {
6338 dasm_put(Dst
, 1636);
6340 dasm_put(Dst
, 1638);
6341 if (LJ_TARGET_OSX
) {
6342 dasm_put(Dst
, 1641);
6344 dasm_put(Dst
, 1643, -LJ_TISNUM
);
6345 if (LJ_TARGET_OSX
) {
6346 dasm_put(Dst
, 1655);
6348 dasm_put(Dst
, 1657);
6349 if (LJ_TARGET_OSX
) {
6350 dasm_put(Dst
, 1660);
6352 dasm_put(Dst
, 1662, -LJ_TISNUM
);
6353 if (LJ_TARGET_OSX
) {
6354 dasm_put(Dst
, 1674);
6356 dasm_put(Dst
, 1676);
6357 if (LJ_TARGET_OSX
) {
6358 dasm_put(Dst
, 1679);
6360 dasm_put(Dst
, 1681, -LJ_TISNUM
);
6361 if (LJ_TARGET_OSX
) {
6362 dasm_put(Dst
, 1693);
6364 dasm_put(Dst
, 1695);
6365 if (LJ_TARGET_OSX
) {
6366 dasm_put(Dst
, 1698);
6368 dasm_put(Dst
, 1700, -LJ_TISNUM
);
6369 if (LJ_TARGET_OSX
) {
6370 dasm_put(Dst
, 1712);
6372 dasm_put(Dst
, 1714);
6373 if (LJ_TARGET_OSX
) {
6374 dasm_put(Dst
, 1717);
6376 dasm_put(Dst
, 1719, -LJ_TISNUM
);
6377 if (LJ_TARGET_OSX
) {
6378 dasm_put(Dst
, 1731);
6380 dasm_put(Dst
, 1733);
6381 if (LJ_TARGET_OSX
) {
6382 dasm_put(Dst
, 1736);
6384 dasm_put(Dst
, 1738, -LJ_TISNUM
);
6385 if (LJ_TARGET_OSX
) {
6386 dasm_put(Dst
, 1750);
6388 dasm_put(Dst
, 1752);
6389 if (LJ_TARGET_OSX
) {
6390 dasm_put(Dst
, 1755);
6392 dasm_put(Dst
, 1757, -LJ_TISNUM
);
6393 if (LJ_TARGET_OSX
) {
6394 dasm_put(Dst
, 1769);
6396 dasm_put(Dst
, 1771);
6397 if (LJ_TARGET_OSX
) {
6398 dasm_put(Dst
, 1774);
6400 dasm_put(Dst
, 1776, -LJ_TISNUM
);
6401 if (LJ_TARGET_OSX
) {
6402 dasm_put(Dst
, 1788);
6404 dasm_put(Dst
, 1790);
6405 if (LJ_TARGET_OSX
) {
6406 dasm_put(Dst
, 1793);
6408 dasm_put(Dst
, 1795, -LJ_TISNUM
, -LJ_TISNUM
);
6409 if (LJ_TARGET_OSX
) {
6410 dasm_put(Dst
, 1810);
6412 dasm_put(Dst
, 1812);
6413 if (LJ_TARGET_OSX
) {
6414 dasm_put(Dst
, 1815);
6416 dasm_put(Dst
, 1817, -LJ_TISNUM
, -LJ_TISNUM
);
6417 if (LJ_TARGET_OSX
) {
6418 dasm_put(Dst
, 1832);
6420 dasm_put(Dst
, 1834);
6421 if (LJ_TARGET_OSX
) {
6422 dasm_put(Dst
, 1837);
6424 dasm_put(Dst
, 1839, -LJ_TISNUM
, -LJ_TISNUM
);
6425 if (LJ_TARGET_OSX
) {
6426 dasm_put(Dst
, 1854);
6428 dasm_put(Dst
, 1856);
6429 if (LJ_TARGET_OSX
) {
6430 dasm_put(Dst
, 1859);
6432 dasm_put(Dst
, 1861, -LJ_TISNUM
, Dt8(->upvalue
[0]), -LJ_TISNUM
, -LJ_TISNUM
);
6433 if (LJ_TARGET_OSX
) {
6434 dasm_put(Dst
, 1894);
6436 dasm_put(Dst
, 1896);
6437 if (LJ_TARGET_OSX
) {
6438 dasm_put(Dst
, 1899);
6440 dasm_put(Dst
, 1901, -LJ_TISNUM
);
6441 if (LJ_TARGET_OSX
) {
6442 dasm_put(Dst
, 1914);
6444 dasm_put(Dst
, 1916);
6445 if (LJ_TARGET_OSX
) {
6446 dasm_put(Dst
, 1919);
6448 dasm_put(Dst
, 1921, ~LJ_TISNUM
, (2+1)*8, -LJ_TISNUM
);
6449 if (LJ_TARGET_OSX
) {
6450 dasm_put(Dst
, 1943);
6452 dasm_put(Dst
, 1945);
6453 if (LJ_TARGET_OSX
) {
6454 dasm_put(Dst
, 1948);
6456 dasm_put(Dst
, 1950, (2+1)*8, -LJ_TISNUM
, -LJ_TISNUM
, -LJ_TISNUM
);
6457 dasm_put(Dst
, 2001, -LJ_TISNUM
, -LJ_TISNUM
);
6458 dasm_put(Dst
, 2055, -LJ_TISNUM
, -LJ_TSTR
, Dt5(->len
), ~LJ_TISNUM
, -LJ_TSTR
, Dt5(->len
), Dt5([1]));
6459 dasm_put(Dst
, 2109, ~LJ_TISNUM
, (0+1)*8, (1+1)*8, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), -LJ_TISNUM
, Dt1(->base
), Dt1(->base
), ~LJ_TSTR
, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
6460 dasm_put(Dst
, 2168, -LJ_TISNUM
, -LJ_TSTR
, Dt5(->len
), -LJ_TISNUM
, sizeof(GCstr
)-1, -DISPATCH_GL(strempty
), ~LJ_TSTR
, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), -LJ_TSTR
, -LJ_TISNUM
, Dt5(->len
));
6461 dasm_put(Dst
, 2230, DISPATCH_GL(tmpbuf
.sz
), DISPATCH_GL(tmpbuf
.buf
), Dt5([1]), DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), -LJ_TSTR
, Dt5(->len
), DISPATCH_GL(tmpbuf
.sz
), DISPATCH_GL(tmpbuf
.buf
), sizeof(GCstr
));
6462 dasm_put(Dst
, 2283, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), -LJ_TSTR
, Dt5(->len
), DISPATCH_GL(tmpbuf
.sz
), DISPATCH_GL(tmpbuf
.buf
), sizeof(GCstr
), DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
6463 dasm_put(Dst
, 2343, -LJ_TSTR
, Dt5(->len
), DISPATCH_GL(tmpbuf
.sz
), DISPATCH_GL(tmpbuf
.buf
), sizeof(GCstr
), -LJ_TTAB
);
6464 if (LJ_TARGET_OSX
) {
6465 dasm_put(Dst
, 2381);
6467 dasm_put(Dst
, 2383);
6468 if (LJ_TARGET_OSX
) {
6469 dasm_put(Dst
, 2386);
6471 dasm_put(Dst
, 2388, ~LJ_TISNUM
, -LJ_TISNUM
, ~LJ_TISNUM
, -LJ_TISNUM
, -LJ_TISNUM
);
6472 dasm_put(Dst
, 2459, -LJ_TISNUM
, -LJ_TISNUM
, -LJ_TISNUM
, -LJ_TISNUM
, ~LJ_TISNUM
);
6473 dasm_put(Dst
, 2519, -LJ_TISNUM
, ~LJ_TISNUM
, -LJ_TISNUM
, ~LJ_TISNUM
, -LJ_TISNUM
, -LJ_TISNUM
, ~LJ_TISNUM
, -LJ_TISNUM
);
6474 dasm_put(Dst
, 2575, -LJ_TISNUM
, ~LJ_TISNUM
, -LJ_TISNUM
, -LJ_TISNUM
, ~LJ_TISNUM
, -LJ_TISNUM
, -LJ_TISNUM
, ~LJ_TISNUM
);
6475 dasm_put(Dst
, 2632, -LJ_TISNUM
, -LJ_TISNUM
, ~LJ_TISNUM
, Dt1(->maxstack
), Dt1(->top
), Dt8(->f
), Dt1(->base
), 8*LUA_MINSTACK
, Dt1(->base
), Dt1(->top
), Dt7(->field_pc
), FRAME_TYPE
, FRAME_TYPEP
);
6476 dasm_put(Dst
, 2695, LUA_MINSTACK
, Dt1(->base
), Dt1(->base
), Dt1(->top
), Dt1(->base
));
6478 dasm_put(Dst
, 2729, DISPATCH_GL(hookmask
), HOOK_VMEVENT
, DISPATCH_GL(hookcount
), HOOK_ACTIVE
, LUA_MASKLINE
|LUA_MASKCOUNT
, DISPATCH_GL(hookcount
));
6480 dasm_put(Dst
, 2749, DISPATCH_GL(hookmask
), HOOK_ACTIVE
, GG_DISP2STATIC
, DISPATCH_GL(hookmask
), DISPATCH_GL(hookcount
), HOOK_ACTIVE
, LUA_MASKLINE
|LUA_MASKCOUNT
, DISPATCH_GL(hookcount
), LUA_MASKLINE
, Dt1(->base
), Dt1(->base
));
6481 dasm_put(Dst
, 2795, GG_DISP2STATIC
);
6483 dasm_put(Dst
, 2811, -GG_DISP2J
, Dt7(->field_pc
), DISPATCH_J(L
), PC2PROTO(framesize
), Dt1(->base
), Dt1(->top
));
6485 dasm_put(Dst
, 2832);
6487 dasm_put(Dst
, 2835);
6489 dasm_put(Dst
, 2838);
6491 dasm_put(Dst
, 2840);
6493 dasm_put(Dst
, 2843, Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
6495 dasm_put(Dst
, 2866, LJ_VMST_EXIT
, DISPATCH_GL(vmstate
), DISPATCH_GL(jit_L
), DISPATCH_GL(jit_base
), DISPATCH_J(exitno
), DISPATCH_J(L
), Dt1(->base
), DISPATCH_GL(jit_L
), -GG_DISP2J
, Dt1(->cframe
), Dt1(->base
), ~CFRAME_RAWMASK
);
6497 dasm_put(Dst
, 2914);
6499 dasm_put(Dst
, 2916, Dt7(->field_pc
), DISPATCH_GL(jit_L
), LJ_VMST_INTERP
, PC2PROTO(k
), DISPATCH_GL(vmstate
), BC_FUNCF
);
6501 dasm_put(Dst
, 2953);
6503 dasm_put(Dst
, 3027);
6505 dasm_put(Dst
, 3041);
6508 for (i
= 31; i
>= 0; i
--) {
6509 dasm_put(Dst
, 3077, i
, i
);
6512 dasm_put(Dst
, 3082);
6514 dasm_put(Dst
, 3111);
6516 dasm_put(Dst
, 3136);
6518 dasm_put(Dst
, 3138);
6520 #define DtE(_V) (int)(ptrdiff_t)&(((CTState *)0)_V)
6521 dasm_put(Dst
, 3140, Dt2(->ctype_state
), GG_G2DISP
, DtE(->cb
.gpr
[0]), DtE(->cb
.gpr
[2]), CFRAME_SIZE
, DtE(->cb
.stack
), DtE(->cb
.slot
), Dt1(->base
), LJ_VMST_INTERP
, Dt1(->top
), DISPATCH_GL(vmstate
), Dt7(->field_pc
));
6523 dasm_put(Dst
, 3183);
6525 dasm_put(Dst
, 3185, DISPATCH_GL(ctype_state
), Dt1(->base
), Dt1(->top
), DtE(->L
), DtE(->cb
.gpr
[0]));
6527 dasm_put(Dst
, 3202);
6529 #define DtF(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
6530 dasm_put(Dst
, 3204, DtF(->spadj
), DtF(->nsp
), offsetof(CCallState
, stack
), DtF(->func
), DtF(->gpr
[0]), DtF(->gpr
[1]), DtF(->gpr
[2]), DtF(->gpr
[3]), DtF(->gpr
[0]), DtF(->gpr
[1]));
6534 /* Generate the code for a single instruction. */
6535 static void build_ins(BuildCtx
*ctx
, BCOp op
, int defop
)
6538 dasm_put(Dst
, 3242, defop
);
6542 /* -- Comparison ops ---------------------------------------------------- */
6544 /* Remember: all ops branch for a true comparison, fall through otherwise. */
6546 case BC_ISLT
: case BC_ISGE
: case BC_ISLE
: case BC_ISGT
:
6547 dasm_put(Dst
, 3244, -LJ_TISNUM
, -LJ_TISNUM
);
6548 if (op
== BC_ISLT
) {
6549 dasm_put(Dst
, 3260);
6550 } else if (op
== BC_ISGE
) {
6551 dasm_put(Dst
, 3262);
6552 } else if (op
== BC_ISLE
) {
6553 dasm_put(Dst
, 3264);
6555 dasm_put(Dst
, 3266);
6557 dasm_put(Dst
, 3268, -LJ_TISNUM
);
6558 if (op
== BC_ISLT
) {
6559 dasm_put(Dst
, 3304);
6560 } else if (op
== BC_ISGE
) {
6561 dasm_put(Dst
, 3306);
6562 } else if (op
== BC_ISLE
) {
6563 dasm_put(Dst
, 3308);
6565 dasm_put(Dst
, 3310);
6567 dasm_put(Dst
, 3312);
6570 case BC_ISEQV
: case BC_ISNEV
:
6571 vk
= op
== BC_ISEQV
;
6572 dasm_put(Dst
, 3315, -LJ_TISNUM
, -LJ_TISNUM
);
6574 dasm_put(Dst
, 3326);
6576 dasm_put(Dst
, 3329);
6579 dasm_put(Dst
, 3332, -LJ_TCDATA
, -LJ_TCDATA
);
6581 dasm_put(Dst
, 3339, -LJ_TISPRI
);
6583 dasm_put(Dst
, 3348, -LJ_TISTABUD
);
6585 dasm_put(Dst
, 3365, -LJ_TISTABUD
);
6587 dasm_put(Dst
, 3372, Dt6(->metatable
));
6589 dasm_put(Dst
, 3376);
6591 dasm_put(Dst
, 3379);
6593 dasm_put(Dst
, 3382, Dt6(->nomm
), 1-vk
, 1<<MM_eq
);
6595 dasm_put(Dst
, 3392);
6597 dasm_put(Dst
, 3395);
6601 case BC_ISEQS
: case BC_ISNES
:
6602 vk
= op
== BC_ISEQS
;
6603 dasm_put(Dst
, 3405, -LJ_TSTR
);
6605 dasm_put(Dst
, 3414);
6607 dasm_put(Dst
, 3418);
6610 dasm_put(Dst
, 3420);
6612 dasm_put(Dst
, 3423);
6614 dasm_put(Dst
, 3426);
6616 dasm_put(Dst
, 3433, -LJ_TCDATA
);
6620 case BC_ISEQN
: case BC_ISNEN
:
6621 vk
= op
== BC_ISEQN
;
6622 dasm_put(Dst
, 3441);
6624 dasm_put(Dst
, 3448);
6626 dasm_put(Dst
, 3450);
6628 dasm_put(Dst
, 3452, -LJ_TISNUM
, -LJ_TISNUM
);
6630 dasm_put(Dst
, 3462);
6632 dasm_put(Dst
, 3465);
6634 dasm_put(Dst
, 3468);
6636 dasm_put(Dst
, 3477);
6639 dasm_put(Dst
, 3480);
6641 dasm_put(Dst
, 3482);
6643 dasm_put(Dst
, 3485, -LJ_TISNUM
);
6645 dasm_put(Dst
, 3501);
6647 dasm_put(Dst
, 3503);
6649 dasm_put(Dst
, 3505);
6651 dasm_put(Dst
, 3508, -LJ_TCDATA
);
6655 case BC_ISEQP
: case BC_ISNEP
:
6656 vk
= op
== BC_ISEQP
;
6657 dasm_put(Dst
, 3516);
6659 dasm_put(Dst
, 3522, -LJ_TCDATA
);
6661 dasm_put(Dst
, 3527);
6663 dasm_put(Dst
, 3529);
6665 dasm_put(Dst
, 3531);
6667 dasm_put(Dst
, 3533);
6670 /* -- Unary test and copy ops ------------------------------------------- */
6672 case BC_ISTC
: case BC_ISFC
: case BC_IST
: case BC_ISF
:
6673 dasm_put(Dst
, 3540, -LJ_TTRUE
);
6674 if (op
== BC_ISTC
|| op
== BC_IST
) {
6675 dasm_put(Dst
, 3548);
6676 if (op
== BC_ISTC
) {
6677 dasm_put(Dst
, 3550);
6680 dasm_put(Dst
, 3552);
6681 if (op
== BC_ISFC
) {
6682 dasm_put(Dst
, 3554);
6685 dasm_put(Dst
, 3556);
6688 /* -- Unary ops --------------------------------------------------------- */
6691 dasm_put(Dst
, 3563);
6694 dasm_put(Dst
, 3573, -LJ_TTRUE
, ~LJ_TFALSE
, ~LJ_TTRUE
);
6697 dasm_put(Dst
, 3590, -LJ_TISNUM
);
6700 dasm_put(Dst
, 3616, -LJ_TSTR
, Dt5(->len
), ~LJ_TISNUM
, -LJ_TTAB
);
6701 #ifdef LUAJIT_ENABLE_LUA52COMPAT
6702 dasm_put(Dst
, 3640, Dt6(->metatable
));
6704 dasm_put(Dst
, 3647);
6705 if (LJ_TARGET_OSX
) {
6706 dasm_put(Dst
, 3649);
6708 dasm_put(Dst
, 3651);
6709 if (LJ_TARGET_OSX
) {
6710 dasm_put(Dst
, 3654);
6712 dasm_put(Dst
, 3656);
6713 #ifdef LUAJIT_ENABLE_LUA52COMPAT
6714 dasm_put(Dst
, 3659, Dt6(->nomm
), 1<<MM_len
);
6718 /* -- Binary ops -------------------------------------------------------- */
6721 case BC_ADDVN
: case BC_ADDNV
: case BC_ADDVV
:
6722 dasm_put(Dst
, 3669);
6723 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
6726 dasm_put(Dst
, 3672);
6729 dasm_put(Dst
, 3675);
6732 dasm_put(Dst
, 3678);
6735 dasm_put(Dst
, 3681);
6737 dasm_put(Dst
, 3683, -LJ_TISNUM
, -LJ_TISNUM
);
6739 dasm_put(Dst
, 3688, -LJ_TISNUM
, -LJ_TISNUM
);
6741 dasm_put(Dst
, 3693);
6744 dasm_put(Dst
, 3697);
6747 dasm_put(Dst
, 3700);
6750 dasm_put(Dst
, 3703);
6753 dasm_put(Dst
, 3706);
6757 dasm_put(Dst
, 3715, -LJ_TISNUM
, -LJ_TISNUM
);
6759 dasm_put(Dst
, 3720, -LJ_TISNUM
, -LJ_TISNUM
);
6761 dasm_put(Dst
, 3725);
6765 dasm_put(Dst
, 3728, -LJ_TISNUM
, -LJ_TISNUM
);
6767 dasm_put(Dst
, 3733, -LJ_TISNUM
, -LJ_TISNUM
);
6769 dasm_put(Dst
, 3738);
6773 dasm_put(Dst
, 3741, -LJ_TISNUM
, -LJ_TISNUM
);
6775 dasm_put(Dst
, 3746, -LJ_TISNUM
, -LJ_TISNUM
);
6777 dasm_put(Dst
, 3751);
6780 dasm_put(Dst
, 3754);
6782 case BC_SUBVN
: case BC_SUBNV
: case BC_SUBVV
:
6783 dasm_put(Dst
, 3760);
6784 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
6787 dasm_put(Dst
, 3763);
6790 dasm_put(Dst
, 3766);
6793 dasm_put(Dst
, 3769);
6796 dasm_put(Dst
, 3772);
6798 dasm_put(Dst
, 3774, -LJ_TISNUM
, -LJ_TISNUM
);
6800 dasm_put(Dst
, 3779, -LJ_TISNUM
, -LJ_TISNUM
);
6802 dasm_put(Dst
, 3784);
6805 dasm_put(Dst
, 3788);
6808 dasm_put(Dst
, 3791);
6811 dasm_put(Dst
, 3794);
6814 dasm_put(Dst
, 3797);
6818 dasm_put(Dst
, 3806, -LJ_TISNUM
, -LJ_TISNUM
);
6820 dasm_put(Dst
, 3811, -LJ_TISNUM
, -LJ_TISNUM
);
6822 dasm_put(Dst
, 3816);
6826 dasm_put(Dst
, 3819, -LJ_TISNUM
, -LJ_TISNUM
);
6828 dasm_put(Dst
, 3824, -LJ_TISNUM
, -LJ_TISNUM
);
6830 dasm_put(Dst
, 3829);
6834 dasm_put(Dst
, 3832, -LJ_TISNUM
, -LJ_TISNUM
);
6836 dasm_put(Dst
, 3837, -LJ_TISNUM
, -LJ_TISNUM
);
6838 dasm_put(Dst
, 3842);
6841 dasm_put(Dst
, 3845);
6843 case BC_MULVN
: case BC_MULNV
: case BC_MULVV
:
6844 dasm_put(Dst
, 3851);
6845 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
6848 dasm_put(Dst
, 3854);
6851 dasm_put(Dst
, 3857);
6854 dasm_put(Dst
, 3860);
6857 dasm_put(Dst
, 3863);
6859 dasm_put(Dst
, 3865, -LJ_TISNUM
, -LJ_TISNUM
);
6861 dasm_put(Dst
, 3870, -LJ_TISNUM
, -LJ_TISNUM
);
6863 dasm_put(Dst
, 3875);
6866 dasm_put(Dst
, 3880);
6869 dasm_put(Dst
, 3883);
6872 dasm_put(Dst
, 3886);
6875 dasm_put(Dst
, 3889);
6879 dasm_put(Dst
, 3898, -LJ_TISNUM
, -LJ_TISNUM
);
6881 dasm_put(Dst
, 3903, -LJ_TISNUM
, -LJ_TISNUM
);
6883 dasm_put(Dst
, 3908);
6887 dasm_put(Dst
, 3911, -LJ_TISNUM
, -LJ_TISNUM
);
6889 dasm_put(Dst
, 3916, -LJ_TISNUM
, -LJ_TISNUM
);
6891 dasm_put(Dst
, 3921);
6895 dasm_put(Dst
, 3924, -LJ_TISNUM
, -LJ_TISNUM
);
6897 dasm_put(Dst
, 3929, -LJ_TISNUM
, -LJ_TISNUM
);
6899 dasm_put(Dst
, 3934);
6902 dasm_put(Dst
, 3937);
6904 case BC_DIVVN
: case BC_DIVNV
: case BC_DIVVV
:
6905 dasm_put(Dst
, 3943);
6906 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
6909 dasm_put(Dst
, 3946);
6912 dasm_put(Dst
, 3949);
6915 dasm_put(Dst
, 3952);
6921 dasm_put(Dst
, 3955, -LJ_TISNUM
, -LJ_TISNUM
);
6923 dasm_put(Dst
, 3960, -LJ_TISNUM
, -LJ_TISNUM
);
6925 dasm_put(Dst
, 3965);
6929 dasm_put(Dst
, 3968, -LJ_TISNUM
, -LJ_TISNUM
);
6931 dasm_put(Dst
, 3973, -LJ_TISNUM
, -LJ_TISNUM
);
6933 dasm_put(Dst
, 3978);
6937 dasm_put(Dst
, 3981, -LJ_TISNUM
, -LJ_TISNUM
);
6939 dasm_put(Dst
, 3986, -LJ_TISNUM
, -LJ_TISNUM
);
6941 dasm_put(Dst
, 3991);
6944 dasm_put(Dst
, 3994);
6946 case BC_MODVN
: case BC_MODNV
: case BC_MODVV
:
6947 dasm_put(Dst
, 4004);
6948 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
6951 dasm_put(Dst
, 4007);
6954 dasm_put(Dst
, 4010);
6957 dasm_put(Dst
, 4013);
6961 dasm_put(Dst
, 4016, -LJ_TISNUM
, -LJ_TISNUM
);
6963 dasm_put(Dst
, 4021, -LJ_TISNUM
, -LJ_TISNUM
);
6965 dasm_put(Dst
, 4026);
6968 dasm_put(Dst
, 4030);
6971 dasm_put(Dst
, 4033);
6974 dasm_put(Dst
, 4036);
6977 dasm_put(Dst
, 4039, ~LJ_TISNUM
);
6981 dasm_put(Dst
, 4053, -LJ_TISNUM
, -LJ_TISNUM
);
6983 dasm_put(Dst
, 4058, -LJ_TISNUM
, -LJ_TISNUM
);
6985 dasm_put(Dst
, 4063);
6989 dasm_put(Dst
, 4066, -LJ_TISNUM
, -LJ_TISNUM
);
6991 dasm_put(Dst
, 4071, -LJ_TISNUM
, -LJ_TISNUM
);
6993 dasm_put(Dst
, 4076);
6997 dasm_put(Dst
, 4079, -LJ_TISNUM
, -LJ_TISNUM
);
6999 dasm_put(Dst
, 4084, -LJ_TISNUM
, -LJ_TISNUM
);
7001 dasm_put(Dst
, 4089);
7004 dasm_put(Dst
, 4092);
7007 dasm_put(Dst
, 4097);
7008 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
7011 dasm_put(Dst
, 4100);
7014 dasm_put(Dst
, 4103);
7017 dasm_put(Dst
, 4106);
7023 dasm_put(Dst
, 4109, -LJ_TISNUM
, -LJ_TISNUM
);
7025 dasm_put(Dst
, 4114, -LJ_TISNUM
, -LJ_TISNUM
);
7027 dasm_put(Dst
, 4119);
7031 dasm_put(Dst
, 4122, -LJ_TISNUM
, -LJ_TISNUM
);
7033 dasm_put(Dst
, 4127, -LJ_TISNUM
, -LJ_TISNUM
);
7035 dasm_put(Dst
, 4132);
7039 dasm_put(Dst
, 4135, -LJ_TISNUM
, -LJ_TISNUM
);
7041 dasm_put(Dst
, 4140, -LJ_TISNUM
, -LJ_TISNUM
);
7043 dasm_put(Dst
, 4145);
7046 if (LJ_TARGET_OSX
) {
7047 dasm_put(Dst
, 4148);
7049 dasm_put(Dst
, 4150);
7050 if (LJ_TARGET_OSX
) {
7051 dasm_put(Dst
, 4153);
7053 dasm_put(Dst
, 4155);
7057 dasm_put(Dst
, 4163, Dt1(->base
), Dt1(->base
));
7060 /* -- Constant ops ------------------------------------------------------ */
7063 dasm_put(Dst
, 4189, ~LJ_TSTR
);
7067 dasm_put(Dst
, 4201, ~LJ_TCDATA
);
7071 dasm_put(Dst
, 4213, ~LJ_TISNUM
);
7074 dasm_put(Dst
, 4224);
7077 dasm_put(Dst
, 4234);
7080 dasm_put(Dst
, 4244, ~LJ_TNIL
);
7083 /* -- Upvalue and function ops ------------------------------------------ */
7086 dasm_put(Dst
, 4263, offsetof(GCfuncL
, uvptr
), DtA(->v
));
7089 dasm_put(Dst
, 4279, offsetof(GCfuncL
, uvptr
), DtA(->marked
), DtA(->closed
), DtA(->v
), LJ_GC_BLACK
, -LJ_TISGCV
, -(LJ_TISNUM
- LJ_TISGCV
), Dt4(->gch
.marked
), -GG_DISP2G
, LJ_GC_WHITES
);
7090 if (LJ_TARGET_OSX
) {
7091 dasm_put(Dst
, 4319);
7093 dasm_put(Dst
, 4326);
7095 dasm_put(Dst
, 4329);
7098 dasm_put(Dst
, 4332, offsetof(GCfuncL
, uvptr
), ~LJ_TSTR
, DtA(->marked
), DtA(->v
), DtA(->closed
), LJ_GC_BLACK
, Dt5(->marked
), LJ_GC_WHITES
, -GG_DISP2G
);
7099 if (LJ_TARGET_OSX
) {
7100 dasm_put(Dst
, 4368);
7102 dasm_put(Dst
, 4375);
7104 dasm_put(Dst
, 4378);
7107 dasm_put(Dst
, 4381, offsetof(GCfuncL
, uvptr
), DtA(->v
));
7110 dasm_put(Dst
, 4398, offsetof(GCfuncL
, uvptr
), DtA(->v
));
7114 dasm_put(Dst
, 4414, Dt1(->openupval
), Dt1(->base
), Dt1(->base
));
7118 dasm_put(Dst
, 4437, Dt1(->base
), Dt1(->base
), ~LJ_TFUNC
);
7121 /* -- Table ops --------------------------------------------------------- */
7125 if (op
== BC_TDUP
) {
7126 dasm_put(Dst
, 4458);
7128 dasm_put(Dst
, 4460, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), Dt1(->base
));
7129 if (op
== BC_TNEW
) {
7130 dasm_put(Dst
, 4473);
7132 dasm_put(Dst
, 4482);
7134 dasm_put(Dst
, 4486, Dt1(->base
), ~LJ_TTAB
);
7139 dasm_put(Dst
, 4504, Dt7(->env
));
7140 if (op
== BC_GGET
) {
7141 dasm_put(Dst
, 4510);
7143 dasm_put(Dst
, 4513);
7148 dasm_put(Dst
, 4516, -LJ_TTAB
, -LJ_TISNUM
, Dt6(->array
), Dt6(->asize
), -LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
, -LJ_TSTR
);
7151 dasm_put(Dst
, 4573, -LJ_TTAB
, Dt6(->hmask
), Dt5(->hash
), Dt6(->node
), DtB(->key
), DtB(->val
), DtB(->next
), -LJ_TSTR
, -LJ_TNIL
, Dt6(->metatable
), ~LJ_TNIL
, Dt6(->nomm
));
7152 dasm_put(Dst
, 4633, 1<<MM_index
);
7155 dasm_put(Dst
, 4640, -LJ_TTAB
, Dt6(->asize
), Dt6(->array
), -LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
7159 dasm_put(Dst
, 4683, -LJ_TTAB
, -LJ_TISNUM
, Dt6(->array
), Dt6(->asize
), -LJ_TNIL
, Dt6(->marked
), LJ_GC_BLACK
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
);
7160 dasm_put(Dst
, 4743, DISPATCH_GL(gc
.grayagain
), LJ_GC_BLACK
, DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
), -LJ_TSTR
);
7163 dasm_put(Dst
, 4764, -LJ_TTAB
, Dt6(->hmask
), Dt5(->hash
), Dt6(->node
), Dt6(->nomm
), DtB(->key
), DtB(->val
.it
), DtB(->next
), -LJ_TSTR
, Dt6(->marked
), -LJ_TNIL
, LJ_GC_BLACK
, DtB(->val
));
7164 dasm_put(Dst
, 4822, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, Dt6(->metatable
), Dt1(->base
), Dt6(->nomm
), 1<<MM_newindex
, ~LJ_TSTR
, Dt1(->base
), DISPATCH_GL(gc
.grayagain
), LJ_GC_BLACK
);
7165 dasm_put(Dst
, 4875, DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
7168 dasm_put(Dst
, 4884, -LJ_TTAB
, Dt6(->asize
), Dt6(->array
), -LJ_TNIL
, Dt6(->marked
), LJ_GC_BLACK
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, DISPATCH_GL(gc
.grayagain
), LJ_GC_BLACK
);
7169 dasm_put(Dst
, 4942, DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
7173 dasm_put(Dst
, 4951, Dt6(->asize
), Dt6(->array
), Dt6(->marked
), LJ_GC_BLACK
, Dt1(->base
));
7174 if (LJ_TARGET_OSX
) {
7175 dasm_put(Dst
, 4996, Dt1(->base
));
7177 dasm_put(Dst
, 4999, DISPATCH_GL(gc
.grayagain
), LJ_GC_BLACK
, DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
7180 /* -- Calls and vararg handling ----------------------------------------- */
7183 dasm_put(Dst
, 5015);
7186 dasm_put(Dst
, 5021, -LJ_TFUNC
, Dt7(->field_pc
));
7190 dasm_put(Dst
, 5041);
7193 dasm_put(Dst
, 5046, -LJ_TFUNC
, Dt7(->ffid
), FRAME_TYPE
, Dt7(->field_pc
), Dt7(->field_pc
), PC2PROTO(k
), FRAME_VARG
, FRAME_TYPEP
);
7194 dasm_put(Dst
, 5107, FRAME_TYPE
);
7198 dasm_put(Dst
, 5118, -LJ_TFUNC
, Dt7(->field_pc
));
7204 dasm_put(Dst
, 5142, Dt6(->asize
), Dt6(->array
), -LJ_TNIL
, ~LJ_TISNUM
, Dt6(->hmask
), Dt6(->node
), DtB(->val
), -LJ_TNIL
, DtB(->key
));
7208 dasm_put(Dst
, 5207, -LJ_TFUNC
, Dt8(->ffid
), -LJ_TTAB
, -LJ_TNIL
, FF_next_N
, BC_JMP
, BC_ITERC
);
7212 dasm_put(Dst
, 5246, FRAME_VARG
, ~LJ_TNIL
, Dt1(->maxstack
), Dt1(->top
), Dt1(->base
), Dt1(->base
));
7215 /* -- Returns ----------------------------------------------------------- */
7218 dasm_put(Dst
, 5318);
7222 dasm_put(Dst
, 5325, FRAME_TYPE
, FRAME_VARG
, Dt7(->field_pc
), PC2PROTO(k
), ~LJ_TNIL
, FRAME_TYPEP
);
7225 case BC_RET0
: case BC_RET1
:
7226 dasm_put(Dst
, 5390, FRAME_TYPE
, FRAME_VARG
);
7227 if (op
== BC_RET1
) {
7228 dasm_put(Dst
, 5401);
7230 dasm_put(Dst
, 5403);
7231 if (op
== BC_RET1
) {
7232 dasm_put(Dst
, 5406);
7234 dasm_put(Dst
, 5408, Dt7(->field_pc
), PC2PROTO(k
), ~LJ_TNIL
);
7237 /* -- Loops and branches ------------------------------------------------ */
7242 dasm_put(Dst
, 5434, -GG_DISP2HOT
, HOTCOUNT_LOOP
);
7253 vk
= (op
== BC_IFORL
|| op
== BC_JFORL
);
7254 dasm_put(Dst
, 5445);
7255 if (op
!= BC_JFORL
) {
7256 dasm_put(Dst
, 5447);
7259 dasm_put(Dst
, 5449, -LJ_TISNUM
, -LJ_TISNUM
, -LJ_TISNUM
);
7261 dasm_put(Dst
, 5467, -LJ_TISNUM
);
7262 if (op
== BC_IFORL
) {
7263 dasm_put(Dst
, 5475);
7265 dasm_put(Dst
, 5477);
7267 dasm_put(Dst
, 5480);
7269 dasm_put(Dst
, 5485);
7270 if (op
== BC_FORI
) {
7271 dasm_put(Dst
, 5487);
7272 } else if (op
== BC_JFORI
) {
7273 dasm_put(Dst
, 5489);
7274 } else if (op
== BC_IFORL
) {
7275 dasm_put(Dst
, 5492);
7278 dasm_put(Dst
, 5494);
7280 dasm_put(Dst
, 5496);
7281 if (op
== BC_JFORI
|| op
== BC_JFORL
) {
7282 dasm_put(Dst
, 5501, BC_JLOOP
);
7284 dasm_put(Dst
, 5504);
7286 dasm_put(Dst
, 5511);
7288 dasm_put(Dst
, 5513);
7290 dasm_put(Dst
, 5515);
7292 dasm_put(Dst
, 5519, -LJ_TISNUM
, -LJ_TISNUM
);
7294 dasm_put(Dst
, 5531);
7296 dasm_put(Dst
, 5540);
7297 if (op
== BC_FORI
) {
7298 dasm_put(Dst
, 5544);
7299 } else if (op
== BC_JFORI
) {
7300 dasm_put(Dst
, 5546, BC_JLOOP
);
7301 } else if (op
== BC_IFORL
) {
7302 dasm_put(Dst
, 5551);
7304 dasm_put(Dst
, 5553, BC_JLOOP
);
7306 dasm_put(Dst
, 5556);
7308 dasm_put(Dst
, 5562);
7310 dasm_put(Dst
, 5567);
7315 dasm_put(Dst
, 5573, -GG_DISP2HOT
, HOTCOUNT_LOOP
);
7324 dasm_put(Dst
, 5584);
7325 if (op
== BC_JITERL
) {
7326 dasm_put(Dst
, 5586, -LJ_TNIL
, BC_JLOOP
);
7328 dasm_put(Dst
, 5592, -LJ_TNIL
);
7330 dasm_put(Dst
, 5598);
7335 dasm_put(Dst
, 5605, -GG_DISP2HOT
, HOTCOUNT_LOOP
);
7340 dasm_put(Dst
, 5616);
7345 dasm_put(Dst
, 5623, DISPATCH_J(trace
), DISPATCH_GL(vmstate
), DtD(->mcode
), DISPATCH_GL(jit_base
), DISPATCH_GL(jit_L
));
7350 dasm_put(Dst
, 5637);
7353 /* -- Function headers -------------------------------------------------- */
7357 dasm_put(Dst
, 5646, -GG_DISP2HOT
, HOTCOUNT_CALL
);
7359 case BC_FUNCV
: /* NYI: compiled vararg functions. */
7367 dasm_put(Dst
, 5657, Dt1(->maxstack
), -4+PC2PROTO(numparams
), -4+PC2PROTO(k
));
7368 if (op
!= BC_JFUNCF
) {
7369 dasm_put(Dst
, 5667);
7371 dasm_put(Dst
, 5670, ~LJ_TNIL
);
7372 if (op
== BC_JFUNCF
) {
7373 dasm_put(Dst
, 5677, BC_JLOOP
);
7375 dasm_put(Dst
, 5681);
7377 dasm_put(Dst
, 5686);
7384 dasm_put(Dst
, 5692);
7385 break; /* NYI: compiled vararg functions. */
7388 dasm_put(Dst
, 5694, Dt1(->maxstack
), 8+FRAME_VARG
, -4+PC2PROTO(k
), -4+PC2PROTO(numparams
), ~LJ_TNIL
);
7393 if (op
== BC_FUNCC
) {
7394 dasm_put(Dst
, 5735, Dt8(->f
));
7396 dasm_put(Dst
, 5738, DISPATCH_GL(wrapf
));
7398 dasm_put(Dst
, 5741, Dt1(->maxstack
), Dt1(->base
), Dt1(->top
));
7399 if (op
== BC_FUNCCW
) {
7400 dasm_put(Dst
, 5751, Dt8(->f
));
7402 dasm_put(Dst
, 5754, LJ_VMST_C
, DISPATCH_GL(vmstate
), Dt1(->base
), LJ_VMST_INTERP
, Dt1(->top
), DISPATCH_GL(vmstate
));
7405 /* ---------------------------------------------------------------------- */
7408 fprintf(stderr
, "Error: undefined opcode BC_%s\n", bc_names
[op
]);
7414 static int build_backend(BuildCtx
*ctx
)
7418 dasm_growpc(Dst
, BC__MAX
);
7420 build_subroutines(ctx
);
7422 dasm_put(Dst
, 5776);
7423 for (op
= 0; op
< BC__MAX
; op
++)
7424 build_ins(ctx
, (BCOp
)op
, op
);
7429 /* Emit pseudo frame-info for all assembler functions. */
7430 static void emit_asm_debug(BuildCtx
*ctx
)
7432 int fcofs
= (int)((uint8_t *)ctx
->glob
[GLOB_vm_ffi_call
] - ctx
->code
);
7434 switch (ctx
->mode
) {
7436 fprintf(ctx
->fp
, "\t.section .debug_frame,\"\",%%progbits\n");
7439 "\t.long .LECIE0-.LSCIE0\n"
7441 "\t.long 0xffffffff\n"
7446 "\t.byte 0xe\n" /* Return address is in lr. */
7447 "\t.byte 0xc\n\t.uleb128 0xd\n\t.uleb128 0\n" /* def_cfa sp */
7452 "\t.long .LEFDE0-.LASFDE0\n"
7454 "\t.long .Lframe0\n"
7457 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
7458 "\t.byte 0x8e\n\t.uleb128 1\n", /* offset lr */
7459 fcofs
, CFRAME_SIZE
);
7460 for (i
= 11; i
>= 4; i
--) /* offset r4-r11 */
7461 fprintf(ctx
->fp
, "\t.byte %d\n\t.uleb128 %d\n", 0x80+i
, 2+(11-i
));
7468 "\t.long .LEFDE1-.LASFDE1\n"
7470 "\t.long .Lframe0\n"
7471 "\t.long lj_vm_ffi_call\n"
7473 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
7474 "\t.byte 0x8e\n\t.uleb128 1\n" /* offset lr */
7475 "\t.byte 0x8b\n\t.uleb128 2\n" /* offset r11 */
7476 "\t.byte 0x85\n\t.uleb128 3\n" /* offset r5 */
7477 "\t.byte 0x84\n\t.uleb128 4\n" /* offset r4 */
7478 "\t.byte 0xd\n\t.uleb128 0xb\n" /* def_cfa_register r11 */
7480 ".LEFDE1:\n\n", (int)ctx
->codesz
- fcofs
);