diff --git a/src/jse/org/luaj/vm2/luajc/JavaGen.java b/src/jse/org/luaj/vm2/luajc/JavaGen.java index ce382077..b4f134de 100644 --- a/src/jse/org/luaj/vm2/luajc/JavaGen.java +++ b/src/jse/org/luaj/vm2/luajc/JavaGen.java @@ -338,7 +338,7 @@ public class JavaGen { // a[2] = a[3] = v[1] builder.createUpvalues(pc, a+3, c); builder.loadVarresult(); - builder.dup(); + if ( c>=2 ) builder.dup(); builder.arg( 1 ); builder.dup(); builder.storeLocal(pc, a+2); diff --git a/src/jse/org/luaj/vm2/luajc/Slots.java b/src/jse/org/luaj/vm2/luajc/Slots.java index f4f2f25a..e3661810 100644 --- a/src/jse/org/luaj/vm2/luajc/Slots.java +++ b/src/jse/org/luaj/vm2/luajc/Slots.java @@ -201,20 +201,18 @@ public class Slots { break; case Lua.OP_CALL: /* A B C R(A), ... ,R(A+C-2):= R(A)(R(A+1), ... ,R(A+B-1)) */ - s[a] |= BIT_ASSIGN | BIT_REFER; - for ( int i=1; ilimit; --i ) + for ( int i=index; i>limit; --i ) if ( (slots[i][j] & (BIT_ASSIGN | BIT_NIL)) != 0 ) return i; return index;