From 745eb4199333f153a28c75837b6a1addf614f4a9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 29 Nov 2017 14:57:36 -0200 Subject: new opcodes OP_RETURN0/OP_RETURN1 --- lcode.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lcode.c') diff --git a/lcode.c b/lcode.c index 97aa9dda..8f9fa408 100644 --- a/lcode.c +++ b/lcode.c @@ -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; + } } -- cgit v1.2.3-55-g6feb