ecl_interpret returns the first value

This commit is contained in:
Juan Jose Garcia Ripoll 2008-06-09 18:30:58 +02:00
parent a8ba969759
commit 7bdc8ce4cd
3 changed files with 14 additions and 15 deletions

View file

@ -1540,7 +1540,7 @@ c_nth_value(cl_object args, int flags) {
if (args != Cnil)
FEprogram_error("NTH-VALUE: Too many arguments.",0);
asm_op(OP_NTHVAL);
return FLAG_VALUES;
return FLAG_REG0;
}
@ -2562,12 +2562,14 @@ si_make_lambda(cl_object name, cl_object rest)
ihs_push(&ihs, bytecodes, Cnil);
VALUES(0) = Cnil;
NVALUES = 0;
ecl_interpret(interpreter_env, bytecodes, bytecodes->bytecodes.code);
{
cl_object output = ecl_interpret(interpreter_env, bytecodes, bytecodes->bytecodes.code);
#ifdef GBC_BOEHM
GC_free(bytecodes->bytecodes.code);
GC_free(bytecodes->bytecodes.data);
GC_free(bytecodes);
#endif
ihs_pop();
return VALUES(0);
return output;
}
@)

View file

@ -332,8 +332,7 @@ lambda_bind(cl_object env, cl_narg narg, cl_object lambda, cl_object *sp)
} else {
cl_object defaults = data[1];
if (FIXNUMP(defaults)) {
ecl_interpret(env, lambda, (cl_opcode*)lambda->bytecodes.code + fix(defaults));
defaults = VALUES(0);
defaults = ecl_interpret(env, lambda, (cl_opcode*)lambda->bytecodes.code + fix(defaults));
}
env = lambda_bind_var(env, data[0], defaults, specials);
if (!Null(data[2])) {
@ -422,8 +421,7 @@ lambda_bind(cl_object env, cl_narg narg, cl_object lambda, cl_object *sp)
} else {
cl_object defaults = data[2];
if (FIXNUMP(defaults)) {
ecl_interpret(env, lambda, (cl_opcode*)lambda->bytecodes.code + fix(defaults));
defaults = VALUES(0);
defaults = ecl_interpret(env, lambda, (cl_opcode*)lambda->bytecodes.code + fix(defaults));
}
env = lambda_bind_var(env, data[1],defaults,specials);
}
@ -454,9 +452,9 @@ ecl_apply_lambda(cl_object frame, cl_object fun)
VALUES(0) = Cnil;
NVALUES = 0;
name = fun->bytecodes.name;
ecl_interpret(env, fun, fun->bytecodes.code);
fun = ecl_interpret(env, fun, fun->bytecodes.code);
bds_unwind(old_bds_top);
returnn(VALUES(0));
return fun;
}
@ -513,7 +511,7 @@ close_around(cl_object fun, cl_object lex) {
} \
*(the_env->stack_top++) = __aux; }
void *
cl_object
ecl_interpret(cl_object env, cl_object bytecodes, void *pc)
{
ECL_OFFSET_TABLE;
@ -682,7 +680,7 @@ ecl_interpret(cl_object env, cl_object bytecodes, void *pc)
*/
CASE(OP_EXIT); {
ihs_pop();
return (char *)vector;
return VALUES(0);
}
/* OP_FLET nfun{arg}
fun1{object}
@ -1160,11 +1158,10 @@ ecl_interpret(cl_object env, cl_object bytecodes, void *pc)
if (n < 0) {
FEerror("Wrong index passed to NTH-VAL", 1, MAKE_FIXNUM(n));
} else if ((cl_index)n >= the_env->nvalues) {
the_env->values[0] = reg0 = Cnil;
reg0 = Cnil;
} else {
the_env->values[0] = reg0 = the_env->values[n];
reg0 = the_env->values[n];
}
the_env->nvalues = 1;
THREAD_NEXT;
}
/* OP_PROTECT label

View file

@ -459,7 +459,7 @@ extern ECL_API cl_index cl_stack_push_values(void);
extern ECL_API void cl_stack_pop_values(cl_index n);
extern ECL_API cl_object ecl_apply_lambda(cl_object frame, cl_object fun);
extern ECL_API void *ecl_interpret(cl_object env, cl_object bytecodes, void *pc);
extern ECL_API cl_object ecl_interpret(cl_object env, cl_object bytecodes, void *pc);
/* disassembler.c */