diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-11-29 14:57:36 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-11-29 14:57:36 -0200 |
commit | 745eb4199333f153a28c75837b6a1addf614f4a9 (patch) | |
tree | 9eb2cfe63700db8e2102d980d603ee294111cb14 /lcode.c | |
parent | c766e4103db888063c4f928747afd6eb448e306f (diff) | |
download | lua-github-745eb4199333f153a28c75837b6a1addf614f4a9.tar.gz |
new opcodes OP_RETURN0/OP_RETURN1
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 2.137 2017/11/28 12:58:18 roberto Exp roberto $ +** $Id: lcode.c,v 2.138 2017/11/28 15:26:15 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -152,7 +152,17 @@ int luaK_jump (FuncState *fs) { ** Code a 'return' instruction */ void luaK_ret (FuncState *fs, int first, int nret) { - luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); + switch (nret) { + case 0: + luaK_codeABC(fs, OP_RETURN0, 0, 0, 0); + break; + case 1: + luaK_codeABC(fs, OP_RETURN1, first, 0, 0); + break; + default: + luaK_codeABC(fs, OP_RETURN, first, nret + 1, 0); + break; + } } |