stacks: rename env runtime stack operators ecl_vms_*

ecl_stack_* was not specific enough.
This commit is contained in:
Daniel Kochmański 2024-04-09 08:25:04 +02:00
parent f2cc791c1b
commit 6dcff2267b
9 changed files with 111 additions and 111 deletions

View file

@ -53,7 +53,7 @@
typedef struct cl_compiler_env *cl_compiler_ptr;
#define asm_begin(env) current_pc(env)
#define current_pc(env) ecl_stack_index(env)
#define current_pc(env) ecl_vms_index(env)
#define set_pc(env,n) asm_clear(env,n)
#define asm_ref(env,n) (cl_fixnum)((env)->run_stack.org[n])
static void asm_clear(cl_env_ptr env, cl_index h);
@ -206,12 +206,12 @@ asm_end(cl_env_ptr env, cl_index beginning, cl_object definition) {
static void
asm_op(cl_env_ptr env, cl_fixnum code) {
cl_object v = (cl_object)code;
ecl_stack_push(env,v);
ecl_vms_push(env,v);
}
static void
asm_clear(cl_env_ptr env, cl_index h) {
ecl_stack_set_index_unsafe(env, h);
ecl_vms_unwind(env, h);
}
static void
@ -2813,7 +2813,7 @@ save_bytecodes(cl_env_ptr env, cl_index start, cl_index end)
cl_object bytecodes = ecl_alloc_simple_vector(l, ecl_aet_index);
cl_index *p;
for (p = bytecodes->vector.self.index; end > start; end--, p++) {
*p = (cl_index)ecl_stack_pop_unsafe(env);
*p = (cl_index)ecl_vms_pop_unsafe(env);
}
return bytecodes;
}
@ -2824,7 +2824,7 @@ restore_bytecodes(cl_env_ptr env, cl_object bytecodes)
cl_index *p = bytecodes->vector.self.index;
cl_index l;
for (l = bytecodes->vector.dim; l; l--) {
ecl_stack_push(env, (cl_object)p[l-1]);
ecl_vms_push(env, (cl_object)p[l-1]);
}
ecl_dealloc(bytecodes);
}

View file

@ -904,7 +904,7 @@ prepare_cif(cl_env_ptr the_env, ffi_cif *cif, cl_object return_type,
/* Push the newly allocated object onto the stack so that it
* is reachable by the garbage collector */
if (ECL_CONS_CAR(args) != object) {
ecl_stack_push(the_env, object);
ecl_vms_push(the_env, object);
}
}
args = ECL_CONS_CDR(args);
@ -937,12 +937,12 @@ prepare_cif(cl_env_ptr the_env, ffi_cif *cif, cl_object return_type,
volatile cl_index sp;
ffi_cif cif;
@ {
sp = ecl_stack_index(the_env);
sp = ecl_vms_index(the_env);
prepare_cif(the_env, &cif, return_type, arg_types, args, cc_type, NULL);
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_unsafe(the_env, sp);
ecl_vms_unwind(the_env, sp);
if (object != ECL_NIL) {
@(return object);
} else {

View file

@ -421,7 +421,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
Inlined forms for some functions which act on reg0 and stack.
*/
CASE(OP_CONS); {
cl_object car = ecl_stack_pop_unsafe(the_env);
cl_object car = ecl_vms_pop_unsafe(the_env);
reg0 = CONS(car, reg0);
THREAD_NEXT;
}
@ -447,7 +447,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
cl_index n;
GET_OPARG(n, vector);
while (--n) {
reg0 = CONS(ecl_stack_pop_unsafe(the_env), reg0);
reg0 = CONS(ecl_vms_pop_unsafe(the_env), reg0);
}
THREAD_NEXT;
}
@ -475,7 +475,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_PINT); {
cl_fixnum n;
GET_OPARG(n, vector);
ecl_stack_push(the_env, ecl_make_fixnum(n));
ecl_vms_push(the_env, ecl_make_fixnum(n));
THREAD_NEXT;
}
@ -483,7 +483,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
Pushes the object in REG0.
*/
CASE(OP_PUSH); {
ecl_stack_push(the_env, reg0);
ecl_vms_push(the_env, reg0);
THREAD_NEXT;
}
/* OP_PUSHV n{lcl}
@ -494,13 +494,13 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_PUSHV); {
int ndx;
GET_OPARG(ndx, vector);
ecl_stack_push(the_env, ecl_lcl_env_get_var(lcl_env, ndx));
ecl_vms_push(the_env, ecl_lcl_env_get_var(lcl_env, ndx));
THREAD_NEXT;
}
CASE(OP_PUSHVC); {
int ndx;
GET_OPARG(ndx, vector);
ecl_stack_push(the_env, ecl_lex_env_get_var(lex_env, ndx));
ecl_vms_push(the_env, ecl_lex_env_get_var(lex_env, ndx));
THREAD_NEXT;
}
CASE(OP_PUSHVS); {
@ -509,7 +509,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
value = ECL_SYM_VAL(the_env, var_name);
if (ecl_unlikely(value == OBJNULL))
VEunbound_variable(var_name);
ecl_stack_push(the_env, value);
ecl_vms_push(the_env, value);
THREAD_NEXT;
}
/* OP_PUSHQ n{arg}
@ -518,7 +518,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_PUSHQ); {
cl_object aux;
GET_DATA(aux, vector, data);
ecl_stack_push(the_env, aux);
ecl_vms_push(the_env, aux);
THREAD_NEXT;
}
@ -540,7 +540,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
the_env->function = ECL_SYM_FUN(s);
f = ECL_SYM_FUN(s)->cfun.entry;
SETUP_ENV(the_env);
reg0 = f(2, ecl_stack_pop_unsafe(the_env), reg0);
reg0 = f(2, ecl_vms_pop_unsafe(the_env), reg0);
THREAD_NEXT;
}
@ -574,7 +574,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
*/
CASE(OP_FCALL); {
GET_OPARG(narg, vector);
reg0 = ECL_STACK_REF(the_env,-narg-1);
reg0 = ECL_VMS_REF(the_env,-narg-1);
INTERPRET_FUNCALL(reg0, the_env, frame_aux, narg, reg0);
THREAD_NEXT;
}
@ -584,8 +584,8 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
the stack (They all have been deposited by OP_PUSHVALUES)
*/
CASE(OP_MCALL); {
narg = ecl_fixnum(ecl_stack_pop_unsafe(the_env));
reg0 = ECL_STACK_REF(the_env,-narg-1);
narg = ecl_fixnum(ecl_vms_pop_unsafe(the_env));
reg0 = ECL_VMS_REF(the_env,-narg-1);
INTERPRET_FUNCALL(reg0, the_env, frame_aux, narg, reg0);
THREAD_NEXT;
}
@ -594,14 +594,14 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
Pops a single value pushed by a OP_PUSH* operator.
*/
CASE(OP_POP); {
reg0 = ecl_stack_pop_unsafe(the_env);
reg0 = ecl_vms_pop_unsafe(the_env);
THREAD_NEXT;
}
/* OP_POP1
Pops a single value pushed by a OP_PUSH* operator, ignoring it.
*/
CASE(OP_POP1); {
(void)ecl_stack_pop_unsafe(the_env);
(void)ecl_vms_pop_unsafe(the_env);
THREAD_NEXT;
}
/* OP_POPREQ
@ -624,7 +624,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
if (frame_index >= frame->frame.size) {
reg0 = ECL_NIL;
} else {
ecl_stack_push(the_env, ECL_STACK_FRAME_REF(frame, frame_index++));
ecl_vms_push(the_env, ECL_STACK_FRAME_REF(frame, frame_index++));
reg0 = ECL_T;
}
THREAD_NEXT;
@ -676,8 +676,8 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
}
}
}
if (flag != ECL_NIL) ecl_stack_push(the_env, value);
ecl_stack_push(the_env, flag);
if (flag != ECL_NIL) ecl_vms_push(the_env, value);
ecl_vms_push(the_env, flag);
}
if (count && Null(aok)) {
cl_object *p = first;
@ -859,7 +859,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
output values are left in VALUES(...).
*/
CASE(OP_THROW); {
cl_object tag_name = ecl_stack_pop_unsafe(the_env);
cl_object tag_name = ecl_vms_pop_unsafe(the_env);
the_env->values[0] = reg0;
cl_throw(tag_name);
THREAD_NEXT;
@ -954,7 +954,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_PBIND); {
cl_object var_name;
GET_DATA(var_name, vector, data);
bind_var(lcl_env, var_name, ecl_stack_pop_unsafe(the_env));
bind_var(lcl_env, var_name, ecl_vms_pop_unsafe(the_env));
THREAD_NEXT;
}
CASE(OP_VBIND); {
@ -975,7 +975,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_PBINDS); {
cl_object var_name;
GET_DATA(var_name, vector, data);
ecl_bds_bind(the_env, var_name, ecl_stack_pop_unsafe(the_env));
ecl_bds_bind(the_env, var_name, ecl_vms_pop_unsafe(the_env));
THREAD_NEXT;
}
CASE(OP_VBINDS); {
@ -1027,20 +1027,20 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_PSETQ); {
int ndx;
GET_OPARG(ndx, vector);
ecl_lcl_env_set_var(lcl_env, ndx, ecl_stack_pop_unsafe(the_env));
ecl_lcl_env_set_var(lcl_env, ndx, ecl_vms_pop_unsafe(the_env));
THREAD_NEXT;
}
CASE(OP_PSETQC); {
int ndx;
GET_OPARG(ndx, vector);
ecl_lex_env_set_var(lex_env, ndx, ecl_stack_pop_unsafe(the_env));
ecl_lex_env_set_var(lex_env, ndx, ecl_vms_pop_unsafe(the_env));
THREAD_NEXT;
}
CASE(OP_PSETQS); {
cl_object var;
GET_DATA(var, vector, data);
/* INV: Not NIL, and of type t_symbol */
ECL_SETQ(the_env, var, ecl_stack_pop_unsafe(the_env));
ECL_SETQ(the_env, var, ecl_vms_pop_unsafe(the_env));
THREAD_NEXT;
}
CASE(OP_VSETQ); {
@ -1107,14 +1107,14 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_FRAME); {
cl_opcode *exit;
GET_LABEL(exit, vector);
ecl_stack_push(the_env, tangle_lcl(lcl_env));
ecl_stack_push(the_env, (cl_object)exit);
ecl_vms_push(the_env, tangle_lcl(lcl_env));
ecl_vms_push(the_env, (cl_object)exit);
ecl_frs_push(the_env,reg1);
if (__ecl_frs_push_result != 0) {
reg0 = the_env->values[0];
vector = (cl_opcode *)ECL_STACK_REF(the_env,-1); /* FIXME! */
vector = (cl_opcode *)ECL_VMS_REF(the_env,-1); /* FIXME! */
/* Unbind locals including the frame, we are leaving the frame. */
unwind_lcl(lcl_env, ECL_STACK_REF(the_env, -2));
unwind_lcl(lcl_env, ECL_VMS_REF(the_env,-2));
unbind_lcl(lcl_env, 1); /* unbind the frame */
goto DO_EXIT_FRAME;
}
@ -1136,17 +1136,17 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_TAGBODY); {
int n;
GET_OPARG(n, vector);
ecl_stack_push(the_env, tangle_lcl(lcl_env));
ecl_stack_push(the_env, (cl_object)vector); /* FIXME! */
ecl_vms_push(the_env, tangle_lcl(lcl_env));
ecl_vms_push(the_env, (cl_object)vector); /* FIXME! */
vector += n * OPARG_SIZE;
ecl_frs_push(the_env,reg1);
if (__ecl_frs_push_result != 0) {
/* Wait here for gotos. Each goto sets VALUES(0) to an integer which
ranges from 0 to ntags-1, depending on the tag. These numbers are
indices into the jump table and are computed at compile time. */
cl_opcode *table = (cl_opcode *)ECL_STACK_REF(the_env,-1);
cl_opcode *table = (cl_opcode *)ECL_VMS_REF(the_env,-1);
/* Unbind locals but leave the frame, we are still inside the frame. */
unwind_lcl(lcl_env, ECL_STACK_REF(the_env,-2));
unwind_lcl(lcl_env, ECL_VMS_REF(the_env,-2));
table = table + ecl_fixnum(the_env->values[0]) * OPARG_SIZE;
vector = table + *(cl_oparg *)table;
}
@ -1158,7 +1158,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_EXIT_FRAME); {
DO_EXIT_FRAME:
ecl_frs_pop(the_env);
ecl_stack_pop_n_unsafe(the_env, 2);
ecl_vms_pop_n_unsafe(the_env, 2);
THREAD_NEXT;
}
CASE(OP_NIL); {
@ -1166,7 +1166,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
THREAD_NEXT;
}
CASE(OP_PUSHNIL); {
ecl_stack_push(the_env, ECL_NIL);
ecl_vms_push(the_env, ECL_NIL);
THREAD_NEXT;
}
CASE(OP_VALUEREG0); {
@ -1181,22 +1181,22 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
PUSH_VALUES:
CASE(OP_PUSHVALUES); {
cl_index i = the_env->nvalues;
ecl_stack_push_n(the_env, i+1);
ecl_vms_push_n(the_env, i+1);
the_env->values[0] = reg0;
memcpy(&ECL_STACK_REF(the_env, -(i+1)), the_env->values, i * sizeof(cl_object));
ECL_STACK_REF(the_env, -1) = ecl_make_fixnum(the_env->nvalues);
memcpy(&ECL_VMS_REF(the_env, -(i+1)), the_env->values, i * sizeof(cl_object));
ECL_VMS_REF(the_env, -1) = ecl_make_fixnum(the_env->nvalues);
THREAD_NEXT;
}
/* OP_PUSHMOREVALUES
Adds more values to the ones pushed by OP_PUSHVALUES.
*/
CASE(OP_PUSHMOREVALUES); {
cl_index n = ecl_fixnum(ECL_STACK_REF(the_env,-1));
cl_index n = ecl_fixnum(ECL_VMS_REF(the_env,-1));
cl_index i = the_env->nvalues;
ecl_stack_push_n(the_env, i);
ecl_vms_push_n(the_env, i);
the_env->values[0] = reg0;
memcpy(&ECL_STACK_REF(the_env, -(i+1)), the_env->values, i * sizeof(cl_object));
ECL_STACK_REF(the_env, -1) = ecl_make_fixnum(n + i);
memcpy(&ECL_VMS_REF(the_env, -(i+1)), the_env->values, i * sizeof(cl_object));
ECL_VMS_REF(the_env, -1) = ecl_make_fixnum(n + i);
THREAD_NEXT;
}
/* OP_POPVALUES
@ -1204,16 +1204,16 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
*/
CASE(OP_POPVALUES); {
cl_object *dest = the_env->values;
int n = the_env->nvalues = ecl_fixnum(ecl_stack_pop_unsafe(the_env));
int n = the_env->nvalues = ecl_fixnum(ecl_vms_pop_unsafe(the_env));
if (n == 0) {
*dest = reg0 = ECL_NIL;
THREAD_NEXT;
} else if (n == 1) {
*dest = reg0 = ecl_stack_pop_unsafe(the_env);
*dest = reg0 = ecl_vms_pop_unsafe(the_env);
THREAD_NEXT;
} else {
ecl_stack_pop_n_unsafe(the_env,n);
memcpy(dest, &ECL_STACK_REF(the_env,0), n * sizeof(cl_object));
ecl_vms_pop_n_unsafe(the_env,n);
memcpy(dest, &ECL_VMS_REF(the_env,0), n * sizeof(cl_object));
reg0 = *dest;
THREAD_NEXT;
}
@ -1226,8 +1226,8 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
cl_fixnum n;
GET_OPARG(n, vector);
the_env->nvalues = n;
ecl_stack_pop_n_unsafe(the_env, n);
memcpy(the_env->values, &ECL_STACK_REF(the_env, 0), n * sizeof(cl_object));
ecl_vms_pop_n_unsafe(the_env, n);
memcpy(the_env->values, &ECL_VMS_REF(the_env, 0), n * sizeof(cl_object));
reg0 = the_env->values[0];
THREAD_NEXT;
}
@ -1236,7 +1236,7 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
The index N-th is extracted from the top of the stack.
*/
CASE(OP_NTHVAL); {
cl_fixnum n = ecl_fixnum(ecl_stack_pop_unsafe(the_env));
cl_fixnum n = ecl_fixnum(ecl_vms_pop_unsafe(the_env));
if (ecl_unlikely(n < 0)) {
VEwrong_arg_type_nth_val(n);
} else if ((cl_index)n >= the_env->nvalues) {
@ -1262,15 +1262,15 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_PROTECT); {
cl_opcode *exit;
GET_LABEL(exit, vector);
ecl_stack_push(the_env, tangle_lcl(lcl_env));
ecl_stack_push(the_env, (cl_object)exit);
ecl_vms_push(the_env, tangle_lcl(lcl_env));
ecl_vms_push(the_env, (cl_object)exit);
ecl_frs_push(the_env,ECL_PROTECT_TAG);
if (__ecl_frs_push_result != 0) {
ecl_frs_pop(the_env);
vector = (cl_opcode *)ecl_stack_pop_unsafe(the_env);
unwind_lcl(lcl_env, ecl_stack_pop_unsafe(the_env));
vector = (cl_opcode *)ecl_vms_pop_unsafe(the_env);
unwind_lcl(lcl_env, ecl_vms_pop_unsafe(the_env));
reg0 = the_env->values[0];
ecl_stack_push(the_env, ecl_make_fixnum(the_env->frs_stack.nlj_fr - the_env->frs_stack.top));
ecl_vms_push(the_env, ecl_make_fixnum(the_env->frs_stack.nlj_fr - the_env->frs_stack.top));
goto PUSH_VALUES;
}
THREAD_NEXT;
@ -1278,17 +1278,17 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
CASE(OP_PROTECT_NORMAL); {
ecl_bds_unwind(the_env, the_env->frs_stack.top->frs_bds_top_index);
ecl_frs_pop(the_env);
(void)ecl_stack_pop_unsafe(the_env);
unwind_lcl(lcl_env, ecl_stack_pop_unsafe(the_env));
ecl_stack_push(the_env, ecl_make_fixnum(1));
(void)ecl_vms_pop_unsafe(the_env);
unwind_lcl(lcl_env, ecl_vms_pop_unsafe(the_env));
ecl_vms_push(the_env, ecl_make_fixnum(1));
goto PUSH_VALUES;
}
CASE(OP_PROTECT_EXIT); {
volatile cl_fixnum n = the_env->nvalues = ecl_fixnum(ecl_stack_pop_unsafe(the_env));
volatile cl_fixnum n = the_env->nvalues = ecl_fixnum(ecl_vms_pop_unsafe(the_env));
while (n--)
the_env->values[n] = ecl_stack_pop_unsafe(the_env);
the_env->values[n] = ecl_vms_pop_unsafe(the_env);
reg0 = the_env->values[0];
n = ecl_fixnum(ecl_stack_pop_unsafe(the_env));
n = ecl_fixnum(ecl_vms_pop_unsafe(the_env));
if (n <= 0)
ecl_unwind(the_env, the_env->frs_stack.top + n);
THREAD_NEXT;
@ -1302,13 +1302,13 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
*/
CASE(OP_PROGV); {
cl_object values = reg0;
cl_object vars = ecl_stack_pop_unsafe(the_env);
cl_object vars = ecl_vms_pop_unsafe(the_env);
cl_index n = ecl_progv(the_env, vars, values);
ecl_stack_push(the_env, ecl_make_fixnum(n));
ecl_vms_push(the_env, ecl_make_fixnum(n));
THREAD_NEXT;
}
CASE(OP_EXIT_PROGV); {
cl_index n = ecl_fixnum(ecl_stack_pop_unsafe(the_env));
cl_index n = ecl_fixnum(ecl_vms_pop_unsafe(the_env));
ecl_bds_unwind(the_env, n);
THREAD_NEXT;
}
@ -1325,9 +1325,9 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
GET_DATA(form, vector, data);
SETUP_ENV(the_env);
the_env->values[0] = reg0;
n = ecl_stack_push_values(the_env);
n = ecl_vms_push_values(the_env);
call_stepper(the_env, form, ecl_make_fixnum(1));
ecl_stack_pop_values(the_env, n);
ecl_vms_pop_values(the_env, n);
reg0 = the_env->values[0];
THREAD_NEXT;
}
@ -1345,9 +1345,9 @@ ecl_interpret(cl_object frame, cl_object closure, cl_object bytecodes)
cl_index n;
SETUP_ENV(the_env);
the_env->values[0] = reg0;
n = ecl_stack_push_values(the_env);
n = ecl_vms_push_values(the_env);
call_stepper(the_env, ECL_NIL, ecl_make_fixnum(-1));
ecl_stack_pop_values(the_env, n);
ecl_vms_pop_values(the_env, n);
reg0 = the_env->values[0];
THREAD_NEXT;
}

View file

@ -910,7 +910,7 @@ static cl_object
sharp_asterisk_reader(cl_object in, cl_object c, cl_object d)
{
cl_env_ptr env = ecl_process_env();
cl_index sp = ecl_stack_index(env);
cl_index sp = ecl_vms_index(env);
cl_object last, elt, x;
cl_fixnum dim, dimcount, i;
cl_object rtbl = ecl_current_readtable();
@ -935,7 +935,7 @@ sharp_asterisk_reader(cl_object in, cl_object c, cl_object d)
FEreader_error("Character ~:C is not allowed after #*",
in, 1, ECL_CODE_CHAR(x));
}
ecl_stack_push(env, ecl_make_fixnum(x == '1'));
ecl_vms_push(env, ecl_make_fixnum(x == '1'));
}
if (Null(d)) {
dim = dimcount;
@ -951,7 +951,7 @@ sharp_asterisk_reader(cl_object in, cl_object c, cl_object d)
unlikely_if (dim && (dimcount == 0))
FEreader_error("Cannot fill the bit-vector #*.", in, 0);
}
last = ECL_STACK_REF(env,-1);
last = ECL_VMS_REF(env,-1);
x = ecl_alloc_simple_vector(dim, ecl_aet_bit);
for (i = 0; i < dim; i++) {
elt = (i < dimcount) ? env->run_stack.org[sp+i] : last;
@ -960,7 +960,7 @@ sharp_asterisk_reader(cl_object in, cl_object c, cl_object d)
else
x->vector.self.bit[i/CHAR_BIT] |= 0200 >> i%CHAR_BIT;
}
ecl_stack_pop_n_unsafe(env, dimcount);
ecl_vms_pop_n_unsafe(env, dimcount);
@(return x);
}

View file

@ -156,7 +156,7 @@ run_init(cl_env_ptr env)
}
cl_object *
ecl_stack_set_size(cl_env_ptr env, cl_index tentative_new_size)
ecl_vms_set_size(cl_env_ptr env, cl_index tentative_new_size)
{
cl_index top = env->run_stack.top - env->run_stack.org;
cl_object *new_stack, *old_stack;
@ -200,18 +200,18 @@ FEstack_underflow(void)
}
cl_object *
ecl_stack_grow(cl_env_ptr env)
ecl_vms_grow(cl_env_ptr env)
{
return ecl_stack_set_size(env, env->run_stack.size + env->run_stack.size / 2);
return ecl_vms_set_size(env, env->run_stack.size + env->run_stack.size / 2);
}
cl_index
ecl_stack_push_values(cl_env_ptr env) {
ecl_vms_push_values(cl_env_ptr env) {
cl_index i = env->nvalues;
cl_object *b = env->run_stack.top;
cl_object *p = b + i;
if (p >= env->run_stack.limit) {
b = ecl_stack_grow(env);
b = ecl_vms_grow(env);
p = b + i;
}
env->run_stack.top = p;
@ -220,7 +220,7 @@ ecl_stack_push_values(cl_env_ptr env) {
}
void
ecl_stack_pop_values(cl_env_ptr env, cl_index n) {
ecl_vms_pop_values(cl_env_ptr env, cl_index n) {
cl_object *p = env->run_stack.top - n;
if (ecl_unlikely(p < env->run_stack.org))
FEstack_underflow();
@ -236,7 +236,7 @@ ecl_stack_frame_open(cl_env_ptr env, cl_object f, cl_index size)
cl_index bindex;
if (size) {
if ((env->run_stack.limit - base) < size) {
base = ecl_stack_set_size(env, env->run_stack.size + size);
base = ecl_vms_set_size(env, env->run_stack.size + size);
}
}
bindex = ECL_STACK_INDEX(env);
@ -256,7 +256,7 @@ ecl_stack_frame_push(cl_object f, cl_object o)
cl_env_ptr env = f->frame.env;
cl_object *top = env->run_stack.top;
if (top >= env->run_stack.limit) {
top = ecl_stack_grow(env);
top = ecl_vms_grow(env);
}
env->run_stack.top = ++top;
*(top-1) = o;
@ -267,7 +267,7 @@ void
ecl_stack_frame_push_values(cl_object f)
{
cl_env_ptr env = f->frame.env;
ecl_stack_push_values(env);
ecl_vms_push_values(env);
f->frame.size += env->nvalues;
}
@ -290,7 +290,7 @@ ecl_stack_frame_close(cl_object f)
{
if (f->frame.opened) {
f->frame.opened = 0;
ecl_stack_set_index_unsafe(f->frame.env, f->frame.base);
ecl_vms_unwind(f->frame.env, f->frame.base);
}
}
@ -746,7 +746,7 @@ _ecl_frs_push(cl_env_ptr env)
++env->frs_stack.top;
output->frs_bds_top_index = env->bds_stack.top - env->bds_stack.org;
output->frs_ihs = env->ihs_stack.top;
output->frs_sp = ecl_stack_index(env);
output->frs_sp = ecl_vms_index(env);
return output;
}
@ -761,7 +761,7 @@ ecl_unwind(cl_env_ptr env, ecl_frame_ptr fr)
}
env->ihs_stack.top = top->frs_ihs;
ecl_bds_unwind(env, top->frs_bds_top_index);
ecl_stack_set_index_unsafe(env, top->frs_sp);
ecl_vms_unwind(env, top->frs_sp);
env->frs_stack.top = top;
ecl_longjmp(env->frs_stack.top->frs_jmpbuf, 1);
/* never reached */
@ -853,7 +853,7 @@ si_set_limit(cl_object type, cl_object limit)
cs_set_size(env, the_size + 2*margin);
} else if (type == @'ext::lisp-stack') {
cl_index the_size = ecl_to_size(limit);
ecl_stack_set_size(env, the_size);
ecl_vms_set_size(env, the_size);
} else if (type == @'ext::heap-size') {
/*
* size_t can be larger than cl_index, and ecl_to_size()

View file

@ -881,14 +881,14 @@ nstring_case(cl_narg narg, cl_object fun, ecl_casefun casefun, ecl_va_list ARGS)
for (i = 0, l = 0; i < narg; i++) {
cl_object s = si_coerce_to_base_string(ecl_va_arg(args));
if (s->base_string.fillp) {
ecl_stack_push(the_env, s);
ecl_vms_push(the_env, s);
l += s->base_string.fillp;
}
}
/* Do actual copying by recovering those strings */
output = ecl_alloc_simple_base_string(l);
while (l) {
cl_object s = ecl_stack_pop_unsafe(the_env);
cl_object s = ecl_vms_pop_unsafe(the_env);
size_t bytes = s->base_string.fillp;
l -= bytes;
memcpy(output->base_string.self + l, s->base_string.self, bytes);

View file

@ -542,10 +542,10 @@ extern ECL_API void ecl_stack_frame_close(cl_object f);
#define si_apply_from_stack_frame ecl_apply_from_stack_frame
extern ECL_API void FEstack_underflow(void) ecl_attr_noreturn;
extern ECL_API cl_object *ecl_stack_grow(cl_env_ptr env);
extern ECL_API cl_object *ecl_stack_set_size(cl_env_ptr env, cl_index new_size);
extern ECL_API cl_index ecl_stack_push_values(cl_env_ptr env);
extern ECL_API void ecl_stack_pop_values(cl_env_ptr env, cl_index n);
extern ECL_API cl_object *ecl_vms_grow(cl_env_ptr env);
extern ECL_API cl_object *ecl_vms_set_size(cl_env_ptr env, cl_index new_size);
extern ECL_API cl_index ecl_vms_push_values(cl_env_ptr env);
extern ECL_API void ecl_vms_pop_values(cl_env_ptr env, cl_index n);
extern ECL_API cl_object ecl_interpret(cl_object frame, cl_object env, cl_object bytecodes);
extern ECL_API cl_object _ecl_bytecodes_dispatch(cl_narg narg, ...);
extern ECL_API cl_object _ecl_bclosure_dispatch(cl_narg narg, ...);

View file

@ -552,10 +552,10 @@ extern cl_object ecl_deserialize(uint8_t *data);
/* stacks.d */
#define CL_NEWENV_BEGIN {\
const cl_env_ptr the_env = ecl_process_env(); \
cl_index __i = ecl_stack_push_values(the_env); \
cl_index __i = ecl_vms_push_values(the_env); \
#define CL_NEWENV_END \
ecl_stack_pop_values(the_env,__i); }
ecl_vms_pop_values(the_env,__i); }
extern void ecl_cs_init(cl_env_ptr env);

View file

@ -364,46 +364,46 @@ extern ECL_API ecl_frame_ptr _ecl_frs_push(cl_env_ptr);
* LISP STACK
*************/
#define ECL_STACK_REF(env,n) ((env)->run_stack.top[n])
#define ECL_VMS_REF(env,n) ((env)->run_stack.top[n])
static inline void
ecl_stack_push(cl_env_ptr env, cl_object o) {
ecl_vms_push(cl_env_ptr env, cl_object o) {
cl_object *new_top = env->run_stack.top;
if (ecl_unlikely(new_top >= env->run_stack.limit)) {
new_top = ecl_stack_grow(env);
new_top = ecl_vms_grow(env);
}
env->run_stack.top = new_top+1;
*new_top = (o);
}
static inline void
ecl_stack_push_n(cl_env_ptr env, cl_index n) {
ecl_vms_push_n(cl_env_ptr env, cl_index n) {
cl_object *new_top = env->run_stack.top;
while (ecl_unlikely((env->run_stack.limit - new_top) <= n)) {
new_top = ecl_stack_grow(env);
new_top = ecl_vms_grow(env);
}
env->run_stack.top = new_top + n;
}
static inline cl_object
ecl_stack_pop_unsafe(cl_env_ptr env)
ecl_vms_pop_unsafe(cl_env_ptr env)
{
return *(--((env)->run_stack.top));
}
static inline void
ecl_stack_pop_n_unsafe(cl_env_ptr env, cl_index n)
ecl_vms_pop_n_unsafe(cl_env_ptr env, cl_index n)
{
env->run_stack.top -= n;
}
static inline cl_index
ecl_stack_index(cl_env_ptr env) {
ecl_vms_index(cl_env_ptr env) {
return (env)->run_stack.top - (env)->run_stack.org;
}
static inline void
ecl_stack_set_index_unsafe(cl_env_ptr env, cl_index ndx)
ecl_vms_unwind(cl_env_ptr env, cl_index ndx)
{
env->run_stack.top = env->run_stack.org + (ndx);
}
@ -446,10 +446,10 @@ ecl_stack_set_index_unsafe(cl_env_ptr env, cl_index ndx)
#define ECL_UNWIND_PROTECT_EXIT \
__unwinding=0; } \
ecl_frs_pop(__the_env); \
__nr = ecl_stack_push_values(__the_env);
__nr = ecl_vms_push_values(__the_env);
#define ECL_UNWIND_PROTECT_END \
ecl_stack_pop_values(__the_env,__nr); \
ecl_vms_pop_values(__the_env,__nr); \
if (__unwinding) ecl_unwind(__the_env,__next_fr); } while(0)
/* unwind-protect variant which disables interrupts during cleanup */
@ -457,10 +457,10 @@ ecl_stack_set_index_unsafe(cl_env_ptr env, cl_index ndx)
__unwinding=0; } \
ecl_bds_bind(__the_env,ECL_INTERRUPTS_ENABLED,ECL_NIL); \
ecl_frs_pop(__the_env); \
__nr = ecl_stack_push_values(__the_env);
__nr = ecl_vms_push_values(__the_env);
#define ECL_UNWIND_PROTECT_THREAD_SAFE_END \
ecl_stack_pop_values(__the_env,__nr); \
ecl_vms_pop_values(__the_env,__nr); \
ecl_bds_unwind1(__the_env); \
ecl_check_pending_interrupts(__the_env); \
if (__unwinding) ecl_unwind(__the_env,__next_fr); } while(0)