mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
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:
parent
d7b88734cd
commit
e522aa3a07
189 changed files with 1363 additions and 1217 deletions
14
third_party/python/Tools/unicode/makecjkcodecs.c
vendored
14
third_party/python/Tools/unicode/makecjkcodecs.c
vendored
|
@ -55,8 +55,7 @@ void m(const char *s, void *p, size_t n) {
|
|||
fprintf(f, "#include \"libc/x/x.h\"\n");
|
||||
fprintf(f, "/* clang-format off */\n");
|
||||
fprintf(f, "\n");
|
||||
fprintf(f, "static bool %s_once;\n", s);
|
||||
fprintf(f, "static void *%s_ptr;\n", s);
|
||||
fprintf(f, "static _Atomic(void *) %s_ptr;\n", s);
|
||||
fprintf(f, "static const unsigned char %s_rodata[] = {", s);
|
||||
for (i = 0; i < m; ++i) {
|
||||
if (i % 13 == 0) fprintf(f, "\n ");
|
||||
|
@ -65,9 +64,7 @@ void m(const char *s, void *p, size_t n) {
|
|||
fprintf(f, "\n};\n");
|
||||
fprintf(f, "\n");
|
||||
fprintf(f, "optimizesize void *%s(void) {\n", s);
|
||||
fprintf(f, " if (%s_once) return %s_ptr;\n", s, s);
|
||||
fprintf(f, " return xload(&%s_once,\n", s);
|
||||
fprintf(f, " &%s_ptr,\n", s);
|
||||
fprintf(f, " return xload(&%s_ptr,\n", s);
|
||||
fprintf(f, " %s_rodata,\n", s);
|
||||
fprintf(f, " %d, %d); /* %g%% profit */\n", m, n,
|
||||
(double)m / n * 100);
|
||||
|
@ -99,8 +96,7 @@ void dzd(const char *s, void *p, size_t n, size_t z) {
|
|||
fprintf(f, "#include \"libc/x/x.h\"\n");
|
||||
fprintf(f, "/* clang-format off */\n");
|
||||
fprintf(f, "\n");
|
||||
fprintf(f, "static bool %s_once;\n", s);
|
||||
fprintf(f, "static void *%s_ptr;\n", s);
|
||||
fprintf(f, "static _Atomic(void *) %s_ptr;\n", s);
|
||||
fprintf(f, "static const unsigned char %s_rodata[%zu] = {", s, m);
|
||||
for (i = 0; i < m; ++i) {
|
||||
if (i % 13 == 0) fprintf(f, "\n ");
|
||||
|
@ -109,9 +105,7 @@ void dzd(const char *s, void *p, size_t n, size_t z) {
|
|||
fprintf(f, "\n};\n");
|
||||
fprintf(f, "\n");
|
||||
fprintf(f, "optimizesize void *%s(void) {\n", s);
|
||||
fprintf(f, " if (%s_once) return %s_ptr;\n", s, s);
|
||||
fprintf(f, " return xloadzd(&%s_once,\n", s);
|
||||
fprintf(f, " &%s_ptr,\n", s);
|
||||
fprintf(f, " return xloadzd(&%s_ptr,\n", s);
|
||||
fprintf(f, " %s_rodata,\n", s);
|
||||
fprintf(f, " %d, %d, %d, %d, 0x%08xu); /* %g%% profit */\n",
|
||||
m, appendz(r).i, n / z, z, S, (double)m / n * 100);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue