diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-09 13:16:06 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-09 13:16:06 -0200 |
commit | b1379936cf35787d3ef3aab82d1607a3e1562eef (patch) | |
tree | fe47cb5c35fddab945faf731f0bc175bf5431352 /lopcodes.h | |
parent | 4e0de3a43cc30a83334c272cb7575bf8412bfeae (diff) | |
download | lua-b1379936cf35787d3ef3aab82d1607a3e1562eef.tar.gz lua-b1379936cf35787d3ef3aab82d1607a3e1562eef.tar.bz2 lua-b1379936cf35787d3ef3aab82d1607a3e1562eef.zip |
vararg back to '...' (but with another implementation)
new implementation should have zero overhead for non-vararg functions
Diffstat (limited to 'lopcodes.h')
-rw-r--r-- | lopcodes.h | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lopcodes.h,v 1.184 2018/01/28 15:13:26 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.186 2018/02/07 15:18:04 roberto Exp roberto $ |
3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -268,6 +268,7 @@ OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ | |||
268 | OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ | 268 | OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ |
269 | 269 | ||
270 | OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ | 270 | OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ |
271 | OP_RETVARARG,/* A B return R(A), ... ,R(A+B-2) (see note) */ | ||
271 | OP_RETURN0,/* return */ | 272 | OP_RETURN0,/* return */ |
272 | OP_RETURN1,/* A return R(A) */ | 273 | OP_RETURN1,/* A return R(A) */ |
273 | 274 | ||
@@ -286,7 +287,7 @@ OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ | |||
286 | 287 | ||
287 | OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ | 288 | OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ |
288 | 289 | ||
289 | OP_VARARG,/* A B C R(A), R(A+1), ..., R(A+C-2) = vararg(B) */ | 290 | OP_VARARG,/* A B C R(A), R(A+1), ..., R(A+C-2) = vararg */ |
290 | 291 | ||
291 | OP_PREPVARARG,/*A (adjust vararg parameters) */ | 292 | OP_PREPVARARG,/*A (adjust vararg parameters) */ |
292 | 293 | ||
@@ -305,9 +306,10 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ | |||
305 | OP_SETLIST) may use 'top'. | 306 | OP_SETLIST) may use 'top'. |
306 | 307 | ||
307 | (*) In OP_VARARG, if (C == 0) then use actual number of varargs and | 308 | (*) In OP_VARARG, if (C == 0) then use actual number of varargs and |
308 | set top (like in OP_CALL with C == 0). B is the vararg parameter. | 309 | set top (like in OP_CALL with C == 0). |
309 | 310 | ||
310 | (*) In OP_RETURN, if (B == 0) then return up to 'top'. | 311 | (*) In OP_RETURN/OP_RETVARARG, if (B == 0) then return up to 'top'. |
312 | (OP_RETVARARG is the return instruction for vararg functions.) | ||
311 | 313 | ||
312 | (*) In OP_SETLIST, if (B == 0) then real B = 'top'; if (C == 0) then | 314 | (*) In OP_SETLIST, if (B == 0) then real B = 'top'; if (C == 0) then |
313 | next 'instruction' is EXTRAARG(real C). | 315 | next 'instruction' is EXTRAARG(real C). |