From 827fbfc26862dd9ea61598baf066597602496547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Tue, 3 Mar 2026 14:53:32 +0100 Subject: [PATCH] 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. --- src/c/interpreter.d | 6 +++--- src/c/stacks.d | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/c/interpreter.d b/src/c/interpreter.d index eaae2b4c3..be3214c71 100644 --- a/src/c/interpreter.d +++ b/src/c/interpreter.d @@ -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 diff --git a/src/c/stacks.d b/src/c/stacks.d index 70d5d4d1a..4a6a81b5c 100644 --- a/src/c/stacks.d +++ b/src/c/stacks.d @@ -20,6 +20,7 @@ # include # include #endif +#include #include #include #include @@ -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