Make more threading improvements

- ASAN memory morgue is now lockless
- Make C11 atomics header more portable
- Rewrote pthread keys support to be lockless
- Simplify Python's unicode table unpacking code
- Make crash report write(2) closer to being atomic
- Make it possible to strace/ftrace a single thread
- ASAN now checks nul-terminated strings fast and properly
- Windows fork() now restores TLS memory of calling thread
This commit is contained in:
Justine Tunney 2022-11-01 22:36:03 -07:00
parent d7b88734cd
commit e522aa3a07
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
189 changed files with 1363 additions and 1217 deletions

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __gbcommon_encmap_once;
static void *__gbcommon_encmap_ptr;
static _Atomic(void *) __gbcommon_encmap_ptr;
static const unsigned char __gbcommon_encmap_rodata[26264] = {
0xbc, 0xbc, 0x79, 0x74, 0x6b, 0x45, 0x9a, 0x27, 0x98, 0xbf, 0x2f, 0x84, 0xde,
0xab, 0x84, 0xec, 0x47, 0x17, 0xcc, 0xf0, 0xaa, 0xa0, 0x4f, 0x92, 0x05, 0x59,
@ -2028,9 +2027,7 @@ static const unsigned char __gbcommon_encmap_rodata[26264] = {
};
optimizesize void *__gbcommon_encmap(void) {
if (__gbcommon_encmap_once) return __gbcommon_encmap_ptr;
return xloadzd(&__gbcommon_encmap_once,
&__gbcommon_encmap_ptr,
return xloadzd(&__gbcommon_encmap_ptr,
__gbcommon_encmap_rodata,
26264, 41357, 23231, 2, 0xa0748ffcu); /* 56.5279% profit */
}