Mon, 22 Nov 2010 02:31:16 +0000
Fix OP_CALL to handle the case of B==1 (no parameters) and fix an off-by-one error that wouldn't fill the stack with nils properly
lvm.js | file | annotate | diff | comparison | revisions |
--- a/lvm.js Sun Nov 21 21:37:07 2010 +0000 +++ b/lvm.js Mon Nov 22 02:31:16 2010 +0000 @@ -475,8 +475,12 @@ var f = frame.reg[INS_A(instruction)].precall(); // return JS or LValue var A = INS_A(instruction), B = INS_B(instruction), C = INS_C(instruction); var undefined; - var args = frame.reg.slice(A+1, B==0?undefined:(A+B)); - for(var i=args.length+1;i<f.maxStackSize;i++) + var args; + if(B != 1) + args = frame.reg.slice(A+1, B==0?undefined:(A+B)); + else + args = []; + for(var i=args.length;i<f.maxStackSize;i++) args[i] = new LValue(this, "nil", null); if(typeof(f) == "function") {