diff options
Diffstat (limited to 'src/lj_ctype.c')
-rw-r--r-- | src/lj_ctype.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lj_ctype.c b/src/lj_ctype.c index 7e96e1bc..0e3f8855 100644 --- a/src/lj_ctype.c +++ b/src/lj_ctype.c | |||
@@ -153,7 +153,7 @@ CTypeID lj_ctype_new(CTState *cts, CType **ctp) | |||
153 | { | 153 | { |
154 | CTypeID id = cts->top; | 154 | CTypeID id = cts->top; |
155 | CType *ct; | 155 | CType *ct; |
156 | lua_assert(cts->L); | 156 | lj_assertCTS(cts->L, "uninitialized cts->L"); |
157 | if (LJ_UNLIKELY(id >= cts->sizetab)) { | 157 | if (LJ_UNLIKELY(id >= cts->sizetab)) { |
158 | if (id >= CTID_MAX) lj_err_msg(cts->L, LJ_ERR_TABOV); | 158 | if (id >= CTID_MAX) lj_err_msg(cts->L, LJ_ERR_TABOV); |
159 | #ifdef LUAJIT_CTYPE_CHECK_ANCHOR | 159 | #ifdef LUAJIT_CTYPE_CHECK_ANCHOR |
@@ -182,7 +182,7 @@ CTypeID lj_ctype_intern(CTState *cts, CTInfo info, CTSize size) | |||
182 | { | 182 | { |
183 | uint32_t h = ct_hashtype(info, size); | 183 | uint32_t h = ct_hashtype(info, size); |
184 | CTypeID id = cts->hash[h]; | 184 | CTypeID id = cts->hash[h]; |
185 | lua_assert(cts->L); | 185 | lj_assertCTS(cts->L, "uninitialized cts->L"); |
186 | while (id) { | 186 | while (id) { |
187 | CType *ct = ctype_get(cts, id); | 187 | CType *ct = ctype_get(cts, id); |
188 | if (ct->info == info && ct->size == size) | 188 | if (ct->info == info && ct->size == size) |
@@ -298,9 +298,9 @@ CTSize lj_ctype_vlsize(CTState *cts, CType *ct, CTSize nelem) | |||
298 | } | 298 | } |
299 | ct = ctype_raw(cts, arrid); | 299 | ct = ctype_raw(cts, arrid); |
300 | } | 300 | } |
301 | lua_assert(ctype_isvlarray(ct->info)); /* Must be a VLA. */ | 301 | lj_assertCTS(ctype_isvlarray(ct->info), "VLA expected"); |
302 | ct = ctype_rawchild(cts, ct); /* Get array element. */ | 302 | ct = ctype_rawchild(cts, ct); /* Get array element. */ |
303 | lua_assert(ctype_hassize(ct->info)); | 303 | lj_assertCTS(ctype_hassize(ct->info), "bad VLA without size"); |
304 | /* Calculate actual size of VLA and check for overflow. */ | 304 | /* Calculate actual size of VLA and check for overflow. */ |
305 | xsz += (uint64_t)ct->size * nelem; | 305 | xsz += (uint64_t)ct->size * nelem; |
306 | return xsz < 0x80000000u ? (CTSize)xsz : CTSIZE_INVALID; | 306 | return xsz < 0x80000000u ? (CTSize)xsz : CTSIZE_INVALID; |
@@ -323,7 +323,8 @@ CTInfo lj_ctype_info(CTState *cts, CTypeID id, CTSize *szp) | |||
323 | } else { | 323 | } else { |
324 | if (!(qual & CTFP_ALIGNED)) qual |= (info & CTF_ALIGN); | 324 | if (!(qual & CTFP_ALIGNED)) qual |= (info & CTF_ALIGN); |
325 | qual |= (info & ~(CTF_ALIGN|CTMASK_CID)); | 325 | qual |= (info & ~(CTF_ALIGN|CTMASK_CID)); |
326 | lua_assert(ctype_hassize(info) || ctype_isfunc(info)); | 326 | lj_assertCTS(ctype_hassize(info) || ctype_isfunc(info), |
327 | "ctype without size"); | ||
327 | *szp = ctype_isfunc(info) ? CTSIZE_INVALID : ct->size; | 328 | *szp = ctype_isfunc(info) ? CTSIZE_INVALID : ct->size; |
328 | break; | 329 | break; |
329 | } | 330 | } |
@@ -528,7 +529,7 @@ static void ctype_repr(CTRepr *ctr, CTypeID id) | |||
528 | ctype_appc(ctr, ')'); | 529 | ctype_appc(ctr, ')'); |
529 | break; | 530 | break; |
530 | default: | 531 | default: |
531 | lua_assert(0); | 532 | lj_assertG_(ctr->cts->g, 0, "bad ctype %08x", info); |
532 | break; | 533 | break; |
533 | } | 534 | } |
534 | ct = ctype_get(ctr->cts, ctype_cid(info)); | 535 | ct = ctype_get(ctr->cts, ctype_cid(info)); |