From 2d8dbea456b6d34316b26c06492aeecb724db045 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Fri, 22 Jan 2010 19:15:52 +0100 Subject: [PATCH] Save another few bytes by redefining ecl_bds_overflow() to return a pointer. --- src/c/stacks.d | 19 +++++-------------- src/h/external.h | 1 - src/h/stacks.h | 1 + 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/c/stacks.d b/src/c/stacks.d index 87df451fa..f2e4cd7f6 100644 --- a/src/c/stacks.d +++ b/src/c/stacks.d @@ -140,10 +140,6 @@ ecl_extend_bindings_array(cl_object vector) static cl_index ecl_bds_bind_special_case(cl_object s) { - if (s->symbol.binding == 0) { - printf("\nFOO\n"); - abort(); - } if (s->symbol.binding == ECL_MISSING_SPECIAL_BINDING) { return ecl_new_binding_index(s); } else { @@ -169,10 +165,7 @@ ecl_bds_bind(cl_env_ptr env, cl_object s, cl_object value) } location = env->thread_local_bindings + index; slot = ++env->bds_top; - if (slot >= env->bds_limit) { - ecl_bds_overflow(); - slot = env->bds_top; - } + if (slot >= env->bds_limit) slot = ecl_bds_overflow(); slot->symbol = s; slot->value = *location; *location = value; @@ -191,10 +184,7 @@ ecl_bds_push(cl_env_ptr env, cl_object s) } location = env->thread_local_bindings + index; slot = ++env->bds_top; - if (slot >= env->bds_limit) { - ecl_bds_overflow(); - slot = env->bds_top; - } + if (slot >= env->bds_limit) slot = ecl_bds_overflow(); slot->symbol = s; slot->value = *location; if (!(*location)) *location = s->symbol.value; @@ -213,7 +203,7 @@ cl_object * ecl_symbol_slot(cl_env_ptr env, cl_object s) { if (Null(s)) { - s = Cnil_symbol; + return &(Cnil_symbol->symbol.value); } else { cl_index index = s->symbol.binding; if (index < env->thread_local_bindings_size) { @@ -269,7 +259,7 @@ ecl_bds_set_size(cl_env_ptr env, cl_index size) } } -void +struct bds_bd * ecl_bds_overflow(void) { cl_env_ptr env = ecl_process_env(); @@ -285,6 +275,7 @@ ecl_bds_overflow(void) @'ext::stack-overflow', @':size', MAKE_FIXNUM(size), @':type', @'ext::binding-stack'); ecl_bds_set_size(env, size + (size / 2)); + return env->bds_top; } void diff --git a/src/h/external.h b/src/h/external.h index 78aa24894..6866df843 100644 --- a/src/h/external.h +++ b/src/h/external.h @@ -1484,7 +1484,6 @@ extern ECL_API cl_object si_reset_stack_limits(void); extern ECL_API cl_object si_set_limit(cl_object type, cl_object size); extern ECL_API cl_object si_get_limit(cl_object type); -extern ECL_API void ecl_bds_overflow(void) /*__attribute__((noreturn))*/; extern ECL_API cl_index ecl_progv(cl_env_ptr env, cl_object vars, cl_object values); extern ECL_API void ecl_bds_unwind(cl_env_ptr env, cl_index new_bds_top_index); extern ECL_API void ecl_unwind(cl_env_ptr env, ecl_frame_ptr fr) /*__attribute__((noreturn))*/; diff --git a/src/h/stacks.h b/src/h/stacks.h index 0fa9745da..1a7edf3b3 100644 --- a/src/h/stacks.h +++ b/src/h/stacks.h @@ -43,6 +43,7 @@ typedef struct bds_bd { typedef struct cl_env_struct *cl_env_ptr; +extern ECL_API struct bds_bd *ecl_bds_overflow(void) /*__attribute__((noreturn))*/; #ifdef ECL_THREADS #define ECL_MISSING_SPECIAL_BINDING (~((cl_index)0)) extern ECL_API void ecl_bds_bind(cl_env_ptr env, cl_object symbol, cl_object v);