fixed an argument passing handling bug
This commit is contained in:
parent
15208b5e85
commit
5db3bbd8d8
19
lib/exec.c
19
lib/exec.c
@ -947,7 +947,7 @@ static int __activate_context (hcl_t* hcl, hcl_oop_context_t rcv_blkctx, hcl_ooi
|
|||||||
/* copy the arguments to the stack */
|
/* copy the arguments to the stack */
|
||||||
for (i = 0; i < nargs; i++)
|
for (i = 0; i < nargs; i++)
|
||||||
{
|
{
|
||||||
blkctx->slot[i] = HCL_STACK_GETARG(hcl, nargs, 0);
|
blkctx->slot[i] = HCL_STACK_GETARG(hcl, nargs, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
HCL_STACK_POPS (hcl, nargs + 1); /* pop arguments and receiver */
|
HCL_STACK_POPS (hcl, nargs + 1); /* pop arguments and receiver */
|
||||||
@ -1537,21 +1537,28 @@ return -1;
|
|||||||
{
|
{
|
||||||
hcl_oop_t rcv;
|
hcl_oop_t rcv;
|
||||||
|
|
||||||
handle_call:
|
|
||||||
b1 = bcode & 0x3; /* low 2 bits */
|
b1 = bcode & 0x3; /* low 2 bits */
|
||||||
|
handle_call:
|
||||||
LOG_INST_1 (hcl, "call %zu", b1);
|
LOG_INST_1 (hcl, "call %zu", b1);
|
||||||
|
|
||||||
rcv = HCL_STACK_GETRCV (hcl, b1);
|
rcv = HCL_STACK_GETRCV (hcl, b1);
|
||||||
if (HCL_IS_CONTEXT(hcl, rcv))
|
if (HCL_OOP_IS_POINTER(rcv))
|
||||||
{
|
{
|
||||||
|
switch (HCL_OBJ_GET_FLAGS_BRAND(rcv))
|
||||||
|
{
|
||||||
|
case HCL_BRAND_CONTEXT:
|
||||||
if (activate_context (hcl, b1) <= -1) return -1;
|
if (activate_context (hcl, b1) <= -1) return -1;
|
||||||
}
|
break;
|
||||||
else if (HCL_IS_PRIM(hcl, rcv))
|
case HCL_BRAND_PRIM:
|
||||||
{
|
|
||||||
if (call_primitive (hcl, b1) <= -1) return -1;
|
if (call_primitive (hcl, b1) <= -1) return -1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto cannot_call;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
cannot_call:
|
||||||
/* run time error */
|
/* run time error */
|
||||||
HCL_LOG1 (hcl, HCL_LOG_IC | HCL_LOG_ERROR, "Error - cannot call %O\n", rcv);
|
HCL_LOG1 (hcl, HCL_LOG_IC | HCL_LOG_ERROR, "Error - cannot call %O\n", rcv);
|
||||||
hcl->errnum = HCL_ECALL;
|
hcl->errnum = HCL_ECALL;
|
||||||
|
Loading…
Reference in New Issue
Block a user