]> granicus.if.org Git - jq/commitdiff
Fix a revolting hack
authorStephen Dolan <mu@netsoc.tcd.ie>
Wed, 22 Aug 2012 18:21:35 +0000 (19:21 +0100)
committerStephen Dolan <mu@netsoc.tcd.ie>
Wed, 22 Aug 2012 18:21:35 +0000 (19:21 +0100)
c/compile.c
c/opcode.c

index 913cebca457de594786e9f798d263b9062c6e953..71988c4ad7e2decf5376c0e56573e359dc3ce207 100644 (file)
@@ -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));
index 8e10723697b8bf846f628d6a3f8052bdc7917839..5a7bfb2cceb4d81b6009e35ac80f90946749961b 100644 (file)
@@ -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) \