stacks: rename bindings and runtime stack pointers stored in frs

They are named to follow the same convention hinting that it is an index, not a
pointer.
This commit is contained in:
Daniel Kochmański 2024-04-09 14:16:37 +02:00
parent 7db0a89f42
commit 6463cae89c
6 changed files with 18 additions and 18 deletions

View file

@ -211,7 +211,7 @@ asm_op(cl_env_ptr env, cl_fixnum code) {
static void
asm_clear(cl_env_ptr env, cl_index h) {
ECL_STACK_SET_INDEX(env, h);
ECL_STACK_UNWIND(env, h);
}
static void
@ -1446,7 +1446,7 @@ c_catch(cl_env_ptr env, cl_object args, int flags) {
static int
c_compiler_let(cl_env_ptr env, cl_object args, int flags) {
cl_object bindings;
cl_index old_bds_top_index = env->bds_stack.top - env->bds_stack.org;
cl_index old_bds_ndx = env->bds_stack.top - env->bds_stack.org;
for (bindings = pop(&args); !Null(bindings); ) {
cl_object form = pop(&bindings);
@ -1455,7 +1455,7 @@ c_compiler_let(cl_env_ptr env, cl_object args, int flags) {
ecl_bds_bind(env, var, value);
}
flags = compile_toplevel_body(env, args, flags);
ecl_bds_unwind(env, old_bds_top_index);
ecl_bds_unwind(env, old_bds_ndx);
return flags;
}

View file

@ -942,7 +942,7 @@ prepare_cif(cl_env_ptr the_env, ffi_cif *cif, cl_object return_type,
ffi_call(&cif, cfun, the_env->ffi_values, (void **)the_env->ffi_values_ptrs);
object = ecl_foreign_data_ref_elt(the_env->ffi_values,
ecl_foreign_type_code(return_type));
ECL_STACK_SET_INDEX(the_env, sp);
ECL_STACK_UNWIND(the_env, sp);
if (object != ECL_NIL) {
@(return object);
} else {

View file

@ -1276,7 +1276,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
THREAD_NEXT;
}
CASE(OP_PROTECT_NORMAL); {
ecl_bds_unwind(the_env, the_env->frs_stack.top->frs_bds_top_index);
ecl_bds_unwind(the_env, the_env->frs_stack.top->frs_bds_ndx);
ecl_frs_pop(the_env);
(void)ECL_STACK_POP_UNSAFE(the_env);
unwind_lcl(lcl_env, ECL_STACK_POP_UNSAFE(the_env));

View file

@ -290,7 +290,7 @@ ecl_stack_frame_close(cl_object f)
{
if (f->frame.opened) {
f->frame.opened = 0;
ECL_STACK_SET_INDEX(f->frame.env, f->frame.base);
ECL_STACK_UNWIND(f->frame.env, f->frame.base);
}
}
@ -364,9 +364,9 @@ ecl_bds_overflow(void)
}
void
ecl_bds_unwind(cl_env_ptr env, cl_index new_bds_top_index)
ecl_bds_unwind(cl_env_ptr env, cl_index new_bds_ndx)
{
ecl_bds_ptr new_bds_top = new_bds_top_index + env->bds_stack.org;
ecl_bds_ptr new_bds_top = env->bds_stack.org + new_bds_ndx;
ecl_bds_ptr bds = env->bds_stack.top;
for (; bds > new_bds_top; bds--)
#ifdef ECL_THREADS
@ -744,9 +744,9 @@ _ecl_frs_push(cl_env_ptr env)
output->frs_val = ECL_DUMMY_TAG;
AO_nop_full();
++env->frs_stack.top;
output->frs_bds_top_index = env->bds_stack.top - env->bds_stack.org;
output->frs_bds_ndx = env->bds_stack.top - env->bds_stack.org;
output->frs_run_ndx = ECL_STACK_INDEX(env);
output->frs_ihs = env->ihs_stack.top;
output->frs_sp = ECL_STACK_INDEX(env);
return output;
}
@ -760,8 +760,8 @@ ecl_unwind(cl_env_ptr env, ecl_frame_ptr fr)
--top;
}
env->ihs_stack.top = top->frs_ihs;
ecl_bds_unwind(env, top->frs_bds_top_index);
ECL_STACK_SET_INDEX(env, top->frs_sp);
ecl_bds_unwind(env, top->frs_bds_ndx);
ECL_STACK_UNWIND(env, top->frs_run_ndx);
env->frs_stack.top = top;
ecl_longjmp(env->frs_stack.top->frs_jmpbuf, 1);
/* never reached */
@ -801,7 +801,7 @@ cl_object
si_frs_bds(cl_object arg)
{
cl_env_ptr env = ecl_process_env();
ecl_return1(env, ecl_make_fixnum(get_frame_ptr(arg)->frs_bds_top_index));
ecl_return1(env, ecl_make_fixnum(get_frame_ptr(arg)->frs_bds_ndx));
}
cl_object

View file

@ -1648,7 +1648,7 @@ 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 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_bds_unwind(cl_env_ptr env, cl_index new_bds_ndx);
extern ECL_API void ecl_unwind(cl_env_ptr env, struct ecl_frame *fr) ecl_attr_noreturn;
extern ECL_API struct ecl_frame *frs_sch(cl_object frame_id);

View file

@ -280,9 +280,9 @@ typedef struct ecl_ihs_frame {
typedef struct ecl_frame {
jmp_buf frs_jmpbuf;
cl_object frs_val;
cl_index frs_bds_top_index;
ecl_ihs_ptr frs_ihs;
cl_index frs_sp;
cl_index frs_bds_ndx;
cl_index frs_run_ndx;
} *ecl_frame_ptr;
extern ECL_API ecl_frame_ptr _ecl_frs_push(cl_env_ptr);
@ -408,9 +408,9 @@ ecl_data_stack_set_index(cl_env_ptr env, cl_index ndx)
#define ECL_STACK_REF(env,n) ((env)->run_stack.top[n])
#define ECL_STACK_INDEX(env) ecl_data_stack_index(env)
#define ECL_STACK_SET_INDEX(env,ndx) ecl_data_stack_set_index(env,ndx)
#define ECL_STACK_PUSH(env,o) ecl_data_stack_push(env,o)
#define ECL_STACK_UNWIND(env,ndx) ecl_data_stack_set_index(env,ndx)
#define ECL_STACK_PUSH_N(env,n) ecl_data_stack_push_n(env,n)
#define ECL_STACK_PUSH(env,o) ecl_data_stack_push(env,o)
#define ECL_STACK_POP_UNSAFE(env) ecl_data_stack_pop_unsafe(env)
#define ECL_STACK_POP_N_UNSAFE(env,o) ecl_data_stack_pop_n_unsafe(env,o)