added 'class_push_exit'

enhanced the compiler to produce 'pop_stacktop' at the end of the class if the class body is not empty
This commit is contained in:
2021-12-24 00:05:58 +00:00
parent a24f591074
commit 3d4e161a5f
5 changed files with 42 additions and 22 deletions

View File

@ -3367,16 +3367,21 @@ if (do_throw(hcl, hcl->_nil, fetched_instruction_pointer) <= -1)
case HCL_CODE_CLASS_EXIT:
{
hcl_oop_t c;
LOG_INST_0 (hcl, "class_exit");
/* TODO: stack underflow check? */
#if 0
HCL_CLSTACK_POP (hcl);
break;
}
case HCL_CODE_CLASS_PUSH_EXIT:
{
hcl_oop_t c;
LOG_INST_0 (hcl, "class_push_exit");
/* TODO: stack underflow check? */
HCL_CLSTACK_POP_TO (hcl, c);
HCL_STACK_PUSH (hcl, c);
#else
HCL_CLSTACK_POP (hcl);
#endif
break;
}
/* -------------------------------------------------------- */