From b1379936cf35787d3ef3aab82d1607a3e1562eef Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 9 Feb 2018 13:16:06 -0200 Subject: vararg back to '...' (but with another implementation) new implementation should have zero overhead for non-vararg functions --- lopcodes.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index 47c72c69..3c7a9573 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.h,v 1.184 2018/01/28 15:13:26 roberto Exp roberto $ +** $Id: lopcodes.h,v 1.186 2018/02/07 15:18:04 roberto Exp roberto $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ @@ -268,6 +268,7 @@ OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ +OP_RETVARARG,/* A B return R(A), ... ,R(A+B-2) (see note) */ OP_RETURN0,/* return */ OP_RETURN1,/* A return R(A) */ @@ -286,7 +287,7 @@ OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ -OP_VARARG,/* A B C R(A), R(A+1), ..., R(A+C-2) = vararg(B) */ +OP_VARARG,/* A B C R(A), R(A+1), ..., R(A+C-2) = vararg */ OP_PREPVARARG,/*A (adjust vararg parameters) */ @@ -305,9 +306,10 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ OP_SETLIST) may use 'top'. (*) In OP_VARARG, if (C == 0) then use actual number of varargs and - set top (like in OP_CALL with C == 0). B is the vararg parameter. + set top (like in OP_CALL with C == 0). - (*) In OP_RETURN, if (B == 0) then return up to 'top'. + (*) In OP_RETURN/OP_RETVARARG, if (B == 0) then return up to 'top'. + (OP_RETVARARG is the return instruction for vararg functions.) (*) In OP_SETLIST, if (B == 0) then real B = 'top'; if (C == 0) then next 'instruction' is EXTRAARG(real C). -- cgit v1.2.3-55-g6feb