exceptions: runtime stack error signals exceptions (not conditions)

Replace calls to CEstack_overflow with exceptions - this is a necessary step
before moving stacks into nucleus.
This commit is contained in:
Daniel Kochmański 2026-03-03 14:53:32 +01:00
parent 4b389b5341
commit 827fbfc268
2 changed files with 9 additions and 7 deletions

View file

@ -42,19 +42,19 @@ VEbad_lambda_odd_keys(cl_object bytecodes, cl_object frame)
static void
VEwrong_arg_type_endp(cl_object reg0)
{
ecl_ferror(ECL_EX_VM_BADARG_ENDP, ECL_NIL, reg0);
ecl_ferror(ECL_EX_VM_BADARG_ENDP, reg0, ECL_NIL);
}
static void
VEwrong_arg_type_car(cl_object reg0)
{
ecl_ferror(ECL_EX_VM_BADARG_CAR, ECL_NIL, reg0);
ecl_ferror(ECL_EX_VM_BADARG_CAR, reg0, ECL_NIL);
}
static void
VEwrong_arg_type_cdr(cl_object reg0)
{
ecl_ferror(ECL_EX_VM_BADARG_CDR, ECL_NIL, reg0);
ecl_ferror(ECL_EX_VM_BADARG_CDR, reg0, ECL_NIL);
}
static void

View file

@ -20,6 +20,7 @@
# include <sys/time.h>
# include <sys/resource.h>
#endif
#include <ecl/nucleus.h>
#include <ecl/ecl-inl.h>
#include <ecl/internal.h>
#include <ecl/stack-resize.h>
@ -162,9 +163,9 @@ ecl_cs_overflow(void)
else
ecl_internal_error(stack_overflow_msg);
if (env->c_stack.max_size == (cl_index)0 || env->c_stack.size < env->c_stack.max_size)
CEstack_overflow(@'ext::c-stack', ecl_make_fixnum(size), ECL_T);
ecl_cerror(ECL_EX_CS_OVR, ecl_make_fixnum(size), ECL_T);
else
CEstack_overflow(@'ext::c-stack', ecl_make_fixnum(size), ECL_NIL);
ecl_ferror(ECL_EX_CS_OVR, ecl_make_fixnum(size), ECL_NIL);
}
/* -- Data stack ------------------------------------------------------------ */
@ -402,13 +403,14 @@ ecl_bds_overflow(void)
cl_env_ptr env = ecl_process_env();
cl_index margin = ecl_option_values[ECL_OPT_BIND_STACK_SAFETY_AREA];
cl_index size = env->bds_stack.size;
cl_index limit_size = env->bds_stack.limit_size;
ecl_bds_ptr org = env->bds_stack.org;
ecl_bds_ptr last = org + size;
if (env->bds_stack.limit >= last) {
ecl_internal_error(stack_overflow_msg);
}
env->bds_stack.limit += margin;
CEstack_overflow(@'ext::binding-stack', ecl_make_fixnum(size), ECL_T);
ecl_cerror(ECL_EX_BDS_OVR, ecl_make_fixnum(limit_size), ECL_T);
return env->bds_stack.top;
}
@ -687,7 +689,7 @@ frs_overflow(void)
ecl_internal_error(stack_overflow_msg);
}
env->frs_stack.limit += margin;
CEstack_overflow(@'ext::frame-stack', ecl_make_fixnum(limit_size), ECL_T);
ecl_cerror(ECL_EX_FRS_OVR, ecl_make_fixnum(limit_size), ECL_T);
}
ecl_frame_ptr