Skip to content

Instantly share code, notes, and snippets.

@hishamhm
Created September 27, 2013 21:12
Show Gist options
  • Save hishamhm/6735265 to your computer and use it in GitHub Desktop.
Save hishamhm/6735265 to your computer and use it in GitHub Desktop.
Build a modified version of Lua 5.2.2 without tail calls
diff -ur lua-5.2.2/src/lparser.c lua-5.2.2-notailcalls/src/lparser.c
--- lua-5.2.2/src/lparser.c 2013-02-06 11:37:39.000000000 -0200
+++ lua-5.2.2-notailcalls/src/lparser.c 2013-09-27 18:04:20.000000000 -0300
@@ -1505,7 +1505,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