diff options
Diffstat (limited to 'src/lj_crecord.c')
-rw-r--r-- | src/lj_crecord.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c index e50fdbf7..7ae1479e 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c | |||
@@ -61,7 +61,8 @@ static GCcdata *argv2cdata(jit_State *J, TRef tr, cTValue *o) | |||
61 | static CTypeID crec_constructor(jit_State *J, GCcdata *cd, TRef tr) | 61 | static CTypeID crec_constructor(jit_State *J, GCcdata *cd, TRef tr) |
62 | { | 62 | { |
63 | CTypeID id; | 63 | CTypeID id; |
64 | lua_assert(tref_iscdata(tr) && cd->ctypeid == CTID_CTYPEID); | 64 | lj_assertJ(tref_iscdata(tr) && cd->ctypeid == CTID_CTYPEID, |
65 | "expected CTypeID cdata"); | ||
65 | id = *(CTypeID *)cdataptr(cd); | 66 | id = *(CTypeID *)cdataptr(cd); |
66 | tr = emitir(IRT(IR_FLOAD, IRT_INT), tr, IRFL_CDATA_INT); | 67 | tr = emitir(IRT(IR_FLOAD, IRT_INT), tr, IRFL_CDATA_INT); |
67 | emitir(IRTG(IR_EQ, IRT_INT), tr, lj_ir_kint(J, (int32_t)id)); | 68 | emitir(IRTG(IR_EQ, IRT_INT), tr, lj_ir_kint(J, (int32_t)id)); |
@@ -237,13 +238,14 @@ static void crec_copy(jit_State *J, TRef trdst, TRef trsrc, TRef trlen, | |||
237 | if (len > CREC_COPY_MAXLEN) goto fallback; | 238 | if (len > CREC_COPY_MAXLEN) goto fallback; |
238 | if (ct) { | 239 | if (ct) { |
239 | CTState *cts = ctype_ctsG(J2G(J)); | 240 | CTState *cts = ctype_ctsG(J2G(J)); |
240 | lua_assert(ctype_isarray(ct->info) || ctype_isstruct(ct->info)); | 241 | lj_assertJ(ctype_isarray(ct->info) || ctype_isstruct(ct->info), |
242 | "copy of non-aggregate"); | ||
241 | if (ctype_isarray(ct->info)) { | 243 | if (ctype_isarray(ct->info)) { |
242 | CType *cct = ctype_rawchild(cts, ct); | 244 | CType *cct = ctype_rawchild(cts, ct); |
243 | tp = crec_ct2irt(cts, cct); | 245 | tp = crec_ct2irt(cts, cct); |
244 | if (tp == IRT_CDATA) goto rawcopy; | 246 | if (tp == IRT_CDATA) goto rawcopy; |
245 | step = lj_ir_type_size[tp]; | 247 | step = lj_ir_type_size[tp]; |
246 | lua_assert((len & (step-1)) == 0); | 248 | lj_assertJ((len & (step-1)) == 0, "copy of fractional size"); |
247 | } else if ((ct->info & CTF_UNION)) { | 249 | } else if ((ct->info & CTF_UNION)) { |
248 | step = (1u << ctype_align(ct->info)); | 250 | step = (1u << ctype_align(ct->info)); |
249 | goto rawcopy; | 251 | goto rawcopy; |
@@ -629,7 +631,8 @@ static TRef crec_ct_tv(jit_State *J, CType *d, TRef dp, TRef sp, cTValue *sval) | |||
629 | /* Specialize to the name of the enum constant. */ | 631 | /* Specialize to the name of the enum constant. */ |
630 | emitir(IRTG(IR_EQ, IRT_STR), sp, lj_ir_kstr(J, str)); | 632 | emitir(IRTG(IR_EQ, IRT_STR), sp, lj_ir_kstr(J, str)); |
631 | if (cct && ctype_isconstval(cct->info)) { | 633 | if (cct && ctype_isconstval(cct->info)) { |
632 | lua_assert(ctype_child(cts, cct)->size == 4); | 634 | lj_assertJ(ctype_child(cts, cct)->size == 4, |
635 | "only 32 bit const supported"); /* NYI */ | ||
633 | svisnz = (void *)(intptr_t)(ofs != 0); | 636 | svisnz = (void *)(intptr_t)(ofs != 0); |
634 | sp = lj_ir_kint(J, (int32_t)ofs); | 637 | sp = lj_ir_kint(J, (int32_t)ofs); |
635 | sid = ctype_cid(cct->info); | 638 | sid = ctype_cid(cct->info); |
@@ -757,7 +760,7 @@ static void crec_index_bf(jit_State *J, RecordFFData *rd, TRef ptr, CTInfo info) | |||
757 | IRType t = IRT_I8 + 2*lj_fls(ctype_bitcsz(info)) + ((info&CTF_UNSIGNED)?1:0); | 760 | IRType t = IRT_I8 + 2*lj_fls(ctype_bitcsz(info)) + ((info&CTF_UNSIGNED)?1:0); |
758 | TRef tr = emitir(IRT(IR_XLOAD, t), ptr, 0); | 761 | TRef tr = emitir(IRT(IR_XLOAD, t), ptr, 0); |
759 | CTSize pos = ctype_bitpos(info), bsz = ctype_bitbsz(info), shift = 32 - bsz; | 762 | CTSize pos = ctype_bitpos(info), bsz = ctype_bitbsz(info), shift = 32 - bsz; |
760 | lua_assert(t <= IRT_U32); /* NYI: 64 bit bitfields. */ | 763 | lj_assertJ(t <= IRT_U32, "only 32 bit bitfields supported"); /* NYI */ |
761 | if (rd->data == 0) { /* __index metamethod. */ | 764 | if (rd->data == 0) { /* __index metamethod. */ |
762 | if ((info & CTF_BOOL)) { | 765 | if ((info & CTF_BOOL)) { |
763 | tr = emitir(IRTI(IR_BAND), tr, lj_ir_kint(J, (int32_t)((1u << pos)))); | 766 | tr = emitir(IRTI(IR_BAND), tr, lj_ir_kint(J, (int32_t)((1u << pos)))); |
@@ -769,7 +772,7 @@ static void crec_index_bf(jit_State *J, RecordFFData *rd, TRef ptr, CTInfo info) | |||
769 | tr = emitir(IRTI(IR_BSHL), tr, lj_ir_kint(J, shift - pos)); | 772 | tr = emitir(IRTI(IR_BSHL), tr, lj_ir_kint(J, shift - pos)); |
770 | tr = emitir(IRTI(IR_BSAR), tr, lj_ir_kint(J, shift)); | 773 | tr = emitir(IRTI(IR_BSAR), tr, lj_ir_kint(J, shift)); |
771 | } else { | 774 | } else { |
772 | lua_assert(bsz < 32); /* Full-size fields cannot end up here. */ | 775 | lj_assertJ(bsz < 32, "unexpected full bitfield index"); |
773 | tr = emitir(IRTI(IR_BSHR), tr, lj_ir_kint(J, pos)); | 776 | tr = emitir(IRTI(IR_BSHR), tr, lj_ir_kint(J, pos)); |
774 | tr = emitir(IRTI(IR_BAND), tr, lj_ir_kint(J, (int32_t)((1u << bsz)-1))); | 777 | tr = emitir(IRTI(IR_BAND), tr, lj_ir_kint(J, (int32_t)((1u << bsz)-1))); |
775 | /* We can omit the U32 to NUM conversion, since bsz < 32. */ | 778 | /* We can omit the U32 to NUM conversion, since bsz < 32. */ |
@@ -884,7 +887,7 @@ again: | |||
884 | crec_index_bf(J, rd, ptr, fct->info); | 887 | crec_index_bf(J, rd, ptr, fct->info); |
885 | return; | 888 | return; |
886 | } else { | 889 | } else { |
887 | lua_assert(ctype_isfield(fct->info)); | 890 | lj_assertJ(ctype_isfield(fct->info), "field expected"); |
888 | sid = ctype_cid(fct->info); | 891 | sid = ctype_cid(fct->info); |
889 | } | 892 | } |
890 | } | 893 | } |
@@ -1111,7 +1114,7 @@ static TRef crec_call_args(jit_State *J, RecordFFData *rd, | |||
1111 | if (fid) { /* Get argument type from field. */ | 1114 | if (fid) { /* Get argument type from field. */ |
1112 | CType *ctf = ctype_get(cts, fid); | 1115 | CType *ctf = ctype_get(cts, fid); |
1113 | fid = ctf->sib; | 1116 | fid = ctf->sib; |
1114 | lua_assert(ctype_isfield(ctf->info)); | 1117 | lj_assertJ(ctype_isfield(ctf->info), "field expected"); |
1115 | did = ctype_cid(ctf->info); | 1118 | did = ctype_cid(ctf->info); |
1116 | } else { | 1119 | } else { |
1117 | if (!(ct->info & CTF_VARARG)) | 1120 | if (!(ct->info & CTF_VARARG)) |