mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-16 17:37:34 +02:00
better simplification - old apply no longer needed
This commit is contained in:
parent
1fea7687e2
commit
f15885a1b6
1 changed files with 1 additions and 20 deletions
21
vm.c
21
vm.c
|
@ -616,7 +616,7 @@ static int sexp_check_type(sexp ctx, sexp a, sexp b) {
|
||||||
#include "opt/fcall.c"
|
#include "opt/fcall.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sexp sexp_vm (sexp ctx, sexp proc, sexp args) {
|
sexp sexp_apply (sexp ctx, sexp proc, sexp args) {
|
||||||
unsigned char *ip;
|
unsigned char *ip;
|
||||||
sexp bc, cp, *stack = sexp_stack_data(sexp_context_stack(ctx));
|
sexp bc, cp, *stack = sexp_stack_data(sexp_context_stack(ctx));
|
||||||
sexp_sint_t i, j, k, fp, top = sexp_stack_top(sexp_context_stack(ctx));
|
sexp_sint_t i, j, k, fp, top = sexp_stack_top(sexp_context_stack(ctx));
|
||||||
|
@ -1583,8 +1583,6 @@ sexp sexp_vm (sexp ctx, sexp proc, sexp args) {
|
||||||
return _ARG1;
|
return _ARG1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************* apply ********************************/
|
|
||||||
|
|
||||||
sexp sexp_apply1 (sexp ctx, sexp f, sexp x) {
|
sexp sexp_apply1 (sexp ctx, sexp f, sexp x) {
|
||||||
sexp res;
|
sexp res;
|
||||||
sexp_gc_var1(args);
|
sexp_gc_var1(args);
|
||||||
|
@ -1597,20 +1595,3 @@ sexp sexp_apply1 (sexp ctx, sexp f, sexp x) {
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_apply (sexp ctx, sexp proc, sexp args) {
|
|
||||||
sexp res;
|
|
||||||
sexp_gc_var1(tmp);
|
|
||||||
sexp_gc_preserve1(ctx, tmp);
|
|
||||||
if (sexp_opcodep(proc))
|
|
||||||
proc = tmp = make_opcode_procedure(ctx, proc, sexp_unbox_fixnum(sexp_length(ctx, args)));
|
|
||||||
if (! sexp_procedurep(proc)) {
|
|
||||||
res = sexp_exceptionp(proc) ? proc :
|
|
||||||
sexp_type_exception(ctx, NULL, SEXP_PROCEDURE, proc);
|
|
||||||
} else {
|
|
||||||
res = sexp_vm(ctx, proc, args);
|
|
||||||
if (! res) res = SEXP_VOID; /* shouldn't happen */
|
|
||||||
}
|
|
||||||
sexp_gc_release1(ctx);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue