mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-08 05:27:35 +02:00
using direct make-procedure args instead of pushing
This commit is contained in:
parent
28ffc56d50
commit
69e32af744
2 changed files with 8 additions and 6 deletions
|
@ -66,7 +66,6 @@ _OP(SEXP_OPC_ARITHMETIC_CMP, SEXP_OP_EQN, 2, 1, _I(SEXP_BOOLEAN), _I(SEXP_NUMBER
|
|||
_OP(SEXP_OPC_PREDICATE, SEXP_OP_EQ, 2, 0, _I(SEXP_BOOLEAN), _I(SEXP_OBJECT), _I(SEXP_OBJECT), SEXP_FALSE, 0, "eq?", 0, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_CONS, 2, 0, _I(SEXP_PAIR), _I(SEXP_OBJECT), _I(SEXP_OBJECT), SEXP_FALSE, 0, "cons", 0, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_MAKE_VECTOR, 1, 1, _I(SEXP_VECTOR), _I(SEXP_FIXNUM), _I(SEXP_OBJECT), SEXP_FALSE, 0, "make-vector", SEXP_VOID, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_MAKE_PROCEDURE, 4, 0, _I(SEXP_PROCEDURE), _I(SEXP_FIXNUM), _I(SEXP_FIXNUM), _I(SEXP_BYTECODE), 0, "make-procedure", 0, NULL),
|
||||
_OP(SEXP_OPC_CONSTRUCTOR, SEXP_OP_MAKE_EXCEPTION, 5, 0, _I(SEXP_EXCEPTION), _I(SEXP_OBJECT), _I(SEXP_OBJECT), _I(SEXP_OBJECT), 0, "make-exception", 0, NULL),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_ISA, 2, 0, _I(SEXP_BOOLEAN), _I(SEXP_OBJECT), _I(SEXP_OBJECT), SEXP_FALSE, 0, "is-a?", NULL, 0),
|
||||
_OP(SEXP_OPC_TYPE_PREDICATE, SEXP_OP_NULLP, 1, 0, _I(SEXP_BOOLEAN), _I(SEXP_OBJECT), SEXP_FALSE, SEXP_FALSE, 0, "null?", NULL, 0),
|
||||
|
|
13
vm.c
13
vm.c
|
@ -580,10 +580,11 @@ static void generate_lambda (sexp ctx, sexp name, sexp loc, sexp lam, sexp lambd
|
|||
sexp_context_depth(ctx)--;
|
||||
}
|
||||
/* push the additional procedure info and make the closure */
|
||||
emit_push(ctx, bc);
|
||||
emit_push(ctx, len);
|
||||
emit_push(ctx, flags);
|
||||
emit(ctx, SEXP_OP_MAKE_PROCEDURE);
|
||||
emit_word(ctx, (sexp_uint_t)flags);
|
||||
emit_word(ctx, (sexp_uint_t)len);
|
||||
emit_word(ctx, (sexp_uint_t)bc);
|
||||
bytecode_preserve(ctx, bc);
|
||||
}
|
||||
sexp_gc_release2(ctx);
|
||||
}
|
||||
|
@ -722,6 +723,7 @@ static sexp sexp_restore_stack (sexp ctx, sexp saved) {
|
|||
#define _WORD1 ((sexp*)ip)[1]
|
||||
#define _UWORD1 ((sexp_uint_t*)ip)[1]
|
||||
#define _SWORD1 ((sexp_sint_t*)ip)[1]
|
||||
#define _WORD2 ((sexp*)ip)[2]
|
||||
|
||||
#define sexp_raise(msg, args) \
|
||||
do {sexp_context_top(ctx) = top+1; \
|
||||
|
@ -1257,8 +1259,9 @@ sexp sexp_apply (sexp ctx, sexp proc, sexp args) {
|
|||
break;
|
||||
case SEXP_OP_MAKE_PROCEDURE:
|
||||
sexp_context_top(ctx) = top;
|
||||
_ARG4 = sexp_make_procedure(ctx, _ARG1, _ARG2, _ARG3, _ARG4);
|
||||
top-=3;
|
||||
_ALIGN_IP();
|
||||
_ARG1 = sexp_make_procedure(ctx, _WORD0, _WORD1, _WORD2, _ARG1);
|
||||
ip += (3 * sizeof(sexp));
|
||||
break;
|
||||
case SEXP_OP_MAKE_VECTOR:
|
||||
sexp_context_top(ctx) = top;
|
||||
|
|
Loading…
Add table
Reference in a new issue