From befb103a12dbc9f2a566c41cdb86b517ec4094bd Mon Sep 17 00:00:00 2001 From: Stephen Dolan Date: Wed, 22 Aug 2012 19:21:35 +0100 Subject: [PATCH] Fix a revolting hack --- c/compile.c | 11 ++--------- c/opcode.c | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/c/compile.c b/c/compile.c index 913cebca..71988c4a 100644 --- a/c/compile.c +++ b/c/compile.c @@ -312,16 +312,9 @@ static void compile(struct bytecode* bc, block b) { json_t* constant_pool = json_array(); int maxvar = -1; for (inst* curr = b.first; curr; curr = curr->next) { - if (curr->op == CLOSURE_CREATE) { - // CLOSURE_CREATE opcodes define closures for use later in the - // codestream. They generate no code. - - // FIXME: make the above true :) - code[pos++] = DUP; - code[pos++] = POP; - continue; - } const struct opcode_description* op = opcode_describe(curr->op); + if (op->length == 0) + continue; code[pos++] = curr->op; int opflags = op->flags; assert(!(op->flags & OP_IS_CALL_PSEUDO)); diff --git a/c/opcode.c b/c/opcode.c index 8e107236..5a7bfb2c 100644 --- a/c/opcode.c +++ b/c/opcode.c @@ -7,7 +7,7 @@ #define BRANCH OP_HAS_BRANCH, 2 #define CFUNC (OP_HAS_SYMBOL | OP_HAS_CFUNC), 2 #define UFUNC (OP_HAS_UFUNC | OP_HAS_VARIABLE_LENGTH_ARGLIST), 2 -#define CLOSURE_DEFINE (OP_HAS_BLOCK | OP_IS_CALL_PSEUDO | OP_HAS_BINDING), 2 +#define CLOSURE_DEFINE (OP_HAS_BLOCK | OP_IS_CALL_PSEUDO | OP_HAS_BINDING), 0 #define CLOSURE_ACCESS (OP_IS_CALL_PSEUDO | OP_HAS_BINDING), 2 #define OP(name, imm, in, out) \