cosmopolitan/third_party/lua
Justine Tunney 226aaf3547 Improve memory safety
This commit makes numerous refinements to cosmopolitan memory handling.

The default stack size has been reduced from 2mb to 128kb. A new macro
is now provided so you can easily reconfigure the stack size to be any
value you want. Work around the breaking change by adding to your main:

    STATIC_STACK_SIZE(0x00200000);  // 2mb stack

If you're not sure how much stack you need, then you can use:

    STATIC_YOINK("stack_usage_logging");

After which you can `sort -nr o/$MODE/stack.log`. Based on the unit test
suite, nothing in the Cosmopolitan repository (except for Python) needs
a stack size greater than 30kb. There are also new macros for detecting
the size and address of the stack at runtime, e.g. GetStackAddr(). We
also now support sigaltstack() so if you want to see nice looking crash
reports whenever a stack overflow happens, you can put this in main():

    ShowCrashReports();

Under `make MODE=dbg` and `make MODE=asan` the unit testing framework
will now automatically print backtraces of memory allocations when
things like memory leaks happen. Bugs are now fixed in ASAN global
variable overrun detection. The memtrack and asan runtimes also handle
edge cases now. The new tools helped to identify a few memory leaks,
which are fixed by this change.

This change should fix an issue reported in #288 with ARG_MAX limits.
Fixing this doubled the performance of MKDEPS.COM and AR.COM yet again.
2021-10-13 17:27:13 -07:00
..
test Fix upstream Lua test breakage due to Linenoise 2021-08-19 09:34:24 -07:00
lapi.c Import some Lua documentation 2021-08-22 15:03:04 -07:00
lapi.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lauxlib.c Import some Lua documentation 2021-08-22 15:03:04 -07:00
lauxlib.h Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
lbaselib.c Revert adding lua array per discussion in #222 (#229) 2021-08-07 15:20:33 -07:00
lcode.c Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
lcode.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lcorolib.c Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
lctype.c Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lctype.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
ldblib.c Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
ldebug.c Revert adding lua array per discussion in #222 (#229) 2021-08-07 15:20:33 -07:00
ldebug.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
ldo.c Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
ldo.h Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
ldump.c Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lfunc.c Add Lua compiler 2021-08-09 13:09:14 -07:00
lfunc.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lgc.c Revert adding lua array per discussion in #222 (#229) 2021-08-07 15:20:33 -07:00
lgc.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
linit.c Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
liolib.c Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
ljumptab.inc Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
llex.c Have redbean show zip listing as default / handler 2021-03-29 01:22:49 -07:00
llex.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
llimits.h Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
lmathlib.c Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
lmem.c Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
lmem.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
loadlib.c Fix bugs and make improvements to redbean 2021-08-06 14:18:34 -07:00
lobject.c Add Lua compiler 2021-08-09 13:09:14 -07:00
lobject.h Add Lua compiler 2021-08-09 13:09:14 -07:00
lopcodes.c Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lopcodes.h Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
lopnames.inc Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
loslib.c Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
lparser.c Revert adding lua array per discussion in #222 (#229) 2021-08-07 15:20:33 -07:00
lparser.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lprefix.h Add Lua 2021-03-07 12:50:34 -08:00
lstate.c Import some Lua documentation 2021-08-22 15:03:04 -07:00
lstate.h Add Lua compiler 2021-08-09 13:09:14 -07:00
lstring.c Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
lstring.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lstrlib.c Upgrade Lua to 5.4.3 (#217) 2021-07-28 09:26:35 -07:00
ltable.c Revert adding lua array per discussion in #222 (#229) 2021-08-07 15:20:33 -07:00
ltable.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
ltablib.c Revert adding lua array per discussion in #222 (#229) 2021-08-07 15:20:33 -07:00
ltests.c Fix regression in _gclongjmp() 2021-08-19 09:34:24 -07:00
ltests.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
ltm.c Revert adding lua array per discussion in #222 (#229) 2021-08-07 15:20:33 -07:00
ltm.h Add Lua compiler 2021-08-09 13:09:14 -07:00
lua.h Revert adding lua array per discussion in #222 (#229) 2021-08-07 15:20:33 -07:00
lua.main.c Improve memory safety 2021-10-13 17:27:13 -07:00
lua.mk Make numerous improvements 2021-09-28 01:52:34 -07:00
luac.main.c Add Lua compiler 2021-08-09 13:09:14 -07:00
luaconf.h Improve ZIP filesystem and change its prefix 2021-08-22 01:11:53 -07:00
lualib.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lundump.c Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lundump.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lutf8lib.c Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lvm.c Revert adding lua array per discussion in #222 (#229) 2021-08-07 15:20:33 -07:00
lvm.h Revert adding lua array per discussion in #222 (#229) 2021-08-07 15:20:33 -07:00
lzio.c Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
lzio.h Get Lua to build with all tests passing 2021-03-07 13:31:09 -08:00
README.cosmo Add Lua compiler 2021-08-09 13:09:14 -07:00
tms.h Add Lua compiler 2021-08-09 13:09:14 -07:00

DESCRIPTION

  Lua is a language designed for embedded use in native applications. It
  has an impossibly elegant C API and the Lua language itself feels more
  like Python compared to alternatives like Tcl except it's a great deal
  faster and doesn't have strong opinions about character encoding.

PROVENANCE

  https://github.com/lua/lua/

  commit e7803f7dbcdc966ab1f9db143424ee811ab1a398
  Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
  Date:   Wed Mar 3 09:44:20 2021 -0300

      New release number (5.4.3)

  luac.c needed to be sourced from:
  https://www.lua.org/ftp/lua-5.4.3.tar.gz

LOCAL MODIFICATIONS

  The `\e` string literal escape sequence has been added, which is
  equivalent to `\27` (the Lua version of `\033`) or the ASCII ESC
  character. It may be used for teletypewriter control like having
  bold text, which can be encoded elegantly as `\e[1mHELLO\e[0m`.