The unified diff between revisions [cdafda78..] and [26704bfc..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'src/lsc/codegen.c'
# # old_revision [cdafda78a5feba85c64bb1d0f3324ddaa4330ce4] # new_revision [26704bfc7dde9382e68dbefa013c51b37b934b1d] # # patch "src/lsc/codegen.c" # from [59287d90158eaceceb9a87f9fe6f6c45059c6cb6] # to [f72bb89ce47000e8908b8539ab2df2c84fefb118] # ============================================================ --- src/lsc/codegen.c 59287d90158eaceceb9a87f9fe6f6c45059c6cb6 +++ src/lsc/codegen.c f72bb89ce47000e8908b8539ab2df2c84fefb118 @@ -33,7 +33,7 @@ struct label { char *name; }; -#define DEBUG 1 +#define DEBUG 0 #define MOREDEBUG 0 #define MAX_LABELS 4096 @@ -549,6 +549,7 @@ void codegen(ast *node) int hasdefault; int i; int savedlineno; + int ncallargs; union { int i; @@ -616,9 +617,11 @@ void codegen(ast *node) * Arguments on the stack directly above * local variables, and then return address */ + printf("(argument)\n"); emit_instr_imm_const(OP_LOAD, sp + 1 + nargs - var.addr, fnconst); } else { + printf("(non-argument)\n"); emit_instr_imm_const(OP_LOAD, sp - var.addr - 1, fnconst); } sp++; @@ -777,14 +780,14 @@ void codegen(ast *node) // printf("savedsp = %d\n", savedsp); - nargs = 0; + ncallargs = 0; /* Evaluate the arguments first */ for (ptr = node->info.node.head->next->elem->info.node.head; ptr; ptr = ptr->next) { codegen(ptr->elem); - nargs++; + ncallargs++; } // printf("sp = %d\n", sp); @@ -800,7 +803,7 @@ void codegen(ast *node) * This is something only supported for * builtin functions at present. */ - emit_instr_immediate(OP_PUSH, nargs); + emit_instr_immediate(OP_PUSH, ncallargs); sp++; }