Skip to content

Instantly share code, notes, and snippets.

@hishamhm
Created September 27, 2013 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hishamhm/6735243 to your computer and use it in GitHub Desktop.
Save hishamhm/6735243 to your computer and use it in GitHub Desktop.
Build a modified version of Lua 5.1.5 without tail calls
diff -ur lua-5.1.5/src/lparser.c lua-5.1.5-notailcalls/src/lparser.c
--- lua-5.1.5/src/lparser.c 2011-10-21 17:31:42.000000000 -0200
+++ lua-5.1.5-notailcalls/src/lparser.c 2013-09-27 17:44:56.000000000 -0300
@@ -1248,7 +1248,7 @@
if (hasmultret(e.k)) {
luaK_setmultret(fs, &e);
if (e.k == VCALL && nret == 1) { /* tail call? */
- SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
+ SET_OPCODE(getcode(fs,&e), OP_CALL);
lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);
}
first = fs->nactvar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment