cosmopolitan/third_party/quickjs
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
..
doc Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
examples Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
tests Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
array.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
atof.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
atom.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
atomics.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
bigdecimal.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
bigint.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
byte.c Make numerous improvements 2021-09-28 01:52:34 -07:00
call.c Make redbean SSL more tunable 2021-08-09 07:38:57 -07:00
Changelog Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
cutils.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
cutils.h Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
date.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
dbuf.c Make numerous improvements 2021-09-28 01:52:34 -07:00
diglet.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
diglet.h Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
eq.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
err.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
float.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
gc.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
gen.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
internal.h Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
iter.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
json.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
leb128.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
leb128.h Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
libbf.c Make numerous improvements 2021-09-28 01:52:34 -07:00
libbf.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
libregexp-opcode.inc Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
libregexp.c Make numerous improvements 2021-09-28 01:52:34 -07:00
libregexp.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
libunicode-table.inc Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
libunicode.c Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
libunicode.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
LICENSE Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
list.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
map.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
math.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
mem.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
object.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
parse.c Make numerous improvements 2021-09-28 01:52:34 -07:00
prim.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
promise.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
proxy.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
qjs.c Improve memory safety 2021-10-13 17:27:13 -07:00
qjsc.c Make numerous improvements 2021-09-28 01:52:34 -07:00
qjscalc.js Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
quickjs-atom.inc Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
quickjs-libc.c Improve memory safety 2021-10-13 17:27:13 -07:00
quickjs-libc.h Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
quickjs-opcode.inc Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
quickjs.c Make numerous improvements 2021-09-28 01:52:34 -07:00
quickjs.h Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
quickjs.mk Make numerous improvements 2021-09-28 01:52:34 -07:00
README.cosmo Fix issues revealed by ECMAScript test262 2021-04-10 17:15:35 -07:00
readme.txt Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
reflect.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
regexp.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
repl.js Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
run-test262.c Make numerous improvements 2021-09-28 01:52:34 -07:00
shape.c Make numerous improvements 2021-09-28 01:52:34 -07:00
str.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
strbuf.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
test262.conf Fix issues revealed by ECMAScript test262 2021-04-10 17:15:35 -07:00
test262_errors.txt Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
test262o.conf Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
test262o_errors.txt Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
TODO Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
tok.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
typedarray.c Make numerous improvements 2021-09-28 01:52:34 -07:00
unicode_download.sh Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00
unicode_gen.c Make numerous improvements 2021-09-28 01:52:34 -07:00
unicode_gen_def.inc Get Fabrice Bellard's JavaScript engine to build 2021-04-09 01:06:57 -07:00
uri.c Reduce build latency and fix old cpu bugs 2021-08-05 14:43:53 -07:00
usage.c Make numerous improvements 2021-09-28 01:52:34 -07:00
VERSION Add quickjs-2021-03-27 to third_party 2021-04-08 20:55:43 -07:00

The main documentation is in doc/quickjs.pdf or doc/quickjs.html.