fixed a wrong index used when getting the mod pointer into/from the prim object

This commit is contained in:
hyung-hwan 2018-02-28 05:04:42 +00:00
parent c865de4d61
commit 701554af0d
2 changed files with 4 additions and 3 deletions

View File

@ -960,7 +960,8 @@ static HCL_INLINE int call_primitive (hcl_t* hcl, hcl_ooi_t nargs)
hcl_oop_word_t rcv; hcl_oop_word_t rcv;
rcv = (hcl_oop_word_t)HCL_STACK_GETRCV(hcl, nargs); rcv = (hcl_oop_word_t)HCL_STACK_GETRCV(hcl, nargs);
HCL_ASSERT (hcl, HCL_IS_PRIM (hcl, rcv)); HCL_ASSERT (hcl, HCL_IS_PRIM(hcl, rcv));
HCL_ASSERT (hcl, HCL_OBJ_GET_SIZE(rcv) == 4);
if (nargs < rcv->slot[1] && nargs > rcv->slot[2]) if (nargs < rcv->slot[1] && nargs > rcv->slot[2])
{ {
@ -972,7 +973,7 @@ static HCL_INLINE int call_primitive (hcl_t* hcl, hcl_ooi_t nargs)
return -1; return -1;
} }
return ((hcl_pfimpl_t)rcv->slot[0]) (hcl, (hcl_mod_t*)rcv->slot[4], nargs); return ((hcl_pfimpl_t)rcv->slot[0]) (hcl, (hcl_mod_t*)rcv->slot[3], nargs);
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -49,7 +49,7 @@ hcl_oop_t hcl_makeprim (hcl_t* hcl, hcl_pfimpl_t primimpl, hcl_oow_t minargs, hc
obj->slot[0] = (hcl_oow_t)primimpl; obj->slot[0] = (hcl_oow_t)primimpl;
obj->slot[1] = minargs; obj->slot[1] = minargs;
obj->slot[2] = maxargs; obj->slot[2] = maxargs;
obj->slot[4] = (hcl_oow_t)mod; obj->slot[3] = (hcl_oow_t)mod;
} }
return (hcl_oop_t)obj; return (hcl_oop_t)obj;