updated the class-superclass compatibility check

This commit is contained in:
2025-09-18 01:09:04 +09:00
parent 8c54c12ea7
commit f8f063a68c
6 changed files with 12 additions and 17 deletions

View File

@ -693,7 +693,6 @@ static HAK_INLINE hak_oop_t make_bigint_with_ooi (hak_t* hak, hak_ooi_t i)
}
else
{
w = -i;
w = (i == HAK_TYPE_MIN(hak_ooi_t))? ((hak_oow_t)HAK_TYPE_MAX(hak_ooi_t) + 1): -i;
hw[0] = w /*& HAK_LBMASK(hak_oow_t,HAK_LIW_BITS)*/;
hw[1] = w >> HAK_LIW_BITS;
@ -4528,7 +4527,7 @@ hak_oop_t hak_strtoint (hak_t* hak, const hak_ooch_t* str, hak_oow_t len, int ra
if (outlen > HAK_COUNTOF(hw))
{
hwp = (hak_liw_t*)hak_allocmem(hak, outlen * HAK_SIZEOF(hak_liw_t));
if (!hwp) return HAK_NULL;
if (HAK_UNLIKELY(!hwp)) return HAK_NULL;
}
else
{

View File

@ -4997,7 +4997,7 @@ done:
return 0;
}
static int compile_cons_mlist_expression (hak_t* hak, hak_cnode_t* obj, int nrets)
static int compile_cons_mlist_expression (hak_t* hak, hak_cnode_t* obj, hak_ooi_t nrets)
{
hak_cnode_t* car, * cdr, * rcv;
hak_ooi_t nargs;

View File

@ -2394,7 +2394,7 @@ static HAK_INLINE int do_throw (hak_t* hak, hak_oop_t val, hak_ooi_t ip)
while (!HAK_CLSTACK_IS_EMPTY(hak)) HAK_CLSTACK_POP(hak);
f = hak->active_function;
if (f->dbgi != hak->_nil)
if (f->dbgi != hak->_nil && ip >= 0)
{
hak_dbgi_t* dbgi;
hak_loc_t loc;
@ -2416,7 +2416,7 @@ static HAK_INLINE int do_throw (hak_t* hak, hak_oop_t val, hak_ooi_t ip)
/* output backtrace */
HAK_LOG0(hak, HAK_LOG_IC | HAK_LOG_INFO, "[BACKTRACE]\n");
c = hak->active_context;
if ((hak_oop_t)c != hak->_nil)
if ((hak_oop_t)c != hak->_nil && ip >= 0)
{
hak_ooi_t cip;
@ -3437,6 +3437,8 @@ static int execute (hak_t* hak)
HAK_INIT_NTIME (&hak->gci.stat.mark, 0, 0);
HAK_INIT_NTIME (&hak->gci.stat.sweep, 0, 0);
fetched_instruction_pointer = -1;
while (1)
{
/* stop requested or no more runnable process */
@ -4135,7 +4137,7 @@ static int execute (hak_t* hak)
super_spec = HAK_OOP_TO_SMOOI(((hak_oop_class_t)superclass)->spec);
super_indexed_type = HAK_CLASS_SPEC_INDEXED_TYPE(super_spec);
if (super_indexed_type != b5)
if (HAK_CLASS_SPEC_NAMED_INSTVARS(super_spec) > 0 && super_indexed_type != b5)
{
/* TODO: include the class indexed type in the message .. */
hak_seterrbfmt(hak, HAK_ECALL, "incompatible %hs superclass %O with %hs class",

View File

@ -1211,13 +1211,13 @@ static int fmt_outv (hak_t* hak, hak_fmtout_t* fmtout, va_list ap)
if (fb.out.ptr == fb.out.sbuf)
{
fb.out.ptr = (hak_bch_t*)HAK_MMGR_ALLOC(fmtout->mmgr, HAK_SIZEOF(hak_bch_t) * (newcapa + 1));
if (!fb.out.ptr) goto oops;
if (HAK_UNLIKELY(!fb.out.ptr)) goto oops;
}
else
{
hak_bch_t* tmpptr;
tmpptr = (hak_bch_t*)HAK_MMGR_REALLOC(fmtout->mmgr, fb.out.ptr, HAK_SIZEOF(hak_bch_t) * (newcapa + 1));
if (!tmpptr) goto oops;
if (HAK_UNLIKELY(!tmpptr)) goto oops;
fb.out.ptr = tmpptr;
}
fb.out.capa = newcapa;

View File

@ -2458,7 +2458,7 @@ static int flx_comment (hak_t* hak, hak_ooci_t c)
* LANG_ENABLE_EOL mode.
* TODO: Consider removing this check because not consuming it
* in another mode doesn't cause a problem. */
if ((hak->option.trait & HAK_TRAIT_LANG_ENABLE_EOL)) return 0; /* not consumed */
if (hak->option.trait & HAK_TRAIT_LANG_ENABLE_EOL) return 0; /* not consumed */
}
return 1; /* consumed */
}