lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Well, tailcalls have been my worst case in making Lua stackless. 

If it is so bad, you can avoid this opcode. Just remove this code from
lcode.c:

    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;
    }

That way, the compiler will not do the optimization; it will keep an 
explicit OP_CALL followed by OP_RETURN in your code. 

-- Roberto