diff --git a/lcode.c b/lcode.c index 5432f662..9ef6c781 100644 --- a/lcode.c +++ b/lcode.c @@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 1.63 2001/02/23 17:17:25 roberto Exp roberto $ +** $Id: lcode.c,v 1.64 2001/02/23 20:28:19 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -482,14 +482,6 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) { pop = 2*arg1; break; } - case OP_RETURN: { - if (GET_OPCODE(i) == OP_CALL && GETARG_B(i) == MULT_RET) { - SET_OPCODE(i, OP_TAILCALL); - SETARG_B(i, arg1); - optm = 1; - } - break; - } case OP_PUSHNIL: { if (arg1 == 0) return NO_JUMP; /* nothing to do */ push = arg1; @@ -632,7 +624,6 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) { } case OP_GETDOTTED: case OP_GETINDEXED: - case OP_TAILCALL: case OP_ADDI: { lua_assert(0); /* instruction used only for optimizations */ break; @@ -669,7 +660,6 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) { const OpProperties luaK_opproperties[] = { {iU, 0, 0}, /* OP_RETURN */ {iAB, 0, 0}, /* OP_CALL */ - {iAB, 0, 0}, /* OP_TAILCALL */ {iU, VD, 0}, /* OP_PUSHNIL */ {iU, 0, VD}, /* OP_POP */ {iS, 1, 0}, /* OP_PUSHINT */ diff --git a/ldebug.c b/ldebug.c index f0b71758..ea11cefd 100644 --- a/ldebug.c +++ b/ldebug.c @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 1.71 2001/03/02 17:27:50 roberto Exp roberto $ +** $Id: ldebug.c,v 1.72 2001/03/06 14:46:54 roberto Exp roberto $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -405,11 +405,6 @@ static Instruction luaG_symbexec (lua_State *L, const Proto *pt, push = arg2; break; } - case OP_TAILCALL: { - check(arg1 < top && arg2 <= top); - pop = top-arg2; - break; - } case OP_PUSHNIL: { check(arg1 > 0); push = arg1; @@ -585,12 +580,9 @@ static const l_char *getfuncname (lua_State *L, StkId f, const l_char **name) { Instruction i; if (pc == -1) return NULL; /* function is not activated */ i = p->code[pc]; - switch (GET_OPCODE(i)) { - case OP_CALL: case OP_TAILCALL: - return getobjname(L, (func+1)+GETARG_A(i), name); - default: - return NULL; /* no useful name found */ - } + return (GET_OPCODE(i) == OP_CALL + ? getobjname(L, (func+1)+GETARG_A(i), name) + : NULL); /* no useful name found */ } } diff --git a/lopcodes.h b/lopcodes.h index a30de1be..207627a5 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.h,v 1.69 2000/12/04 18:33:40 roberto Exp roberto $ +** $Id: lopcodes.h,v 1.70 2001/01/15 16:13:24 roberto Exp roberto $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ @@ -85,7 +85,6 @@ name args stack before stack after side effects OP_RETURN,/* U v_n-v_x(at u) (return) returns v_x-v_n */ OP_CALL,/* A B v_n-v_1 f(at a) r_b-r_1 f(v1,...,v_n) */ -OP_TAILCALL,/* A B v_n-v_1 f(at a) (return) f(v1,...,v_n) */ OP_PUSHNIL,/* U - nil_1-nil_u */ OP_POP,/* U a_u-a_1 - */ diff --git a/ltests.c b/ltests.c index 4d3cd1e9..574e60f6 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 1.73 2001/03/02 17:27:50 roberto Exp roberto $ +** $Id: ltests.c,v 1.74 2001/03/06 20:09:38 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -139,14 +139,53 @@ void *debug_realloc (void *block, size_t oldsize, size_t size) { static const l_char *const instrname[NUM_OPCODES] = { - l_s("RETURN"), l_s("CALL"), l_s("TAILCALL"), l_s("PUSHNIL"), l_s("POP"), l_s("PUSHINT"), - l_s("PUSHSTRING"), l_s("PUSHNUM"), l_s("PUSHNEGNUM"), l_s("PUSHUPVALUE"), l_s("GETLOCAL"), - l_s("GETGLOBAL"), l_s("GETTABLE"), l_s("GETDOTTED"), l_s("GETINDEXED"), l_s("PUSHSELF"), - l_s("CREATETABLE"), l_s("SETLOCAL"), l_s("SETGLOBAL"), l_s("SETTABLE"), l_s("SETLIST"), l_s("SETMAP"), - l_s("ADD"), l_s("ADDI"), l_s("SUB"), l_s("MULT"), l_s("DIV"), l_s("POW"), l_s("CONCAT"), l_s("MINUS"), l_s("NOT"), - l_s("JMPNE"), l_s("JMPEQ"), l_s("JMPLT"), l_s("JMPLE"), l_s("JMPGT"), l_s("JMPGE"), l_s("JMPT"), l_s("JMPF"), - l_s("JMPONT"), l_s("JMPONF"), l_s("JMP"), l_s("PUSHNILJMP"), l_s("FORPREP"), l_s("FORLOOP"), l_s("LFORPREP"), - l_s("LFORLOOP"), l_s("CLOSURE") + l_s("RETURN"), + l_s("CALL"), + l_s("PUSHNIL"), + l_s("POP"), + l_s("PUSHINT"), + l_s("PUSHSTRING"), + l_s("PUSHNUM"), + l_s("PUSHNEGNUM"), + l_s("PUSHUPVALUE"), + l_s("GETLOCAL"), + l_s("GETGLOBAL"), + l_s("GETTABLE"), + l_s("GETDOTTED"), + l_s("GETINDEXED"), + l_s("PUSHSELF"), + l_s("CREATETABLE"), + l_s("SETLOCAL"), + l_s("SETGLOBAL"), + l_s("SETTABLE"), + l_s("SETLIST"), + l_s("SETMAP"), + l_s("ADD"), + l_s("ADDI"), + l_s("SUB"), + l_s("MULT"), + l_s("DIV"), + l_s("POW"), + l_s("CONCAT"), + l_s("MINUS"), + l_s("NOT"), + l_s("JMPNE"), + l_s("JMPEQ"), + l_s("JMPLT"), + l_s("JMPLE"), + l_s("JMPGT"), + l_s("JMPGE"), + l_s("JMPT"), + l_s("JMPF"), + l_s("JMPONT"), + l_s("JMPONF"), + l_s("JMP"), + l_s("PUSHNILJMP"), + l_s("FORPREP"), + l_s("FORLOOP"), + l_s("LFORPREP"), + l_s("LFORLOOP"), + l_s("CLOSURE") }; diff --git a/lvm.c b/lvm.c index f707208d..99405763 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 1.172 2001/02/23 17:17:25 roberto Exp roberto $ +** $Id: lvm.c,v 1.173 2001/02/23 20:30:52 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -357,11 +357,6 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { L->top = base+tf->maxstacksize; break; } - case OP_TAILCALL: { - L->top = top; - luaD_call(L, base+GETARG_A(i), LUA_MULTRET); - return base+GETARG_B(i); - } case OP_PUSHNIL: { int n = GETARG_U(i); lua_assert(n>0);