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
[7577] = {
7604 GLOB_vm_unwind_c_eh
,
7606 GLOB_vm_unwind_ff_eh
,
7607 GLOB_vm_growstack_c
,
7608 GLOB_vm_growstack_l
,
7612 GLOB_vm_call_dispatch
,
7614 GLOB_vm_call_dispatch_f
,
7634 GLOB_vmeta_equal_cd
,
7635 GLOB_vmeta_arith_nv
,
7636 GLOB_vmeta_arith_nv2
,
7638 GLOB_vmeta_arith_vn
,
7639 GLOB_vmeta_arith_vv
,
7640 GLOB_vmeta_arith_vn2
,
7641 GLOB_vmeta_arith_vv2
,
7652 GLOB_ff_getmetatable
,
7654 GLOB_ff_setmetatable
,
7665 GLOB_ff_coroutine_resume
,
7666 GLOB_ff_coroutine_wrap_aux
,
7667 GLOB_ff_coroutine_yield
,
7697 GLOB_ff_string_byte
,
7698 GLOB_ff_string_char
,
7702 GLOB_ff_string_reverse
,
7703 GLOB_ff_string_lower
,
7704 GLOB_ff_string_upper
,
7715 GLOB_ff_bit_arshift
,
7726 GLOB_vm_exit_handler
,
7727 GLOB_vm_exit_interp
,
7742 static const char *const globnames
[] = {
7761 "vm_call_dispatch_f",
7812 "ff_coroutine_resume",
7813 "ff_coroutine_wrap_aux",
7814 "ff_coroutine_yield",
7849 "ff_string_reverse",
7889 static const char *const extnames
[] = {
7890 "lj_state_growstack",
7901 "lj_str_fromnumber",
7905 "lj_ffh_coroutine_wrap_err",
7942 "lj_gc_step_fixtop",
7947 #define Dt1(_V) (int)(ptrdiff_t)&(((lua_State *)0)_V)
7948 #define Dt2(_V) (int)(ptrdiff_t)&(((global_State *)0)_V)
7949 #define Dt3(_V) (int)(ptrdiff_t)&(((TValue *)0)_V)
7950 #define Dt4(_V) (int)(ptrdiff_t)&(((GCobj *)0)_V)
7951 #define Dt5(_V) (int)(ptrdiff_t)&(((GCstr *)0)_V)
7952 #define Dt6(_V) (int)(ptrdiff_t)&(((GCtab *)0)_V)
7953 #define Dt7(_V) (int)(ptrdiff_t)&(((GCfuncL *)0)_V)
7954 #define Dt8(_V) (int)(ptrdiff_t)&(((GCfuncC *)0)_V)
7955 #define Dt9(_V) (int)(ptrdiff_t)&(((GCproto *)0)_V)
7956 #define DtA(_V) (int)(ptrdiff_t)&(((GCupval *)0)_V)
7957 #define DtB(_V) (int)(ptrdiff_t)&(((Node *)0)_V)
7958 #define DtC(_V) (int)(ptrdiff_t)&(((int *)0)_V)
7959 #define DtD(_V) (int)(ptrdiff_t)&(((GCtrace *)0)_V)
7960 #define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
7961 #define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
7962 #define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
7964 /* Generate subroutines used by opcodes and other parts of the VM. */
7965 /* The .code_sub section should be last to help static branch prediction. */
7966 static void build_subroutines(BuildCtx
*ctx
)
7969 dasm_put(Dst
, 1, FRAME_P
, LJ_TTRUE
, FRAME_TYPE
, FRAME_C
, ~LJ_VMST_C
, Dt1(->base
), DISPATCH_GL(vmstate
), 31-3, Dt1(->top
));
7970 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);
7971 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
));
7972 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
);
7973 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);
7974 dasm_put(Dst
, 277, 128+(17-14)*8, 56+(18-14)*4, 128+(18-14)*8, 56+(19-14)*4, 128+(19-14)*8, 56+(20-14)*4, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4, 128+(23-14)*8, 56+(24-14)*4, 128+(24-14)*8, 56+(25-14)*4, 128+(25-14)*8, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4);
7975 dasm_put(Dst
, 326, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4, 128+(31-14)*8, Dt1(->glref
), Dt1(->status
), FRAME_CP
, CFRAME_RESUME
, GG_G2DISP
, Dt1(->cframe
), Dt1(->base
), LJ_TISNUM
, Dt1(->top
), Dt1(->status
), FRAME_TYPE
, ~LJ_VMST_INTERP
, LJ_TNIL
, DISPATCH_GL(vmstate
));
7976 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);
7977 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);
7978 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);
7979 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
));
7980 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);
7981 dasm_put(Dst
, 654, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4, 128+(23-14)*8, 56+(24-14)*4, 128+(24-14)*8, 56+(25-14)*4, 128+(25-14)*8, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4);
7982 dasm_put(Dst
, 701, 128+(31-14)*8, Dt1(->stack
), Dt1(->top
), Dt1(->cframe
), Dt1(->cframe
), Dt1(->glref
), FRAME_CP
, GG_G2DISP
, Dt7(->pc
), PC2PROTO(k
), Dt1(->base
), DISPATCH_GL(tmptv
));
7983 dasm_put(Dst
, 775, LJ_TSTR
, DISPATCH_GL(tmptv
), LJ_TTAB
, DISPATCH_GL(tmptv2
), LJ_TSTR
);
7987 dasm_put(Dst
, 804, DISPATCH_GL(tmptv
));
7993 dasm_put(Dst
, 814, Dt1(->base
), FRAME_CONT
, Dt1(->top
), DISPATCH_GL(tmptv
), LJ_TSTR
, DISPATCH_GL(tmptv
), LJ_TTAB
, DISPATCH_GL(tmptv2
), LJ_TSTR
);
7997 dasm_put(Dst
, 886, DISPATCH_GL(tmptv
));
8003 dasm_put(Dst
, 896, Dt1(->base
), FRAME_CONT
, Dt1(->top
));
8015 dasm_put(Dst
, 951, Dt1(->base
), -(BCBIAS_J
*4 >> 16), LJ_TTRUE
, LJ_TTRUE
, Dt1(->base
));
8017 dasm_put(Dst
, 1014, Dt1(->base
));
8019 dasm_put(Dst
, 1025);
8021 dasm_put(Dst
, 1032);
8023 dasm_put(Dst
, 1037);
8025 dasm_put(Dst
, 1051);
8027 dasm_put(Dst
, 1054);
8029 dasm_put(Dst
, 1057);
8031 dasm_put(Dst
, 1060, Dt1(->base
), FRAME_CONT
);
8032 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8033 dasm_put(Dst
, 1084);
8035 dasm_put(Dst
, 1086, Dt1(->base
));
8036 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8037 dasm_put(Dst
, 1094);
8039 dasm_put(Dst
, 1101);
8041 dasm_put(Dst
, 1104, Dt1(->base
), Dt7(->pc
), Dt1(->base
), Dt1(->base
));
8043 dasm_put(Dst
, 1152);
8045 dasm_put(Dst
, 1154);
8047 dasm_put(Dst
, 1156, BC_JFORI
);
8049 dasm_put(Dst
, 1159);
8051 dasm_put(Dst
, 1161, BC_JFORI
);
8053 dasm_put(Dst
, 1164, BC_FORI
, LJ_TFALSE
, ~LJ_TISNUM
+1, 31-3, Dt8(->upvalue
), LJ_TTAB
, Dt6(->metatable
));
8054 dasm_put(Dst
, 1227, LJ_TNIL
, DISPATCH_GL(gcroot
[GCROOT_MMNAME
+MM_metatable
]), Dt6(->hmask
), LJ_TTAB
, Dt5(->hash
), Dt6(->node
), 31-5, 31-3, DtB(->key
), 4+offsetof(Node
, key
), DtB(->val
), 4+offsetof(Node
, val
), LJ_TSTR
, DtB(->next
));
8055 dasm_put(Dst
, 1275, LJ_TNIL
, LJ_TUDATA
, ~LJ_TISNUM
+1, 31-2, DISPATCH_GL(gcroot
[GCROOT_BASEMT
]), LJ_TTAB
, Dt6(->metatable
), LJ_TTAB
, Dt6(->marked
), LJ_GC_BLACK
, Dt6(->metatable
));
8056 dasm_put(Dst
, 1330, DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
), LJ_TTAB
, LJ_TSTR
, DISPATCH_GL(gcroot
[GCROOT_BASEMT_NUM
]), Dt1(->base
));
8057 dasm_put(Dst
, 1390, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8059 dasm_put(Dst
, 1400);
8061 dasm_put(Dst
, 1403);
8063 dasm_put(Dst
, 1406, LJ_TSTR
, LJ_TTAB
, Dt1(->base
), Dt1(->top
), LJ_TNIL
, (2+1)*8, LJ_TTAB
);
8064 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8065 dasm_put(Dst
, 1457, Dt6(->metatable
), Dt8(->upvalue
[0]));
8067 dasm_put(Dst
, 1466, Dt8(->upvalue
[0]));
8069 dasm_put(Dst
, 1470, (3+1)*8);
8071 dasm_put(Dst
, 1482);
8073 dasm_put(Dst
, 1484);
8075 dasm_put(Dst
, 1486, LJ_TTAB
);
8077 dasm_put(Dst
, 1493);
8079 dasm_put(Dst
, 1498);
8081 dasm_put(Dst
, 1510, Dt6(->asize
), Dt6(->array
));
8083 dasm_put(Dst
, 1515);
8085 dasm_put(Dst
, 1517);
8087 dasm_put(Dst
, 1521, 31-3);
8089 dasm_put(Dst
, 1526, 31-3);
8091 dasm_put(Dst
, 1530, LJ_TNIL
, (0+1)*8, (2+1)*8, Dt6(->hmask
), (0+1)*8, (0+1)*8, LJ_TTAB
);
8092 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8093 dasm_put(Dst
, 1578, Dt6(->metatable
), Dt8(->upvalue
[0]));
8095 dasm_put(Dst
, 1587, Dt8(->upvalue
[0]));
8098 dasm_put(Dst
, 1591);
8100 dasm_put(Dst
, 1593);
8102 dasm_put(Dst
, 1595, (3+1)*8, DISPATCH_GL(hookmask
), 32-HOOK_ACTIVE_SHIFT
, 8+FRAME_PCALL
, DISPATCH_GL(hookmask
), LJ_TFUNC
, 32-HOOK_ACTIVE_SHIFT
, 16+FRAME_PCALL
, LJ_TTHREAD
, Dt1(->status
), Dt1(->cframe
));
8103 dasm_put(Dst
, 1656, Dt1(->top
), LUA_YIELD
, Dt1(->base
), Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), Dt1(->top
), Dt1(->base
), LUA_YIELD
, Dt1(->top
), ~LJ_VMST_INTERP
, Dt1(->base
), DISPATCH_GL(vmstate
));
8104 dasm_put(Dst
, 1718, Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, LJ_TTRUE
, FRAME_TYPE
, LJ_TFALSE
, Dt1(->top
), (2+1)*8, 32-3);
8105 dasm_put(Dst
, 1781, Dt8(->upvalue
[0].gcr
), Dt1(->status
), Dt1(->cframe
), Dt1(->top
), LUA_YIELD
, Dt1(->base
), Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), Dt1(->top
), Dt1(->base
), LUA_YIELD
, Dt1(->top
), ~LJ_VMST_INTERP
);
8106 dasm_put(Dst
, 1840, Dt1(->base
), DISPATCH_GL(vmstate
), Dt1(->maxstack
), Dt1(->top
), FRAME_TYPE
, 32-3, Dt1(->cframe
));
8107 dasm_put(Dst
, 1897, Dt1(->base
), CFRAME_RESUME
, Dt1(->top
), LUA_YIELD
, Dt1(->cframe
), Dt1(->status
));
8109 dasm_put(Dst
, 1922);
8111 dasm_put(Dst
, 1943, (1+1)*8, FRAME_TYPE
);
8113 dasm_put(Dst
, 1985, 31-11, 32-21, 31-11);
8114 dasm_put(Dst
, 2067, 31-11, 32-21, 31-11);
8116 dasm_put(Dst
, 2121);
8118 dasm_put(Dst
, 2148);
8119 dasm_put(Dst
, 2207);
8120 dasm_put(Dst
, 2265);
8121 dasm_put(Dst
, 2321, Dt8(->upvalue
[0]));
8122 dasm_put(Dst
, 2387);
8124 dasm_put(Dst
, 2391);
8126 dasm_put(Dst
, 2406);
8128 dasm_put(Dst
, 2424, DISPATCH_GL(tmptv
), DISPATCH_GL(tmptv
));
8130 dasm_put(Dst
, 2446);
8132 dasm_put(Dst
, 2451, (2+1)*8);
8134 dasm_put(Dst
, 2455);
8136 dasm_put(Dst
, 2458);
8138 dasm_put(Dst
, 2460, (2+1)*8);
8140 dasm_put(Dst
, 2482);
8142 dasm_put(Dst
, 2551);
8145 dasm_put(Dst
, 2576);
8147 dasm_put(Dst
, 2645);
8149 dasm_put(Dst
, 2670, LJ_TSTR
, Dt5(->len
), LJ_TSTR
, Dt5(->len
));
8151 dasm_put(Dst
, 2697, Dt5([1]), (0+1)*8);
8153 dasm_put(Dst
, 2709, Dt5([1]), 31-3);
8155 dasm_put(Dst
, 2725, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8157 dasm_put(Dst
, 2736);
8159 dasm_put(Dst
, 2744);
8161 dasm_put(Dst
, 2755, Dt1(->base
), Dt1(->base
), LJ_TSTR
, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8163 dasm_put(Dst
, 2783);
8165 dasm_put(Dst
, 2785);
8167 dasm_put(Dst
, 2791);
8169 dasm_put(Dst
, 2793);
8171 dasm_put(Dst
, 2795);
8173 dasm_put(Dst
, 2799);
8175 dasm_put(Dst
, 2808);
8177 dasm_put(Dst
, 2819, LJ_TSTR
);
8179 dasm_put(Dst
, 2824);
8181 dasm_put(Dst
, 2828, Dt5(->len
), sizeof(GCstr
)-1, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
));
8183 dasm_put(Dst
, 2878);
8185 dasm_put(Dst
, 2880);
8187 dasm_put(Dst
, 2882, LJ_TSTR
);
8189 dasm_put(Dst
, 2889);
8191 dasm_put(Dst
, 2893);
8193 dasm_put(Dst
, 2900, Dt5(->len
), DISPATCH_GL(tmpbuf
.sz
), Dt5([1]), DISPATCH_GL(tmpbuf
.buf
), DISPATCH_GL(strempty
), LJ_TSTR
, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), LJ_TSTR
, DISPATCH_GL(tmpbuf
.sz
));
8194 dasm_put(Dst
, 2953, Dt5(->len
), sizeof(GCstr
), DISPATCH_GL(tmpbuf
.buf
), DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), LJ_TSTR
, DISPATCH_GL(tmpbuf
.sz
), Dt5(->len
), sizeof(GCstr
), DISPATCH_GL(tmpbuf
.buf
));
8195 dasm_put(Dst
, 3011, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), LJ_TSTR
, DISPATCH_GL(tmpbuf
.sz
), Dt5(->len
), sizeof(GCstr
), DISPATCH_GL(tmpbuf
.buf
), LJ_TTAB
);
8197 dasm_put(Dst
, 3080);
8199 dasm_put(Dst
, 3090);
8201 dasm_put(Dst
, 3103);
8203 dasm_put(Dst
, 3109);
8205 dasm_put(Dst
, 3111);
8207 dasm_put(Dst
, 3113);
8209 dasm_put(Dst
, 3117);
8211 dasm_put(Dst
, 3120);
8213 dasm_put(Dst
, 3126);
8215 dasm_put(Dst
, 3131);
8217 dasm_put(Dst
, 3141);
8219 dasm_put(Dst
, 3154);
8221 dasm_put(Dst
, 3160);
8223 dasm_put(Dst
, 3162);
8225 dasm_put(Dst
, 3164);
8227 dasm_put(Dst
, 3168);
8229 dasm_put(Dst
, 3171);
8231 dasm_put(Dst
, 3177);
8233 dasm_put(Dst
, 3182);
8235 dasm_put(Dst
, 3192);
8237 dasm_put(Dst
, 3205);
8239 dasm_put(Dst
, 3211);
8241 dasm_put(Dst
, 3213);
8243 dasm_put(Dst
, 3215);
8245 dasm_put(Dst
, 3219);
8247 dasm_put(Dst
, 3222);
8249 dasm_put(Dst
, 3228);
8251 dasm_put(Dst
, 3233);
8253 dasm_put(Dst
, 3243);
8255 dasm_put(Dst
, 3256);
8257 dasm_put(Dst
, 3263);
8259 dasm_put(Dst
, 3273);
8261 dasm_put(Dst
, 3286);
8263 dasm_put(Dst
, 3290);
8265 dasm_put(Dst
, 3305);
8267 dasm_put(Dst
, 3326);
8269 dasm_put(Dst
, 3331);
8271 dasm_put(Dst
, 3346);
8273 dasm_put(Dst
, 3367);
8275 dasm_put(Dst
, 3372);
8277 dasm_put(Dst
, 3387);
8279 dasm_put(Dst
, 3408);
8281 dasm_put(Dst
, 3413);
8283 dasm_put(Dst
, 3428);
8285 dasm_put(Dst
, 3449);
8287 dasm_put(Dst
, 3453);
8289 dasm_put(Dst
, 3468);
8291 dasm_put(Dst
, 3489);
8293 dasm_put(Dst
, 3494);
8295 dasm_put(Dst
, 3504);
8298 dasm_put(Dst
, 3517);
8300 dasm_put(Dst
, 3520);
8302 dasm_put(Dst
, 3526);
8304 dasm_put(Dst
, 3534);
8306 dasm_put(Dst
, 3542);
8308 dasm_put(Dst
, 3544);
8310 dasm_put(Dst
, 3552, Dt8(->f
), 8*LUA_MINSTACK
, Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), Dt1(->base
), 31-3, Dt1(->top
), Dt7(->pc
), FRAME_TYPE
, LUA_MINSTACK
);
8311 dasm_put(Dst
, 3615, Dt1(->base
), Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
8313 dasm_put(Dst
, 3641, DISPATCH_GL(hookmask
), HOOK_VMEVENT
, DISPATCH_GL(hookcount
), HOOK_ACTIVE
, LUA_MASKLINE
|LUA_MASKCOUNT
, DISPATCH_GL(hookcount
));
8315 dasm_put(Dst
, 3663, DISPATCH_GL(hookmask
), HOOK_ACTIVE
, GG_DISP2STATIC
, DISPATCH_GL(hookmask
), DISPATCH_GL(hookcount
), HOOK_ACTIVE
, 31-LUA_HOOKLINE
, DISPATCH_GL(hookcount
), Dt1(->base
), Dt1(->base
));
8316 dasm_put(Dst
, 3710, GG_DISP2STATIC
);
8318 dasm_put(Dst
, 3728, GG_DISP2J
, Dt7(->pc
), DISPATCH_J(L
), PC2PROTO(framesize
), Dt1(->base
), 31-3, Dt1(->top
));
8320 dasm_put(Dst
, 3751);
8322 dasm_put(Dst
, 3754);
8324 dasm_put(Dst
, 3757);
8326 dasm_put(Dst
, 3759);
8328 dasm_put(Dst
, 3762, Dt1(->base
), Dt1(->top
), Dt1(->base
), Dt1(->top
));
8330 dasm_put(Dst
, 3785, -(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);
8331 dasm_put(Dst
, 3832, 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);
8332 dasm_put(Dst
, 3881, DISPATCH_J(L
), DISPATCH_GL(jit_L
), DISPATCH_J(parent
), Dt1(->base
), GG_DISP2J
, DISPATCH_J(exitno
), Dt1(->cframe
), Dt1(->base
));
8334 dasm_put(Dst
, 3909);
8336 dasm_put(Dst
, 3911, -GG_DISP2G
-32768, 31-3, Dt7(->pc
), DISPATCH_GL(jit_L
), PC2PROTO(k
), LJ_TISNUM
, LJ_TNIL
, DISPATCH_GL(vmstate
), BC_FUNCF
*4);
8338 dasm_put(Dst
, 3968);
8340 dasm_put(Dst
, 3976);
8342 dasm_put(Dst
, 3979);
8344 dasm_put(Dst
, 4059);
8346 dasm_put(Dst
, 4081);
8348 dasm_put(Dst
, 4083);
8350 #define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
8351 dasm_put(Dst
, 4085, DtE(->spadj
), DtE(->nsp
), DtE(->nfpr
), DtE(->stack
), 31-2, DtE(->fpr
[0]), DtE(->fpr
[1]), DtE(->fpr
[2]), DtE(->fpr
[3]), DtE(->fpr
[4]), DtE(->fpr
[5]), DtE(->fpr
[6]), DtE(->fpr
[7]), DtE(->func
), DtE(->gpr
[1]), DtE(->gpr
[2]));
8352 dasm_put(Dst
, 4141, DtE(->gpr
[3]), DtE(->gpr
[4]), DtE(->gpr
[5]), DtE(->gpr
[6]), DtE(->gpr
[7]), DtE(->gpr
[0]), DtE(->gpr
[0]), DtE(->fpr
[0]), DtE(->gpr
[1]), DtE(->gpr
[2]), DtE(->gpr
[3]));
8356 /* Generate the code for a single instruction. */
8357 static void build_ins(BuildCtx
*ctx
, BCOp op
, int defop
)
8360 dasm_put(Dst
, 4172, defop
);
8364 /* -- Comparison ops ---------------------------------------------------- */
8366 /* Remember: all ops branch for a true comparison, fall through otherwise. */
8368 case BC_ISLT
: case BC_ISGE
: case BC_ISLE
: case BC_ISGT
:
8370 dasm_put(Dst
, 4174, -(BCBIAS_J
*4 >> 16));
8371 if (op
== BC_ISLT
) {
8372 dasm_put(Dst
, 4191);
8373 } else if (op
== BC_ISGE
) {
8374 dasm_put(Dst
, 4194);
8375 } else if (op
== BC_ISLE
) {
8376 dasm_put(Dst
, 4197);
8378 dasm_put(Dst
, 4200);
8380 dasm_put(Dst
, 4203);
8381 if (op
== BC_ISLT
) {
8382 dasm_put(Dst
, 4242);
8383 } else if (op
== BC_ISGE
) {
8384 dasm_put(Dst
, 4245);
8385 } else if (op
== BC_ISLE
) {
8386 dasm_put(Dst
, 4248);
8388 dasm_put(Dst
, 4252);
8390 dasm_put(Dst
, 4256);
8392 dasm_put(Dst
, 4259, -(BCBIAS_J
*4 >> 16));
8393 if (op
== BC_ISLT
) {
8394 dasm_put(Dst
, 4276);
8395 } else if (op
== BC_ISGE
) {
8396 dasm_put(Dst
, 4279);
8397 } else if (op
== BC_ISLE
) {
8398 dasm_put(Dst
, 4282);
8400 dasm_put(Dst
, 4286);
8402 dasm_put(Dst
, 4290);
8406 case BC_ISEQV
: case BC_ISNEV
:
8407 vk
= op
== BC_ISEQV
;
8409 dasm_put(Dst
, 4303, -(BCBIAS_J
*4 >> 16));
8411 dasm_put(Dst
, 4316);
8413 dasm_put(Dst
, 4319);
8416 dasm_put(Dst
, 4322, -(BCBIAS_J
*4 >> 16));
8418 dasm_put(Dst
, 4339);
8420 dasm_put(Dst
, 4343);
8422 dasm_put(Dst
, 4347);
8424 dasm_put(Dst
, 4359);
8426 dasm_put(Dst
, 4361);
8429 dasm_put(Dst
, 4364, LJ_TCDATA
, LJ_TCDATA
);
8431 dasm_put(Dst
, 4369, ~LJ_TISPRI
);
8433 dasm_put(Dst
, 4374);
8435 dasm_put(Dst
, 4376, ~LJ_TISTABUD
);
8437 dasm_put(Dst
, 4379);
8439 dasm_put(Dst
, 4382);
8441 dasm_put(Dst
, 4390);
8443 dasm_put(Dst
, 4395);
8446 dasm_put(Dst
, 4400);
8448 dasm_put(Dst
, 4415);
8450 dasm_put(Dst
, 4418, Dt6(->metatable
), 1-vk
, Dt6(->nomm
), 1<<MM_eq
);
8453 case BC_ISEQS
: case BC_ISNES
:
8454 vk
= op
== BC_ISEQS
;
8455 dasm_put(Dst
, 4437, 32-1);
8457 dasm_put(Dst
, 4445, LJ_TCDATA
);
8459 dasm_put(Dst
, 4448, LJ_TSTR
);
8461 dasm_put(Dst
, 4452);
8463 dasm_put(Dst
, 4455, -(BCBIAS_J
*4 >> 16));
8465 dasm_put(Dst
, 4463);
8467 dasm_put(Dst
, 4465);
8469 dasm_put(Dst
, 4467);
8472 case BC_ISEQN
: case BC_ISNEN
:
8473 vk
= op
== BC_ISEQN
;
8475 dasm_put(Dst
, 4479, -(BCBIAS_J
*4 >> 16));
8477 dasm_put(Dst
, 4491);
8479 dasm_put(Dst
, 4493);
8481 dasm_put(Dst
, 4495);
8484 dasm_put(Dst
, 4502);
8486 dasm_put(Dst
, 4504);
8488 dasm_put(Dst
, 4506, -(BCBIAS_J
*4 >> 16));
8491 dasm_put(Dst
, 4519);
8493 dasm_put(Dst
, 4524);
8496 dasm_put(Dst
, 4526);
8498 dasm_put(Dst
, 4530);
8500 dasm_put(Dst
, 4532);
8502 dasm_put(Dst
, 4535);
8504 dasm_put(Dst
, 4546, LJ_TCDATA
);
8507 dasm_put(Dst
, 4554);
8511 case BC_ISEQP
: case BC_ISNEP
:
8512 vk
= op
== BC_ISEQP
;
8513 dasm_put(Dst
, 4578, 32-3);
8515 dasm_put(Dst
, 4585, LJ_TCDATA
);
8517 dasm_put(Dst
, 4588);
8519 dasm_put(Dst
, 4590);
8521 dasm_put(Dst
, 4593, -(BCBIAS_J
*4 >> 16));
8523 dasm_put(Dst
, 4599);
8525 dasm_put(Dst
, 4601);
8527 dasm_put(Dst
, 4603);
8530 /* -- Unary test and copy ops ------------------------------------------- */
8532 case BC_ISTC
: case BC_ISFC
: case BC_IST
: case BC_ISF
:
8533 dasm_put(Dst
, 4615);
8534 if (op
== BC_IST
|| op
== BC_ISF
) {
8535 dasm_put(Dst
, 4619, LJ_TTRUE
, -(BCBIAS_J
*4 >> 16));
8537 dasm_put(Dst
, 4626);
8539 dasm_put(Dst
, 4628);
8541 dasm_put(Dst
, 4630);
8543 dasm_put(Dst
, 4632, LJ_TFALSE
);
8544 if (op
== BC_ISTC
) {
8545 dasm_put(Dst
, 4637);
8547 dasm_put(Dst
, 4640);
8549 dasm_put(Dst
, 4643, -(BCBIAS_J
*4 >> 16));
8551 dasm_put(Dst
, 4650);
8554 /* -- Unary ops --------------------------------------------------------- */
8557 dasm_put(Dst
, 4661);
8560 dasm_put(Dst
, 4674, LJ_TTRUE
);
8563 dasm_put(Dst
, 4690);
8565 dasm_put(Dst
, 4694);
8567 dasm_put(Dst
, 4722);
8569 dasm_put(Dst
, 4732);
8571 dasm_put(Dst
, 4735);
8575 dasm_put(Dst
, 4744, LJ_TSTR
, Dt5(->len
));
8577 dasm_put(Dst
, 4754);
8579 dasm_put(Dst
, 4759);
8581 dasm_put(Dst
, 4766, LJ_TTAB
);
8582 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8583 dasm_put(Dst
, 4780, Dt6(->metatable
));
8585 dasm_put(Dst
, 4787);
8586 #ifdef LUAJIT_ENABLE_LUA52COMPAT
8587 dasm_put(Dst
, 4793, Dt6(->nomm
), 1<<MM_len
);
8591 /* -- Binary ops -------------------------------------------------------- */
8594 case BC_ADDVN
: case BC_ADDNV
: case BC_ADDVV
:
8596 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8599 dasm_put(Dst
, 4803);
8602 dasm_put(Dst
, 4809);
8605 dasm_put(Dst
, 4815);
8608 dasm_put(Dst
, 4821);
8611 dasm_put(Dst
, 4848);
8614 dasm_put(Dst
, 4851);
8617 dasm_put(Dst
, 4854);
8620 dasm_put(Dst
, 4857);
8622 dasm_put(Dst
, 4859);
8624 dasm_put(Dst
, 4863);
8628 dasm_put(Dst
, 4867);
8631 dasm_put(Dst
, 4870);
8634 dasm_put(Dst
, 4873);
8637 dasm_put(Dst
, 4876);
8639 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8642 dasm_put(Dst
, 4883);
8644 dasm_put(Dst
, 4885);
8646 dasm_put(Dst
, 4887);
8648 dasm_put(Dst
, 4890);
8650 dasm_put(Dst
, 4896);
8654 dasm_put(Dst
, 4900);
8656 dasm_put(Dst
, 4902);
8658 dasm_put(Dst
, 4904);
8660 dasm_put(Dst
, 4907);
8662 dasm_put(Dst
, 4913);
8666 dasm_put(Dst
, 4917);
8669 dasm_put(Dst
, 4927);
8672 case BC_SUBVN
: case BC_SUBNV
: case BC_SUBVV
:
8674 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8677 dasm_put(Dst
, 4940);
8680 dasm_put(Dst
, 4946);
8683 dasm_put(Dst
, 4952);
8686 dasm_put(Dst
, 4958);
8689 dasm_put(Dst
, 4985);
8692 dasm_put(Dst
, 4988);
8695 dasm_put(Dst
, 4991);
8698 dasm_put(Dst
, 4994);
8700 dasm_put(Dst
, 4996);
8702 dasm_put(Dst
, 5000);
8706 dasm_put(Dst
, 5004);
8709 dasm_put(Dst
, 5007);
8712 dasm_put(Dst
, 5010);
8715 dasm_put(Dst
, 5013);
8717 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8720 dasm_put(Dst
, 5020);
8722 dasm_put(Dst
, 5022);
8724 dasm_put(Dst
, 5024);
8726 dasm_put(Dst
, 5027);
8728 dasm_put(Dst
, 5033);
8732 dasm_put(Dst
, 5037);
8734 dasm_put(Dst
, 5039);
8736 dasm_put(Dst
, 5041);
8738 dasm_put(Dst
, 5044);
8740 dasm_put(Dst
, 5050);
8744 dasm_put(Dst
, 5054);
8747 dasm_put(Dst
, 5064);
8750 case BC_MULVN
: case BC_MULNV
: case BC_MULVV
:
8752 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8755 dasm_put(Dst
, 5077);
8758 dasm_put(Dst
, 5083);
8761 dasm_put(Dst
, 5089);
8764 dasm_put(Dst
, 5095);
8767 dasm_put(Dst
, 5122);
8770 dasm_put(Dst
, 5125);
8773 dasm_put(Dst
, 5128);
8776 dasm_put(Dst
, 5131);
8778 dasm_put(Dst
, 5133);
8780 dasm_put(Dst
, 5137);
8784 dasm_put(Dst
, 5141);
8787 dasm_put(Dst
, 5144);
8790 dasm_put(Dst
, 5147);
8793 dasm_put(Dst
, 5150);
8795 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8798 dasm_put(Dst
, 5157);
8800 dasm_put(Dst
, 5159);
8802 dasm_put(Dst
, 5161);
8804 dasm_put(Dst
, 5164);
8806 dasm_put(Dst
, 5170);
8810 dasm_put(Dst
, 5174);
8812 dasm_put(Dst
, 5176);
8814 dasm_put(Dst
, 5178);
8816 dasm_put(Dst
, 5181);
8818 dasm_put(Dst
, 5187);
8822 dasm_put(Dst
, 5191);
8825 dasm_put(Dst
, 5201);
8828 case BC_DIVVN
: case BC_DIVNV
: case BC_DIVVV
:
8829 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8832 dasm_put(Dst
, 5214);
8834 dasm_put(Dst
, 5216);
8836 dasm_put(Dst
, 5218);
8838 dasm_put(Dst
, 5221);
8840 dasm_put(Dst
, 5227);
8844 dasm_put(Dst
, 5231);
8846 dasm_put(Dst
, 5233);
8848 dasm_put(Dst
, 5235);
8850 dasm_put(Dst
, 5238);
8852 dasm_put(Dst
, 5244);
8856 dasm_put(Dst
, 5248);
8859 dasm_put(Dst
, 5258);
8863 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8866 dasm_put(Dst
, 5271);
8869 dasm_put(Dst
, 5277);
8872 dasm_put(Dst
, 5283);
8875 dasm_put(Dst
, 5289);
8878 dasm_put(Dst
, 5317);
8881 dasm_put(Dst
, 5320);
8884 dasm_put(Dst
, 5323);
8887 dasm_put(Dst
, 5326);
8889 dasm_put(Dst
, 5328);
8891 dasm_put(Dst
, 5332);
8895 dasm_put(Dst
, 5336);
8898 dasm_put(Dst
, 5339);
8901 dasm_put(Dst
, 5342);
8904 dasm_put(Dst
, 5345);
8906 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8909 dasm_put(Dst
, 5357);
8911 dasm_put(Dst
, 5359);
8913 dasm_put(Dst
, 5361);
8915 dasm_put(Dst
, 5364);
8917 dasm_put(Dst
, 5370);
8921 dasm_put(Dst
, 5374);
8923 dasm_put(Dst
, 5376);
8925 dasm_put(Dst
, 5378);
8927 dasm_put(Dst
, 5381);
8929 dasm_put(Dst
, 5387);
8933 dasm_put(Dst
, 5391);
8936 dasm_put(Dst
, 5401);
8939 case BC_MODNV
: case BC_MODVV
:
8941 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8944 dasm_put(Dst
, 5419);
8947 dasm_put(Dst
, 5425);
8950 dasm_put(Dst
, 5431);
8953 dasm_put(Dst
, 5437);
8956 dasm_put(Dst
, 5465);
8959 dasm_put(Dst
, 5468);
8962 dasm_put(Dst
, 5471);
8965 dasm_put(Dst
, 5474);
8967 dasm_put(Dst
, 5476);
8969 dasm_put(Dst
, 5480);
8973 dasm_put(Dst
, 5484);
8976 dasm_put(Dst
, 5487);
8979 dasm_put(Dst
, 5490);
8982 dasm_put(Dst
, 5493);
8984 vk
= ((int)op
- BC_ADDVN
) / (BC_ADDNV
-BC_ADDVN
);
8987 dasm_put(Dst
, 5496);
8989 dasm_put(Dst
, 5498);
8991 dasm_put(Dst
, 5500);
8993 dasm_put(Dst
, 5503);
8995 dasm_put(Dst
, 5509);
8999 dasm_put(Dst
, 5513);
9001 dasm_put(Dst
, 5515);
9003 dasm_put(Dst
, 5517);
9005 dasm_put(Dst
, 5520);
9007 dasm_put(Dst
, 5526);
9011 dasm_put(Dst
, 5530);
9014 dasm_put(Dst
, 5540);
9018 dasm_put(Dst
, 5543);
9022 dasm_put(Dst
, 5566, Dt1(->base
), 32-3, Dt1(->base
));
9025 /* -- Constant ops ------------------------------------------------------ */
9028 dasm_put(Dst
, 5596, 32-1, LJ_TSTR
);
9032 dasm_put(Dst
, 5615, 32-1, LJ_TCDATA
);
9037 dasm_put(Dst
, 5634, 31-13);
9039 dasm_put(Dst
, 5650, 31-13, 31-20);
9043 dasm_put(Dst
, 5678);
9046 dasm_put(Dst
, 5691, 32-3);
9049 dasm_put(Dst
, 5706);
9052 /* -- Upvalue and function ops ------------------------------------------ */
9055 dasm_put(Dst
, 5725, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9058 dasm_put(Dst
, 5746, 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
);
9061 dasm_put(Dst
, 5799, 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
);
9064 dasm_put(Dst
, 5850, 32-1, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9067 dasm_put(Dst
, 5871, 32-1, 32-3, offsetof(GCfuncL
, uvptr
), DtA(->v
));
9071 dasm_put(Dst
, 5894, Dt1(->openupval
), 32-1, -(BCBIAS_J
*4 >> 16), Dt1(->base
), Dt1(->base
));
9075 dasm_put(Dst
, 5924, 32-1, Dt1(->base
), Dt1(->base
), LJ_TFUNC
);
9078 /* -- Table ops --------------------------------------------------------- */
9082 dasm_put(Dst
, 5952, DISPATCH_GL(gc
.total
), DISPATCH_GL(gc
.threshold
), Dt1(->base
));
9083 if (op
== BC_TNEW
) {
9084 dasm_put(Dst
, 5965);
9086 dasm_put(Dst
, 5974, 32-1);
9088 dasm_put(Dst
, 5981, Dt1(->base
), LJ_TTAB
);
9089 if (op
== BC_TNEW
) {
9090 dasm_put(Dst
, 5998);
9092 dasm_put(Dst
, 6003);
9097 dasm_put(Dst
, 6012, 32-1, Dt7(->env
));
9098 if (op
== BC_GGET
) {
9099 dasm_put(Dst
, 6020);
9101 dasm_put(Dst
, 6023);
9106 dasm_put(Dst
, 6026);
9108 dasm_put(Dst
, 6030);
9110 dasm_put(Dst
, 6032);
9112 dasm_put(Dst
, 6034, LJ_TTAB
);
9114 dasm_put(Dst
, 6040, Dt6(->asize
), Dt6(->array
), 31-3);
9116 dasm_put(Dst
, 6050, Dt6(->asize
), Dt6(->array
), 31-3);
9118 dasm_put(Dst
, 6067, LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
, LJ_TSTR
);
9120 dasm_put(Dst
, 6107);
9122 dasm_put(Dst
, 6109);
9125 dasm_put(Dst
, 6112, 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
));
9126 dasm_put(Dst
, 6173, LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
9129 dasm_put(Dst
, 6193, 32-3, LJ_TTAB
, Dt6(->asize
), Dt6(->array
), LJ_TNIL
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_index
);
9133 dasm_put(Dst
, 6241);
9135 dasm_put(Dst
, 6245);
9137 dasm_put(Dst
, 6247);
9139 dasm_put(Dst
, 6249, LJ_TTAB
);
9141 dasm_put(Dst
, 6255, Dt6(->asize
), Dt6(->array
), 31-3);
9143 dasm_put(Dst
, 6265, Dt6(->asize
), Dt6(->array
), 31-3);
9145 dasm_put(Dst
, 6282, Dt6(->marked
), LJ_TNIL
, LJ_GC_BLACK
, Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, LJ_TSTR
);
9147 dasm_put(Dst
, 6329);
9149 dasm_put(Dst
, 6331, DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9151 dasm_put(Dst
, 6346, LJ_TSTR
, LJ_TNIL
);
9153 dasm_put(Dst
, 6372, 32-1, LJ_TTAB
, Dt6(->hmask
), Dt5(->hash
), Dt6(->node
), Dt6(->nomm
), 31-5, 31-3, Dt6(->marked
), DtB(->key
), 4+offsetof(Node
, key
), DtB(->val
), 4+offsetof(Node
, val
), LJ_TSTR
, LJ_TNIL
);
9154 dasm_put(Dst
, 6423, LJ_GC_BLACK
, DtB(->val
), Dt6(->metatable
), Dt6(->nomm
), 1<<MM_newindex
, DtB(->next
), Dt6(->metatable
), DISPATCH_GL(tmptv
), Dt1(->base
), Dt6(->nomm
), 1<<MM_newindex
);
9155 dasm_put(Dst
, 6479, LJ_TSTR
, Dt1(->base
), DISPATCH_GL(gc
.grayagain
), DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9158 dasm_put(Dst
, 6504, 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
));
9159 dasm_put(Dst
, 6562, DISPATCH_GL(gc
.grayagain
), Dt6(->marked
), Dt6(->gclist
));
9163 dasm_put(Dst
, 6572, 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
));
9164 dasm_put(Dst
, 6641);
9167 /* -- Calls and vararg handling ----------------------------------------- */
9170 dasm_put(Dst
, 6644);
9173 dasm_put(Dst
, 6646, LJ_TFUNC
, Dt7(->pc
));
9177 dasm_put(Dst
, 6667);
9180 dasm_put(Dst
, 6669, LJ_TFUNC
, FRAME_TYPE
, Dt7(->ffid
), FRAME_VARG
, Dt7(->pc
), -4-8, Dt7(->pc
), PC2PROTO(k
), FRAME_TYPEP
);
9181 dasm_put(Dst
, 6733, FRAME_TYPE
);
9185 dasm_put(Dst
, 6742, LJ_TFUNC
, Dt7(->pc
));
9191 dasm_put(Dst
, 6769, Dt6(->asize
), Dt6(->array
), 31-3, LJ_TNIL
);
9193 dasm_put(Dst
, 6791);
9195 dasm_put(Dst
, 6794);
9197 dasm_put(Dst
, 6798, -(BCBIAS_J
*4 >> 16));
9199 dasm_put(Dst
, 6806);
9201 dasm_put(Dst
, 6808, Dt6(->hmask
), Dt6(->node
), 31-5, 31-3, LJ_TNIL
, DtB(->key
), -(BCBIAS_J
*4 >> 16));
9205 dasm_put(Dst
, 6864, 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));
9209 dasm_put(Dst
, 6914, FRAME_VARG
, Dt1(->maxstack
), Dt1(->top
), Dt1(->base
), 32-3, Dt1(->base
));
9210 dasm_put(Dst
, 6994);
9213 /* -- Returns ----------------------------------------------------------- */
9216 dasm_put(Dst
, 7000);
9220 dasm_put(Dst
, 7002, FRAME_TYPE
, FRAME_VARG
, Dt7(->pc
), PC2PROTO(k
), FRAME_TYPEP
);
9223 case BC_RET0
: case BC_RET1
:
9224 dasm_put(Dst
, 7072, FRAME_TYPE
, FRAME_VARG
);
9225 if (op
== BC_RET1
) {
9226 dasm_put(Dst
, 7085);
9228 dasm_put(Dst
, 7088, Dt7(->pc
), PC2PROTO(k
));
9231 /* -- Loops and branches ------------------------------------------------ */
9235 dasm_put(Dst
, 7116, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9246 vk
= (op
== BC_IFORL
|| op
== BC_JFORL
);
9248 dasm_put(Dst
, 7126, FORL_IDX
*8+4);
9250 dasm_put(Dst
, 7131, FORL_STEP
*8+4, FORL_STOP
*8+4, FORL_IDX
*8+4);
9252 dasm_put(Dst
, 7145, FORL_STEP
*8, FORL_STEP
*8+4, FORL_STOP
*8, FORL_STOP
*8+4);
9254 dasm_put(Dst
, 7161, FORL_EXT
*8);
9255 if (op
!= BC_JFORL
) {
9256 dasm_put(Dst
, 7168, 32-1);
9258 dasm_put(Dst
, 7171, FORL_EXT
*8+4);
9259 if (op
!= BC_JFORL
) {
9260 dasm_put(Dst
, 7174);
9262 if (op
== BC_FORI
) {
9263 dasm_put(Dst
, 7176);
9264 } else if (op
== BC_JFORI
) {
9265 dasm_put(Dst
, 7179, -(BCBIAS_J
*4 >> 16));
9266 } else if (op
== BC_IFORL
) {
9267 dasm_put(Dst
, 7184, -(BCBIAS_J
*4 >> 16));
9269 dasm_put(Dst
, 7189, BC_JLOOP
);
9271 dasm_put(Dst
, 7192);
9273 dasm_put(Dst
, 7208);
9278 dasm_put(Dst
, 7215, FORL_IDX
*8);
9280 dasm_put(Dst
, 7219);
9282 dasm_put(Dst
, 7221, FORL_STEP
*8, FORL_STOP
*8, FORL_STEP
*8, FORL_IDX
*8);
9285 dasm_put(Dst
, 7231);
9287 dasm_put(Dst
, 7233, FORL_STEP
*8, FORL_STOP
*8);
9289 dasm_put(Dst
, 7242, FORL_IDX
*8, FORL_STEP
*8, FORL_STOP
*8);
9291 dasm_put(Dst
, 7253);
9292 if (op
!= BC_JFORL
) {
9293 dasm_put(Dst
, 7255, 32-1);
9295 dasm_put(Dst
, 7258, FORL_EXT
*8);
9296 if (op
!= BC_JFORL
) {
9297 dasm_put(Dst
, 7261);
9299 dasm_put(Dst
, 7263);
9300 if (op
== BC_JFORI
) {
9301 dasm_put(Dst
, 7265, -(BCBIAS_J
*4 >> 16));
9303 dasm_put(Dst
, 7268);
9304 if (op
== BC_FORI
) {
9305 dasm_put(Dst
, 7271);
9306 } else if (op
== BC_IFORL
) {
9308 dasm_put(Dst
, 7274);
9310 dasm_put(Dst
, 7277);
9312 dasm_put(Dst
, 7280, -(BCBIAS_J
*4 >> 16));
9313 } else if (op
== BC_JFORI
) {
9314 dasm_put(Dst
, 7284);
9316 dasm_put(Dst
, 7287, BC_JLOOP
);
9319 dasm_put(Dst
, 7290);
9321 dasm_put(Dst
, 7293);
9323 dasm_put(Dst
, 7305);
9324 if (op
== BC_FORI
) {
9325 dasm_put(Dst
, 7307, -(BCBIAS_J
*4 >> 16));
9326 } else if (op
== BC_IFORL
) {
9327 dasm_put(Dst
, 7313);
9328 } else if (op
== BC_JFORI
) {
9329 dasm_put(Dst
, 7316);
9331 dasm_put(Dst
, 7319, BC_JLOOP
);
9333 dasm_put(Dst
, 7322);
9334 if (op
== BC_JFORI
) {
9335 dasm_put(Dst
, 7325, BC_JLOOP
);
9341 dasm_put(Dst
, 7331, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9350 dasm_put(Dst
, 7341, LJ_TNIL
);
9351 if (op
== BC_JITERL
) {
9352 dasm_put(Dst
, 7348, BC_JLOOP
);
9354 dasm_put(Dst
, 7353, 32-1, -(BCBIAS_J
*4 >> 16));
9356 dasm_put(Dst
, 7361);
9361 dasm_put(Dst
, 7373, GG_DISP2HOT
, -HOTCOUNT_LOOP
);
9366 dasm_put(Dst
, 7383);
9371 dasm_put(Dst
, 7394, DISPATCH_J(trace
), 32-1, DISPATCH_GL(vmstate
), DtD(->mcode
), DISPATCH_GL(jit_base
), DISPATCH_GL(jit_L
), GG_DISP2G
+32768);
9376 dasm_put(Dst
, 7413, 32-1, -(BCBIAS_J
*4 >> 16));
9379 /* -- Function headers -------------------------------------------------- */
9383 dasm_put(Dst
, 7429, GG_DISP2HOT
, -HOTCOUNT_CALL
);
9385 case BC_FUNCV
: /* NYI: compiled vararg functions. */
9393 dasm_put(Dst
, 7439, Dt1(->maxstack
), -4+PC2PROTO(numparams
), -4+PC2PROTO(k
), 31-3);
9394 if (op
!= BC_JFUNCF
) {
9395 dasm_put(Dst
, 7451);
9397 dasm_put(Dst
, 7454);
9398 if (op
== BC_JFUNCF
) {
9399 dasm_put(Dst
, 7459, BC_JLOOP
);
9401 dasm_put(Dst
, 7463);
9403 dasm_put(Dst
, 7472);
9410 dasm_put(Dst
, 7478);
9411 break; /* NYI: compiled vararg functions. */
9414 dasm_put(Dst
, 7480, Dt1(->maxstack
), 8+FRAME_VARG
, -4+PC2PROTO(k
), -4+PC2PROTO(numparams
), LJ_TNIL
);
9419 if (op
== BC_FUNCC
) {
9420 dasm_put(Dst
, 7533, Dt8(->f
));
9422 dasm_put(Dst
, 7536, DISPATCH_GL(wrapf
));
9424 dasm_put(Dst
, 7539, Dt1(->maxstack
), Dt1(->base
), Dt1(->top
), ~LJ_VMST_C
);
9425 if (op
== BC_FUNCCW
) {
9426 dasm_put(Dst
, 7552, Dt8(->f
));
9428 dasm_put(Dst
, 7555, DISPATCH_GL(vmstate
), Dt1(->base
), 31-3, Dt1(->top
), ~LJ_VMST_INTERP
, DISPATCH_GL(vmstate
));
9431 /* ---------------------------------------------------------------------- */
9434 fprintf(stderr
, "Error: undefined opcode BC_%s\n", bc_names
[op
]);
9440 static int build_backend(BuildCtx
*ctx
)
9444 dasm_growpc(Dst
, BC__MAX
);
9446 build_subroutines(ctx
);
9448 dasm_put(Dst
, 7576);
9449 for (op
= 0; op
< BC__MAX
; op
++)
9450 build_ins(ctx
, (BCOp
)op
, op
);
9455 /* Emit pseudo frame-info for all assembler functions. */
9456 static void emit_asm_debug(BuildCtx
*ctx
)
9459 switch (ctx
->mode
) {
9461 fprintf(ctx
->fp
, "\t.section .debug_frame,\"\",@progbits\n");
9464 "\t.long .LECIE0-.LSCIE0\n"
9466 "\t.long 0xffffffff\n"
9472 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9477 "\t.long .LEFDE0-.LASFDE0\n"
9479 "\t.long .Lframe0\n"
9482 "\t.byte 0xe\n\t.uleb128 %d\n"
9483 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9484 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
9485 (int)ctx
->codesz
, CFRAME_SIZE
);
9486 for (i
= 14; i
<= 31; i
++)
9488 "\t.byte %d\n\t.uleb128 %d\n"
9489 "\t.byte %d\n\t.uleb128 %d\n",
9490 0x80+i
, 37+(31-i
), 0x80+32+i
, 2+2*(31-i
));
9494 fprintf(ctx
->fp
, "\t.section .eh_frame,\"a\",@progbits\n");
9497 "\t.long .LECIE1-.LSCIE1\n"
9501 "\t.string \"zPR\"\n"
9505 "\t.uleb128 6\n" /* augmentation length */
9506 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9507 "\t.long lj_err_unwind_dwarf-.\n"
9508 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9509 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9514 "\t.long .LEFDE1-.LASFDE1\n"
9516 "\t.long .LASFDE1-.Lframe1\n"
9517 "\t.long .Lbegin-.\n"
9519 "\t.uleb128 0\n" /* augmentation length */
9520 "\t.byte 0xe\n\t.uleb128 %d\n"
9521 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9522 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
9523 (int)ctx
->codesz
, CFRAME_SIZE
);
9524 for (i
= 14; i
<= 31; i
++)
9526 "\t.byte %d\n\t.uleb128 %d\n"
9527 "\t.byte %d\n\t.uleb128 %d\n",
9528 0x80+i
, 37+(31-i
), 0x80+32+i
, 2+2*(31-i
));