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

@ -13,3 +13,4 @@ LOCAL CHANGES
- Poison maps to integrate with Address Sanitizer
- Introduce __oom_hook() by using _mapanon() vs. mmap()
- Wrap locks with __threaded check to improve perf lots
- Use assembly init rather than ensure_initialization()

View file

@ -21,7 +21,7 @@ struct malloc_params {
static struct malloc_params mparams;
/* Ensure mparams initialized */
#define ensure_initialization() (void)(mparams.magic != 0 || init_mparams())
#define ensure_initialization() (void)0
#if !ONLY_MSPACES

27
third_party/dlmalloc/init.S vendored Normal file
View file

@ -0,0 +1,27 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.init.start 600,_init_dlmalloc
push %rdi
push %rsi
call init_mparams
pop %rsi
pop %rdi
.init.end 600,_init_dlmalloc

View file

@ -1,5 +1,7 @@
// clang-format off
STATIC_YOINK("_init_dlmalloc");
/* ---------------------------- setting mparams -------------------------- */
#if LOCK_AT_FORK
@ -9,13 +11,13 @@ static void dlmalloc_post_fork_child(void) { INITIAL_LOCK(&(gm)->mutex); }
#endif /* LOCK_AT_FORK */
/* Initialize mparams */
static int init_mparams(void) {
int init_mparams(void) {
#ifdef NEED_GLOBAL_LOCK_INIT
if (malloc_global_mutex_status <= 0)
init_malloc_global_mutex();
#endif
ACQUIRE_MALLOC_GLOBAL_LOCK();
// ACQUIRE_MALLOC_GLOBAL_LOCK();
if (mparams.magic == 0) {
size_t magic;
size_t psize;
@ -94,7 +96,7 @@ static int init_mparams(void) {
}
}
RELEASE_MALLOC_GLOBAL_LOCK();
// RELEASE_MALLOC_GLOBAL_LOCK();
return 1;
}

View file

@ -775,17 +775,17 @@ static ssize_t linenoiseRead(int fd, char *buf, size_t size,
}
if (gotcont && rawmode != -1) {
rawmode = -1;
--__strace;
strace_enabled(-1);
linenoiseEnableRawMode(0);
++__strace;
strace_enabled(+1);
if (l) refreshme = 1;
}
if (l && gotwinch) refreshme = 1;
if (refreshme) linenoiseRefreshLine(l);
if (!block && linenoisePoll(l, fd) == -1) return -1;
--__strace;
strace_enabled(-1);
rc = readansi(fd, buf, size);
++__strace;
strace_enabled(+1);
if (rc == -1 && errno == EINTR) {
if (!block) break;
} else {
@ -1286,15 +1286,15 @@ StartOver:
}
void linenoiseRefreshLine(struct linenoiseState *l) {
--__strace;
strace_enabled(-1);
linenoiseRefreshLineImpl(l, 0, 0);
++__strace;
strace_enabled(+1);
}
static void linenoiseRefreshLineForce(struct linenoiseState *l) {
--__strace;
strace_enabled(-1);
linenoiseRefreshLineImpl(l, 1, 0);
++__strace;
strace_enabled(+1);
}
static void linenoiseEditInsert(struct linenoiseState *l, const char *p,
@ -1336,11 +1336,11 @@ static void linenoiseEditEof(struct linenoiseState *l) {
}
static void linenoiseEditRefresh(struct linenoiseState *l) {
--__strace;
strace_enabled(-1);
linenoiseRefreshLineImpl(l, 1,
"\e[H" // move cursor to top left corner
"\e[2J"); // erase display
++__strace;
strace_enabled(+1);
}
static size_t ForwardWord(struct linenoiseState *l, size_t pos) {

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __big5_decmap_once;
static void *__big5_decmap_ptr;
static _Atomic(void *) __big5_decmap_ptr;
static const unsigned char __big5_decmap_rodata[14386] = {
0xad, 0xbb, 0x7b, 0x74, 0x55, 0xe7, 0x75, 0x2f, 0x7a, 0xe7, 0xfc, 0x5e, 0xeb,
0xbd, 0xd6, 0x5e, 0xfb, 0xfd, 0xde, 0xda, 0xda, 0x7a, 0xbf, 0x85, 0x24, 0x84,
@ -1114,9 +1113,7 @@ static const unsigned char __big5_decmap_rodata[14386] = {
};
optimizesize void *__big5_decmap(void) {
if (__big5_decmap_once) return __big5_decmap_ptr;
return xloadzd(&__big5_decmap_once,
&__big5_decmap_ptr,
return xloadzd(&__big5_decmap_ptr,
__big5_decmap_rodata,
14386, 19990, 16702, 2, 0xc97b9dedu); /* 43.0667% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __big5_encmap_once;
static void *__big5_encmap_ptr;
static _Atomic(void *) __big5_encmap_ptr;
static const unsigned char __big5_encmap_rodata[] = {
0xd4, 0xbc, 0x07, 0x57, 0x6a, 0xcb, 0xd2, 0x36, 0xfa, 0xd7, 0xcc, 0x39, 0xe7,
0x9c, 0x73, 0x0e, 0xcb, 0x1c, 0xfe, 0x0b, 0x39, 0xe7, 0x24, 0x88, 0x80, 0x88,
@ -2255,9 +2254,7 @@ static const unsigned char __big5_encmap_rodata[] = {
};
optimizesize void *__big5_encmap(void) {
if (__big5_encmap_once) return __big5_encmap_ptr;
return xload(&__big5_encmap_once,
&__big5_encmap_ptr,
return xload(&__big5_encmap_ptr,
__big5_encmap_rodata,
29219, 43528); /* 67.1269% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __big5hkscs_bmp_encmap_once;
static void *__big5hkscs_bmp_encmap_ptr;
static _Atomic(void *) __big5hkscs_bmp_encmap_ptr;
static const unsigned char __big5hkscs_bmp_encmap_rodata[] = {
0xed, 0x7d, 0xf9, 0x3f, 0x55, 0xdd, 0xf7, 0xf8, 0xbf, 0xd6, 0x40, 0x21, 0x0a,
0x95, 0x21, 0x34, 0x21, 0xa2, 0x32, 0x26, 0x14, 0xbf, 0x3e, 0xd7, 0x83, 0x4a,
@ -765,9 +764,7 @@ static const unsigned char __big5hkscs_bmp_encmap_rodata[] = {
};
optimizesize void *__big5hkscs_bmp_encmap(void) {
if (__big5hkscs_bmp_encmap_once) return __big5hkscs_bmp_encmap_ptr;
return xload(&__big5hkscs_bmp_encmap_once,
&__big5hkscs_bmp_encmap_ptr,
return xload(&__big5hkscs_bmp_encmap_ptr,
__big5hkscs_bmp_encmap_rodata,
9844, 52802); /* 18.6432% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __big5hkscs_decmap_once;
static void *__big5hkscs_decmap_ptr;
static _Atomic(void *) __big5hkscs_decmap_ptr;
static const unsigned char __big5hkscs_decmap_rodata[] = {
0xad, 0x99, 0xf7, 0x57, 0x5a, 0x59, 0xd8, 0xef, 0x2d, 0x98, 0xaa, 0x68, 0x34,
0x51, 0x4c, 0x62, 0x12, 0xa3, 0x98, 0xa6, 0xe6, 0x58, 0x80, 0x28, 0x82, 0x80,
@ -786,9 +785,7 @@ static const unsigned char __big5hkscs_decmap_rodata[] = {
};
optimizesize void *__big5hkscs_decmap(void) {
if (__big5hkscs_decmap_once) return __big5hkscs_decmap_ptr;
return xload(&__big5hkscs_decmap_once,
&__big5hkscs_decmap_ptr,
return xload(&__big5hkscs_decmap_ptr,
__big5hkscs_decmap_rodata,
10118, 12438); /* 81.3475% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __big5hkscs_nonbmp_encmap_once;
static void *__big5hkscs_nonbmp_encmap_ptr;
static _Atomic(void *) __big5hkscs_nonbmp_encmap_ptr;
static const unsigned char __big5hkscs_nonbmp_encmap_rodata[] = {
0xed, 0x1d, 0xe7, 0x43, 0xd3, 0xda, 0xfe, 0x5f, 0x63, 0xc8, 0x12, 0x04, 0x94,
0x21, 0x8a, 0x6c, 0x01, 0x41, 0xc0, 0x01, 0x88, 0x0a, 0xfa, 0xd5, 0x6b, 0xeb,
@ -426,9 +425,7 @@ static const unsigned char __big5hkscs_nonbmp_encmap_rodata[] = {
};
optimizesize void *__big5hkscs_nonbmp_encmap(void) {
if (__big5hkscs_nonbmp_encmap_once) return __big5hkscs_nonbmp_encmap_ptr;
return xload(&__big5hkscs_nonbmp_encmap_once,
&__big5hkscs_nonbmp_encmap_ptr,
return xload(&__big5hkscs_nonbmp_encmap_ptr,
__big5hkscs_nonbmp_encmap_rodata,
5436, 58612); /* 9.27455% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __cp932ext_decmap_once;
static void *__cp932ext_decmap_ptr;
static _Atomic(void *) __cp932ext_decmap_ptr;
static const unsigned char __cp932ext_decmap_rodata[872] = {
0xe5, 0x92, 0x5d, 0x4c, 0xd3, 0x67, 0x18, 0xc5, 0x7d, 0x3e, 0xfe, 0x6f, 0x0b,
0x54, 0xac, 0x5b, 0xd7, 0x2a, 0x73, 0xe0, 0x62, 0x63, 0x1a, 0x56, 0x75, 0x2e,
@ -75,9 +74,7 @@ static const unsigned char __cp932ext_decmap_rodata[872] = {
};
optimizesize void *__cp932ext_decmap(void) {
if (__cp932ext_decmap_once) return __cp932ext_decmap_ptr;
return xloadzd(&__cp932ext_decmap_once,
&__cp932ext_decmap_ptr,
return xloadzd(&__cp932ext_decmap_ptr,
__cp932ext_decmap_rodata,
872, 1534, 969, 2, 0xde26b180u); /* 44.9948% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __cp932ext_encmap_once;
static void *__cp932ext_encmap_ptr;
static _Atomic(void *) __cp932ext_encmap_ptr;
static const unsigned char __cp932ext_encmap_rodata[] = {
0xed, 0x5a, 0x05, 0x73, 0xdb, 0x4c, 0x10, 0xfd, 0x6b, 0x61, 0x66, 0xc6, 0x86,
0x99, 0xa9, 0x98, 0x66, 0xe2, 0xd0, 0x86, 0xd3, 0x40, 0xdb, 0xa4, 0xcc, 0xcc,
@ -107,9 +106,7 @@ static const unsigned char __cp932ext_encmap_rodata[] = {
};
optimizesize void *__cp932ext_encmap(void) {
if (__cp932ext_encmap_once) return __cp932ext_encmap_ptr;
return xload(&__cp932ext_encmap_once,
&__cp932ext_encmap_ptr,
return xload(&__cp932ext_encmap_ptr,
__cp932ext_encmap_rodata,
1293, 19372); /* 6.67458% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __cp949_encmap_once;
static void *__cp949_encmap_ptr;
static _Atomic(void *) __cp949_encmap_ptr;
static const unsigned char __cp949_encmap_rodata[29600] = {
0xb4, 0xbc, 0x0d, 0x54, 0x5b, 0x67, 0x9a, 0x26, 0xc8, 0xc5, 0xcf, 0xab, 0xb8,
0xcb, 0xee, 0x76, 0xaa, 0x9d, 0x99, 0xa4, 0x3b, 0xe9, 0x49, 0xce, 0x26, 0xdd,
@ -2284,9 +2283,7 @@ static const unsigned char __cp949_encmap_rodata[29600] = {
};
optimizesize void *__cp949_encmap(void) {
if (__cp949_encmap_once) return __cp949_encmap_ptr;
return xloadzd(&__cp949_encmap_once,
&__cp949_encmap_ptr,
return xloadzd(&__cp949_encmap_ptr,
__cp949_encmap_rodata,
29600, 54513, 33133, 2, 0x97300f27u); /* 44.6685% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __cp949ext_decmap_once;
static void *__cp949ext_decmap_ptr;
static _Atomic(void *) __cp949ext_decmap_ptr;
static const unsigned char __cp949ext_decmap_rodata[1970] = {
0xb5, 0x5a, 0x09, 0x53, 0x14, 0x47, 0x14, 0xce, 0x9b, 0xea, 0x74, 0x4d, 0x6d,
0x51, 0xa9, 0x94, 0xbf, 0x58, 0x0c, 0x06, 0x14, 0x03, 0x09, 0x15, 0x14, 0x2c,
@ -159,9 +158,7 @@ static const unsigned char __cp949ext_decmap_rodata[1970] = {
};
optimizesize void *__cp949ext_decmap(void) {
if (__cp949ext_decmap_once) return __cp949ext_decmap_ptr;
return xloadzd(&__cp949ext_decmap_once,
&__cp949ext_decmap_ptr,
return xloadzd(&__cp949ext_decmap_ptr,
__cp949ext_decmap_rodata,
1970, 10204, 9650, 2, 0xb92a1dffu); /* 10.2073% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __cp950ext_decmap_once;
static void *__cp950ext_decmap_ptr;
static _Atomic(void *) __cp950ext_decmap_ptr;
static const unsigned char __cp950ext_decmap_rodata[92] = {
0x3b, 0xd7, 0xc0, 0xb8, 0xee, 0x3f, 0x1b, 0x03, 0x04, 0xdc, 0x64, 0xbb, 0x05,
0x63, 0xd2, 0x11, 0xcc, 0xfd, 0xcb, 0x3e, 0xef, 0x2f, 0x3b, 0x01, 0x45, 0xfb,
@ -15,9 +14,7 @@ static const unsigned char __cp950ext_decmap_rodata[92] = {
};
optimizesize void *__cp950ext_decmap(void) {
if (__cp950ext_decmap_once) return __cp950ext_decmap_ptr;
return xloadzd(&__cp950ext_decmap_once,
&__cp950ext_decmap_ptr,
return xloadzd(&__cp950ext_decmap_ptr,
__cp950ext_decmap_rodata,
92, 256, 224, 2, 0x852ba419u); /* 20.5357% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __cp950ext_encmap_once;
static void *__cp950ext_encmap_ptr;
static _Atomic(void *) __cp950ext_encmap_ptr;
static const unsigned char __cp950ext_encmap_rodata[] = {
0xed, 0x93, 0x49, 0x0e, 0x82, 0x40, 0x14, 0x44, 0xaf, 0x26, 0x46, 0x71, 0xe7,
0x1d, 0xbb, 0xbd, 0x89, 0x87, 0x00, 0x1c, 0x01, 0x1b, 0xd0, 0x05, 0x38, 0xe1,
@ -17,9 +16,7 @@ static const unsigned char __cp950ext_encmap_rodata[] = {
};
optimizesize void *__cp950ext_encmap(void) {
if (__cp950ext_encmap_once) return __cp950ext_encmap_ptr;
return xload(&__cp950ext_encmap_once,
&__cp950ext_encmap_ptr,
return xload(&__cp950ext_encmap_ptr,
__cp950ext_encmap_rodata,
121, 1162); /* 10.4131% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __gb18030ext_decmap_once;
static void *__gb18030ext_decmap_ptr;
static _Atomic(void *) __gb18030ext_decmap_ptr;
static const unsigned char __gb18030ext_decmap_rodata[405] = {
0xeb, 0x99, 0xcc, 0xce, 0x44, 0x11, 0xf8, 0x92, 0xfd, 0x31, 0x9b, 0x89, 0xb6,
0x60, 0x4b, 0xd6, 0xc6, 0x2c, 0x42, 0x6a, 0x3e, 0x65, 0x32, 0xc0, 0xc0, 0xfa,
@ -39,9 +38,7 @@ static const unsigned char __gb18030ext_decmap_rodata[405] = {
};
optimizesize void *__gb18030ext_decmap(void) {
if (__gb18030ext_decmap_once) return __gb18030ext_decmap_ptr;
return xloadzd(&__gb18030ext_decmap_once,
&__gb18030ext_decmap_ptr,
return xloadzd(&__gb18030ext_decmap_ptr,
__gb18030ext_decmap_rodata,
405, 2867, 2729, 2, 0x8e6ddc4au); /* 7.4203% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __gb18030ext_encmap_once;
static void *__gb18030ext_encmap_ptr;
static _Atomic(void *) __gb18030ext_encmap_ptr;
static const unsigned char __gb18030ext_encmap_rodata[400] = {
0xed, 0x56, 0x5b, 0x4b, 0x02, 0x61, 0x10, 0x5d, 0xc7, 0x9d, 0x93, 0x89, 0x0f,
0x41, 0x90, 0xe0, 0xcf, 0xe8, 0xa9, 0x1f, 0xd0, 0x63, 0x7f, 0x2a, 0xa9, 0x28,
@ -38,9 +37,7 @@ static const unsigned char __gb18030ext_encmap_rodata[400] = {
};
optimizesize void *__gb18030ext_encmap(void) {
if (__gb18030ext_encmap_once) return __gb18030ext_encmap_ptr;
return xloadzd(&__gb18030ext_encmap_once,
&__gb18030ext_encmap_ptr,
return xloadzd(&__gb18030ext_encmap_ptr,
__gb18030ext_encmap_rodata,
400, 3366, 3227, 2, 0xd8a75b40u); /* 6.19771% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __gb2312_decmap_once;
static void *__gb2312_decmap_ptr;
static _Atomic(void *) __gb2312_decmap_ptr;
static const unsigned char __gb2312_decmap_rodata[11651] = {
0xb5, 0xbb, 0x77, 0x54, 0x54, 0xd9, 0xd7, 0x2d, 0x7a, 0xe7, 0xae, 0x53, 0x45,
0x51, 0x14, 0x05, 0x14, 0x45, 0x46, 0x92, 0x48, 0x52, 0x10, 0x05, 0x05, 0x51,
@ -904,9 +903,7 @@ static const unsigned char __gb2312_decmap_rodata[11651] = {
};
optimizesize void *__gb2312_decmap(void) {
if (__gb2312_decmap_once) return __gb2312_decmap_ptr;
return xloadzd(&__gb2312_decmap_once,
&__gb2312_decmap_ptr,
return xloadzd(&__gb2312_decmap_ptr,
__gb2312_decmap_rodata,
11651, 13102, 7482, 2, 0xa41681b8u); /* 77.8602% profit */
}

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 */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __gbkext_decmap_once;
static void *__gbkext_decmap_ptr;
static _Atomic(void *) __gbkext_decmap_ptr;
static const unsigned char __gbkext_decmap_rodata[3936] = {
0xbd, 0x5b, 0xdb, 0x73, 0x56, 0xd5, 0x15, 0x97, 0xbd, 0x7f, 0x67, 0x65, 0xbb,
0xe7, 0x78, 0xe6, 0x9b, 0x4c, 0x26, 0xc3, 0x30, 0x3c, 0x38, 0x3e, 0x74, 0x3a,
@ -310,9 +309,7 @@ static const unsigned char __gbkext_decmap_rodata[3936] = {
};
optimizesize void *__gbkext_decmap(void) {
if (__gbkext_decmap_once) return __gbkext_decmap_ptr;
return xloadzd(&__gbkext_decmap_once,
&__gbkext_decmap_ptr,
return xloadzd(&__gbkext_decmap_ptr,
__gbkext_decmap_rodata,
3936, 15071, 14531, 2, 0xe6585743u); /* 13.5435% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __jisx0208_decmap_once;
static void *__jisx0208_decmap_ptr;
static _Atomic(void *) __jisx0208_decmap_ptr;
static const unsigned char __jisx0208_decmap_rodata[9445] = {
0xb5, 0x7a, 0x7b, 0x54, 0x14, 0x57, 0xd6, 0xef, 0xb7, 0x4f, 0x9d, 0x7a, 0x76,
0x75, 0x75, 0x75, 0xf5, 0x83, 0xa6, 0x69, 0x9a, 0xa6, 0x69, 0x9b, 0xa7, 0x08,
@ -734,9 +733,7 @@ static const unsigned char __jisx0208_decmap_rodata[9445] = {
};
optimizesize void *__jisx0208_decmap(void) {
if (__jisx0208_decmap_once) return __jisx0208_decmap_ptr;
return xloadzd(&__jisx0208_decmap_once,
&__jisx0208_decmap_ptr,
return xloadzd(&__jisx0208_decmap_ptr,
__jisx0208_decmap_rodata,
9445, 10703, 6956, 2, 0x09f8b079u); /* 67.891% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __jisx0212_decmap_once;
static void *__jisx0212_decmap_ptr;
static _Atomic(void *) __jisx0212_decmap_ptr;
static const unsigned char __jisx0212_decmap_rodata[3327] = {
0x8d, 0x58, 0x5d, 0xa8, 0x6d, 0x55, 0x15, 0x6e, 0x8d, 0x3d, 0x9d, 0x6b, 0x38,
0xcf, 0x74, 0xde, 0xe9, 0x74, 0xb9, 0xdc, 0x6d, 0xb7, 0xdb, 0xe3, 0xe1, 0x74,
@ -263,9 +262,7 @@ static const unsigned char __jisx0212_decmap_rodata[3327] = {
};
optimizesize void *__jisx0212_decmap(void) {
if (__jisx0212_decmap_once) return __jisx0212_decmap_ptr;
return xloadzd(&__jisx0212_decmap_once,
&__jisx0212_decmap_ptr,
return xloadzd(&__jisx0212_decmap_ptr,
__jisx0212_decmap_rodata,
3327, 6340, 6179, 2, 0xebc09e11u); /* 26.9218% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __jisx0213_1_bmp_decmap_once;
static void *__jisx0213_1_bmp_decmap_ptr;
static _Atomic(void *) __jisx0213_1_bmp_decmap_ptr;
static const unsigned char __jisx0213_1_bmp_decmap_rodata[2205] = {
0x8d, 0x56, 0x0d, 0x70, 0x14, 0x45, 0x16, 0xb6, 0x5f, 0xbf, 0xee, 0x6d, 0xe6,
0x86, 0x71, 0x18, 0xa7, 0x86, 0x61, 0x19, 0x86, 0x71, 0x5d, 0x96, 0x75, 0x6b,
@ -177,9 +176,7 @@ static const unsigned char __jisx0213_1_bmp_decmap_rodata[2205] = {
};
optimizesize void *__jisx0213_1_bmp_decmap(void) {
if (__jisx0213_1_bmp_decmap_once) return __jisx0213_1_bmp_decmap_ptr;
return xloadzd(&__jisx0213_1_bmp_decmap_once,
&__jisx0213_1_bmp_decmap_ptr,
return xloadzd(&__jisx0213_1_bmp_decmap_ptr,
__jisx0213_1_bmp_decmap_rodata,
2205, 2892, 2197, 2, 0x54509b20u); /* 50.1821% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __jisx0213_1_emp_decmap_once;
static void *__jisx0213_1_emp_decmap_ptr;
static _Atomic(void *) __jisx0213_1_emp_decmap_ptr;
static const unsigned char __jisx0213_1_emp_decmap_rodata[] = {
0xe3, 0x66, 0xb0, 0x15, 0xfa, 0xf7, 0x1f, 0x1d, 0x4a, 0x0b, 0x63, 0x8a, 0x61,
0x83, 0x79, 0x22, 0xc4, 0xa9, 0x43, 0x85, 0x7b, 0x25, 0xe6, 0x73, 0xe3, 0x93,
@ -15,9 +14,7 @@ static const unsigned char __jisx0213_1_emp_decmap_rodata[] = {
};
optimizesize void *__jisx0213_1_emp_decmap(void) {
if (__jisx0213_1_emp_decmap_once) return __jisx0213_1_emp_decmap_ptr;
return xload(&__jisx0213_1_emp_decmap_once,
&__jisx0213_1_emp_decmap_ptr,
return xload(&__jisx0213_1_emp_decmap_ptr,
__jisx0213_1_emp_decmap_rodata,
93, 680); /* 13.6765% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __jisx0213_2_bmp_decmap_once;
static void *__jisx0213_2_bmp_decmap_ptr;
static _Atomic(void *) __jisx0213_2_bmp_decmap_ptr;
static const unsigned char __jisx0213_2_bmp_decmap_rodata[3265] = {
0x2d, 0x57, 0x7b, 0x4c, 0x1d, 0x57, 0x7a, 0xbf, 0xdf, 0xe3, 0x9c, 0x9c, 0x4e,
0x67, 0xa7, 0xb3, 0xd3, 0xd9, 0xe9, 0xed, 0xcd, 0xd5, 0xd5, 0xdd, 0x5b, 0xf7,
@ -259,9 +258,7 @@ static const unsigned char __jisx0213_2_bmp_decmap_rodata[3265] = {
};
optimizesize void *__jisx0213_2_bmp_decmap(void) {
if (__jisx0213_2_bmp_decmap_once) return __jisx0213_2_bmp_decmap_ptr;
return xloadzd(&__jisx0213_2_bmp_decmap_once,
&__jisx0213_2_bmp_decmap_ptr,
return xloadzd(&__jisx0213_2_bmp_decmap_ptr,
__jisx0213_2_bmp_decmap_rodata,
3265, 3827, 2425, 2, 0x261de97fu); /* 67.3196% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __jisx0213_2_emp_decmap_once;
static void *__jisx0213_2_emp_decmap_ptr;
static _Atomic(void *) __jisx0213_2_emp_decmap_ptr;
static const unsigned char __jisx0213_2_emp_decmap_rodata[] = {
0xeb, 0x64, 0xf8, 0xf7, 0x1f, 0x1d, 0x2e, 0x02, 0x8b, 0x2d, 0x41, 0x93, 0x59,
0xc4, 0x88, 0xa9, 0x12, 0x19, 0x0a, 0x33, 0xe1, 0x97, 0x27, 0x07, 0x6a, 0x33,
@ -80,9 +79,7 @@ static const unsigned char __jisx0213_2_emp_decmap_rodata[] = {
};
optimizesize void *__jisx0213_2_emp_decmap(void) {
if (__jisx0213_2_emp_decmap_once) return __jisx0213_2_emp_decmap_ptr;
return xload(&__jisx0213_2_emp_decmap_once,
&__jisx0213_2_emp_decmap_ptr,
return xload(&__jisx0213_2_emp_decmap_ptr,
__jisx0213_2_emp_decmap_rodata,
942, 4106); /* 22.942% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __jisx0213_bmp_encmap_once;
static void *__jisx0213_bmp_encmap_ptr;
static _Atomic(void *) __jisx0213_bmp_encmap_ptr;
static const unsigned char __jisx0213_bmp_encmap_rodata[] = {
0xed, 0x5d, 0x67, 0x77, 0xda, 0x4a, 0x13, 0xfe, 0x2d, 0x06, 0x1b, 0x90, 0x90,
0xc0, 0xbd, 0xf7, 0xde, 0x71, 0x01, 0xf7, 0x8a, 0x0b, 0xb8, 0x60, 0x8c, 0xe9,
@ -807,9 +806,7 @@ static const unsigned char __jisx0213_bmp_encmap_rodata[] = {
};
optimizesize void *__jisx0213_bmp_encmap(void) {
if (__jisx0213_bmp_encmap_once) return __jisx0213_bmp_encmap_ptr;
return xload(&__jisx0213_bmp_encmap_once,
&__jisx0213_bmp_encmap_ptr,
return xload(&__jisx0213_bmp_encmap_ptr,
__jisx0213_bmp_encmap_rodata,
10392, 54574); /* 19.042% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __jisx0213_emp_encmap_once;
static void *__jisx0213_emp_encmap_ptr;
static _Atomic(void *) __jisx0213_emp_encmap_ptr;
static const unsigned char __jisx0213_emp_encmap_rodata[] = {
0xed, 0x5a, 0xdb, 0x4e, 0xe2, 0x50, 0x14, 0xfd, 0x16, 0x40, 0xe2, 0x80, 0x8e,
0x38, 0x55, 0xbc, 0x30, 0x82, 0x0e, 0x3a, 0xde, 0x47, 0x1c, 0x2f, 0x28, 0x2a,
@ -79,9 +78,7 @@ static const unsigned char __jisx0213_emp_encmap_rodata[] = {
};
optimizesize void *__jisx0213_emp_encmap(void) {
if (__jisx0213_emp_encmap_once) return __jisx0213_emp_encmap_ptr;
return xload(&__jisx0213_emp_encmap_once,
&__jisx0213_emp_encmap_ptr,
return xload(&__jisx0213_emp_encmap_ptr,
__jisx0213_emp_encmap_rodata,
934, 17574); /* 5.31467% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __jisx0213_pair_decmap_once;
static void *__jisx0213_pair_decmap_ptr;
static _Atomic(void *) __jisx0213_pair_decmap_ptr;
static const unsigned char __jisx0213_pair_decmap_rodata[71] = {
0xdb, 0x72, 0xe8, 0x66, 0x0b, 0x5b, 0x43, 0x83, 0x00, 0x12, 0x3a, 0xc0, 0x8a,
0xca, 0x77, 0x68, 0x68, 0xf0, 0x68, 0x68, 0x50, 0x68, 0x68, 0xf8, 0x21, 0xb4,
@ -13,9 +12,7 @@ static const unsigned char __jisx0213_pair_decmap_rodata[71] = {
};
optimizesize void *__jisx0213_pair_decmap(void) {
if (__jisx0213_pair_decmap_once) return __jisx0213_pair_decmap_ptr;
return xloadzd(&__jisx0213_pair_decmap_once,
&__jisx0213_pair_decmap_ptr,
return xloadzd(&__jisx0213_pair_decmap_ptr,
__jisx0213_pair_decmap_rodata,
71, 107, 49, 4, 0x939c298fu); /* 36.2245% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __jisxcommon_encmap_once;
static void *__jisxcommon_encmap_ptr;
static _Atomic(void *) __jisxcommon_encmap_ptr;
static const unsigned char __jisxcommon_encmap_rodata[] = {
0xdc, 0xbc, 0xe5, 0x72, 0x63, 0xcb, 0x96, 0x2e, 0xfa, 0x2c, 0x92, 0x35, 0x05,
0xb6, 0x6c, 0x31, 0x33, 0x33, 0x33, 0xb3, 0x2d, 0x99, 0x41, 0x66, 0x78, 0x98,
@ -2101,9 +2100,7 @@ static const unsigned char __jisxcommon_encmap_rodata[] = {
};
optimizesize void *__jisxcommon_encmap(void) {
if (__jisxcommon_encmap_once) return __jisxcommon_encmap_ptr;
return xload(&__jisxcommon_encmap_once,
&__jisxcommon_encmap_ptr,
return xload(&__jisxcommon_encmap_ptr,
__jisxcommon_encmap_rodata,
27219, 44032); /* 61.8164% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool __ksx1001_decmap_once;
static void *__ksx1001_decmap_ptr;
static _Atomic(void *) __ksx1001_decmap_ptr;
static const unsigned char __ksx1001_decmap_rodata[10685] = {
0xb5, 0x79, 0x0d, 0x78, 0x93, 0x55, 0x9a, 0xf6, 0x3e, 0xe7, 0x9c, 0xf7, 0x27,
0x6f, 0xfe, 0x93, 0x36, 0x4d, 0xff, 0x4b, 0x29, 0x50, 0x7e, 0x06, 0x11, 0x10,
@ -829,9 +828,7 @@ static const unsigned char __ksx1001_decmap_rodata[10685] = {
};
optimizesize void *__ksx1001_decmap(void) {
if (__ksx1001_decmap_once) return __ksx1001_decmap_ptr;
return xloadzd(&__ksx1001_decmap_once,
&__ksx1001_decmap_ptr,
return xloadzd(&__ksx1001_decmap_ptr,
__ksx1001_decmap_rodata,
10685, 13606, 8264, 2, 0x91d24d83u); /* 64.6479% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool big5_decmap_once;
static void *big5_decmap_ptr;
static _Atomic(void *) big5_decmap_ptr;
static const unsigned char big5_decmap_rodata[] = {
0xed, 0xd0, 0x3b, 0x4b, 0x15, 0x00, 0x1c, 0x86, 0xf1, 0x73, 0x34, 0xef, 0x69,
0xde, 0x32, 0xcb, 0x63, 0x69, 0xa9, 0x59, 0x5a, 0x5e, 0xce, 0xc9, 0x73, 0xf2,
@ -31,9 +30,7 @@ static const unsigned char big5_decmap_rodata[] = {
};
optimizesize void *big5_decmap(void) {
if (big5_decmap_once) return big5_decmap_ptr;
return xload(&big5_decmap_once,
&big5_decmap_ptr,
return xload(&big5_decmap_ptr,
big5_decmap_rodata,
305, 1024); /* 29.7852% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool big5_encmap_once;
static void *big5_encmap_ptr;
static _Atomic(void *) big5_encmap_ptr;
static const unsigned char big5_encmap_rodata[] = {
0xed, 0xcf, 0x3b, 0x4c, 0x53, 0x71, 0x14, 0xc7, 0xf1, 0xdf, 0xe9, 0xed, 0x45,
0x4a, 0x6f, 0x1f, 0x80, 0x4f, 0x40, 0xe4, 0xfd, 0x10, 0x51, 0x1e, 0x0a, 0x2a,
@ -37,9 +36,7 @@ static const unsigned char big5_encmap_rodata[] = {
};
optimizesize void *big5_encmap(void) {
if (big5_encmap_once) return big5_encmap_ptr;
return xload(&big5_encmap_once,
&big5_encmap_ptr,
return xload(&big5_encmap_ptr,
big5_encmap_rodata,
384, 1024); /* 37.5% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool big5hkscs_bmp_encmap_once;
static void *big5hkscs_bmp_encmap_ptr;
static _Atomic(void *) big5hkscs_bmp_encmap_ptr;
static const unsigned char big5hkscs_bmp_encmap_rodata[] = {
0x63, 0x64, 0x58, 0xf1, 0x27, 0x8c, 0x81, 0xe1, 0x8e, 0x31, 0x63, 0xc0, 0x31,
0x06, 0x20, 0x58, 0xc5, 0xc8, 0x18, 0xc8, 0x40, 0x07, 0xf0, 0x9b, 0x71, 0xdf,
@ -49,9 +48,7 @@ static const unsigned char big5hkscs_bmp_encmap_rodata[] = {
};
optimizesize void *big5hkscs_bmp_encmap(void) {
if (big5hkscs_bmp_encmap_once) return big5hkscs_bmp_encmap_ptr;
return xload(&big5hkscs_bmp_encmap_once,
&big5hkscs_bmp_encmap_ptr,
return xload(&big5hkscs_bmp_encmap_ptr,
big5hkscs_bmp_encmap_rodata,
545, 1024); /* 53.2227% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool big5hkscs_decmap_once;
static void *big5hkscs_decmap_ptr;
static _Atomic(void *) big5hkscs_decmap_ptr;
static const unsigned char big5hkscs_decmap_rodata[] = {
0xed, 0xcf, 0x3d, 0x0e, 0x01, 0x51, 0x00, 0x45, 0xe1, 0x37, 0x18, 0xff, 0x66,
0x18, 0x63, 0x24, 0x1a, 0x8d, 0x5d, 0x68, 0xce, 0x0e, 0x48, 0x14, 0x0a, 0x8d,
@ -19,9 +18,7 @@ static const unsigned char big5hkscs_decmap_rodata[] = {
};
optimizesize void *big5hkscs_decmap(void) {
if (big5hkscs_decmap_once) return big5hkscs_decmap_ptr;
return xload(&big5hkscs_decmap_once,
&big5hkscs_decmap_ptr,
return xload(&big5hkscs_decmap_ptr,
big5hkscs_decmap_rodata,
150, 1024); /* 14.6484% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool big5hkscs_nonbmp_encmap_once;
static void *big5hkscs_nonbmp_encmap_ptr;
static _Atomic(void *) big5hkscs_nonbmp_encmap_ptr;
static const unsigned char big5hkscs_nonbmp_encmap_rodata[] = {
0x63, 0x64, 0x50, 0x7c, 0x77, 0x9e, 0x81, 0xe7, 0xd3, 0x36, 0x46, 0x96, 0xa7,
0x33, 0x98, 0xb8, 0xfe, 0x74, 0x33, 0x0b, 0xff, 0x2b, 0x67, 0x71, 0x7f, 0x2d,
@ -62,9 +61,7 @@ static const unsigned char big5hkscs_nonbmp_encmap_rodata[] = {
};
optimizesize void *big5hkscs_nonbmp_encmap(void) {
if (big5hkscs_nonbmp_encmap_once) return big5hkscs_nonbmp_encmap_ptr;
return xload(&big5hkscs_nonbmp_encmap_once,
&big5hkscs_nonbmp_encmap_ptr,
return xload(&big5hkscs_nonbmp_encmap_ptr,
big5hkscs_nonbmp_encmap_rodata,
705, 1024); /* 68.8477% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool cp932ext_decmap_once;
static void *cp932ext_decmap_ptr;
static _Atomic(void *) cp932ext_decmap_ptr;
static const unsigned char cp932ext_decmap_rodata[] = {
0x63, 0x60, 0x18, 0x05, 0x23, 0x1d, 0x30, 0x32, 0xc4, 0x9f, 0xc2, 0x26, 0x9e,
0xcb, 0xe0, 0x30, 0x67, 0x34, 0x74, 0x06, 0x1f, 0x38, 0xc5, 0xe0, 0xf0, 0xa7,
@ -11,9 +10,7 @@ static const unsigned char cp932ext_decmap_rodata[] = {
};
optimizesize void *cp932ext_decmap(void) {
if (cp932ext_decmap_once) return cp932ext_decmap_ptr;
return xload(&cp932ext_decmap_once,
&cp932ext_decmap_ptr,
return xload(&cp932ext_decmap_ptr,
cp932ext_decmap_rodata,
48, 1024); /* 4.6875% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool cp932ext_encmap_once;
static void *cp932ext_encmap_ptr;
static _Atomic(void *) cp932ext_encmap_ptr;
static const unsigned char cp932ext_encmap_rodata[] = {
0x63, 0x60, 0x18, 0x78, 0xc0, 0xc8, 0x20, 0x56, 0x99, 0xca, 0x20, 0xb8, 0x1f,
0xc4, 0x16, 0x61, 0x4c, 0x28, 0x26, 0x45, 0xaf, 0x06, 0xa3, 0xac, 0x3c, 0x88,
@ -36,9 +35,7 @@ static const unsigned char cp932ext_encmap_rodata[] = {
};
optimizesize void *cp932ext_encmap(void) {
if (cp932ext_encmap_once) return cp932ext_encmap_ptr;
return xload(&cp932ext_encmap_once,
&cp932ext_encmap_ptr,
return xload(&cp932ext_encmap_ptr,
cp932ext_encmap_rodata,
367, 1024); /* 35.8398% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool cp949_encmap_once;
static void *cp949_encmap_ptr;
static _Atomic(void *) cp949_encmap_ptr;
static const unsigned char cp949_encmap_rodata[] = {
0xcd, 0xd0, 0x5b, 0x48, 0x93, 0x61, 0x18, 0x07, 0xf0, 0xe7, 0xfd, 0x0e, 0xfb,
0x76, 0xe8, 0x6b, 0x6d, 0x6a, 0xab, 0x65, 0xa6, 0x35, 0x9d, 0x1d, 0xb6, 0xd4,
@ -49,9 +48,7 @@ static const unsigned char cp949_encmap_rodata[] = {
};
optimizesize void *cp949_encmap(void) {
if (cp949_encmap_once) return cp949_encmap_ptr;
return xload(&cp949_encmap_once,
&cp949_encmap_ptr,
return xload(&cp949_encmap_ptr,
cp949_encmap_rodata,
534, 1024); /* 52.1484% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool cp949ext_decmap_once;
static void *cp949ext_decmap_ptr;
static _Atomic(void *) cp949ext_decmap_ptr;
static const unsigned char cp949ext_decmap_rodata[] = {
0xed, 0xd1, 0xaf, 0x37, 0x83, 0x61, 0x00, 0xc5, 0xf1, 0xf7, 0x31, 0x0c, 0xf3,
0x63, 0x36, 0x8c, 0xcd, 0xcc, 0xb3, 0x59, 0x5a, 0x14, 0x97, 0x6e, 0x58, 0x54,
@ -23,9 +22,7 @@ static const unsigned char cp949ext_decmap_rodata[] = {
};
optimizesize void *cp949ext_decmap(void) {
if (cp949ext_decmap_once) return cp949ext_decmap_ptr;
return xload(&cp949ext_decmap_once,
&cp949ext_decmap_ptr,
return xload(&cp949ext_decmap_ptr,
cp949ext_decmap_rodata,
196, 1024); /* 19.1406% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool cp950ext_decmap_once;
static void *cp950ext_decmap_ptr;
static _Atomic(void *) cp950ext_decmap_ptr;
static const unsigned char cp950ext_decmap_rodata[] = {
0x63, 0x60, 0x18, 0x05, 0xa3, 0x60, 0x60, 0x01, 0x23, 0x83, 0xeb, 0xe7, 0x0d,
0x0c, 0x8e, 0xee, 0xdb, 0x19, 0x1e, 0x3e, 0x1c, 0x0d, 0x0d, 0xea, 0x83, 0x1d,
@ -10,9 +9,7 @@ static const unsigned char cp950ext_decmap_rodata[] = {
};
optimizesize void *cp950ext_decmap(void) {
if (cp950ext_decmap_once) return cp950ext_decmap_ptr;
return xload(&cp950ext_decmap_once,
&cp950ext_decmap_ptr,
return xload(&cp950ext_decmap_ptr,
cp950ext_decmap_rodata,
33, 1024); /* 3.22266% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool cp950ext_encmap_once;
static void *cp950ext_encmap_ptr;
static _Atomic(void *) cp950ext_encmap_ptr;
static const unsigned char cp950ext_encmap_rodata[] = {
0x63, 0x64, 0x58, 0xbf, 0x9e, 0x61, 0x00, 0x01, 0x13, 0x83, 0xfa, 0x1a, 0x10,
0xdd, 0xc1, 0x20, 0x3a, 0x13, 0x26, 0xc6, 0xcb, 0x18, 0x38, 0x99, 0x61, 0x98,
@ -14,9 +13,7 @@ static const unsigned char cp950ext_encmap_rodata[] = {
};
optimizesize void *cp950ext_encmap(void) {
if (cp950ext_encmap_once) return cp950ext_encmap_ptr;
return xload(&cp950ext_encmap_once,
&cp950ext_encmap_ptr,
return xload(&cp950ext_encmap_ptr,
cp950ext_encmap_rodata,
83, 1024); /* 8.10547% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool gb18030ext_decmap_once;
static void *gb18030ext_decmap_ptr;
static _Atomic(void *) gb18030ext_decmap_ptr;
static const unsigned char gb18030ext_decmap_rodata[] = {
0x63, 0x60, 0x18, 0x05, 0xa3, 0x60, 0x60, 0x01, 0x23, 0x83, 0xc3, 0x82, 0x24,
0x06, 0x87, 0x7f, 0x8a, 0x8c, 0x0e, 0x0b, 0x9a, 0x18, 0x1d, 0xfe, 0x39, 0x32,
@ -15,9 +14,7 @@ static const unsigned char gb18030ext_decmap_rodata[] = {
};
optimizesize void *gb18030ext_decmap(void) {
if (gb18030ext_decmap_once) return gb18030ext_decmap_ptr;
return xload(&gb18030ext_decmap_once,
&gb18030ext_decmap_ptr,
return xload(&gb18030ext_decmap_ptr,
gb18030ext_decmap_rodata,
100, 1024); /* 9.76562% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool gb18030ext_encmap_once;
static void *gb18030ext_encmap_ptr;
static _Atomic(void *) gb18030ext_encmap_ptr;
static const unsigned char gb18030ext_encmap_rodata[] = {
0x63, 0x60, 0x60, 0x60, 0x60, 0x64, 0xf8, 0xf9, 0x93, 0x61, 0x80, 0x00, 0x13,
0xc3, 0x9a, 0x35, 0xe4, 0xe8, 0x63, 0x66, 0x68, 0x3c, 0xe5, 0xcb, 0xf0, 0xe1,
@ -19,9 +18,7 @@ static const unsigned char gb18030ext_encmap_rodata[] = {
};
optimizesize void *gb18030ext_encmap(void) {
if (gb18030ext_encmap_once) return gb18030ext_encmap_ptr;
return xload(&gb18030ext_encmap_once,
&gb18030ext_encmap_ptr,
return xload(&gb18030ext_encmap_ptr,
gb18030ext_encmap_rodata,
146, 1024); /* 14.2578% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool gb2312_decmap_once;
static void *gb2312_decmap_ptr;
static _Atomic(void *) gb2312_decmap_ptr;
static const unsigned char gb2312_decmap_rodata[] = {
0xed, 0xcb, 0xbd, 0x2b, 0xc4, 0x01, 0x00, 0xc6, 0xf1, 0xdf, 0xef, 0xbc, 0xdc,
0x1d, 0x0e, 0xe7, 0xed, 0xce, 0x4b, 0xea, 0x91, 0x62, 0x52, 0x67, 0xa1, 0x4c,
@ -26,9 +25,7 @@ static const unsigned char gb2312_decmap_rodata[] = {
};
optimizesize void *gb2312_decmap(void) {
if (gb2312_decmap_once) return gb2312_decmap_ptr;
return xload(&gb2312_decmap_once,
&gb2312_decmap_ptr,
return xload(&gb2312_decmap_ptr,
gb2312_decmap_rodata,
242, 1024); /* 23.6328% profit */
}

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[] = {
0xed, 0xce, 0xbb, 0x32, 0x03, 0x61, 0x18, 0x87, 0xf1, 0xef, 0xcb, 0x66, 0x57,
0xb0, 0x88, 0x65, 0x11, 0xc7, 0x84, 0x04, 0x4b, 0x10, 0x11, 0x71, 0x88, 0x63,
@ -28,9 +27,7 @@ static const unsigned char gbcommon_encmap_rodata[] = {
};
optimizesize void *gbcommon_encmap(void) {
if (gbcommon_encmap_once) return gbcommon_encmap_ptr;
return xload(&gbcommon_encmap_once,
&gbcommon_encmap_ptr,
return xload(&gbcommon_encmap_ptr,
gbcommon_encmap_rodata,
263, 1024); /* 25.6836% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool gbkext_decmap_once;
static void *gbkext_decmap_ptr;
static _Atomic(void *) gbkext_decmap_ptr;
static const unsigned char gbkext_decmap_rodata[] = {
0xed, 0xd0, 0xdf, 0x4b, 0x13, 0x00, 0x1c, 0x04, 0xf0, 0xe9, 0x5a, 0xae, 0x96,
0x3f, 0x72, 0xd5, 0x56, 0xcb, 0x52, 0xa7, 0x6b, 0x6e, 0xb5, 0xcc, 0xd9, 0x1a,
@ -36,9 +35,7 @@ static const unsigned char gbkext_decmap_rodata[] = {
};
optimizesize void *gbkext_decmap(void) {
if (gbkext_decmap_once) return gbkext_decmap_ptr;
return xload(&gbkext_decmap_once,
&gbkext_decmap_ptr,
return xload(&gbkext_decmap_ptr,
gbkext_decmap_rodata,
370, 1024); /* 36.1328% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisx0208_decmap_once;
static void *jisx0208_decmap_ptr;
static _Atomic(void *) jisx0208_decmap_ptr;
static const unsigned char jisx0208_decmap_rodata[] = {
0xed, 0xcb, 0xbf, 0x47, 0xc4, 0x71, 0x00, 0xc6, 0xf1, 0xcf, 0xf7, 0xae, 0xae,
0xbb, 0xea, 0xea, 0xea, 0xea, 0xfa, 0x25, 0x7a, 0x44, 0x11, 0x71, 0x5b, 0x1c,
@ -26,9 +25,7 @@ static const unsigned char jisx0208_decmap_rodata[] = {
};
optimizesize void *jisx0208_decmap(void) {
if (jisx0208_decmap_once) return jisx0208_decmap_ptr;
return xload(&jisx0208_decmap_once,
&jisx0208_decmap_ptr,
return xload(&jisx0208_decmap_ptr,
jisx0208_decmap_rodata,
236, 1024); /* 23.0469% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisx0212_decmap_once;
static void *jisx0212_decmap_ptr;
static _Atomic(void *) jisx0212_decmap_ptr;
static const unsigned char jisx0212_decmap_rodata[] = {
0xed, 0xcb, 0x2f, 0x2c, 0xc4, 0x71, 0x1c, 0xc6, 0xf1, 0xef, 0xef, 0x70, 0x87,
0x73, 0xdc, 0xf9, 0xf7, 0x0b, 0x97, 0x9e, 0x8d, 0x09, 0xc2, 0x4d, 0x30, 0x41,
@ -25,9 +24,7 @@ static const unsigned char jisx0212_decmap_rodata[] = {
};
optimizesize void *jisx0212_decmap(void) {
if (jisx0212_decmap_once) return jisx0212_decmap_ptr;
return xload(&jisx0212_decmap_once,
&jisx0212_decmap_ptr,
return xload(&jisx0212_decmap_ptr,
jisx0212_decmap_rodata,
224, 1024); /* 21.875% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisx0213_1_bmp_decmap_once;
static void *jisx0213_1_bmp_decmap_ptr;
static _Atomic(void *) jisx0213_1_bmp_decmap_ptr;
static const unsigned char jisx0213_1_bmp_decmap_rodata[] = {
0x63, 0x60, 0x18, 0x1c, 0x80, 0x91, 0x41, 0xbf, 0x36, 0x80, 0x41, 0xb1, 0x6e,
0x1d, 0x83, 0x76, 0xd9, 0x2f, 0x06, 0x6d, 0x0f, 0x09, 0x46, 0xcb, 0xba, 0x38,
@ -16,9 +15,7 @@ static const unsigned char jisx0213_1_bmp_decmap_rodata[] = {
};
optimizesize void *jisx0213_1_bmp_decmap(void) {
if (jisx0213_1_bmp_decmap_once) return jisx0213_1_bmp_decmap_ptr;
return xload(&jisx0213_1_bmp_decmap_once,
&jisx0213_1_bmp_decmap_ptr,
return xload(&jisx0213_1_bmp_decmap_ptr,
jisx0213_1_bmp_decmap_rodata,
112, 1024); /* 10.9375% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisx0213_1_emp_decmap_once;
static void *jisx0213_1_emp_decmap_ptr;
static _Atomic(void *) jisx0213_1_emp_decmap_ptr;
static const unsigned char jisx0213_1_emp_decmap_rodata[] = {
0x63, 0x60, 0x18, 0x9a, 0x80, 0x91, 0x41, 0x49, 0x89, 0x89, 0xc1, 0xa9, 0x7a,
0x20, 0xdd, 0x60, 0xc3, 0x10, 0x92, 0x37, 0x18, 0xc3, 0x26, 0x9c, 0xc1, 0xaa,
@ -13,9 +12,7 @@ static const unsigned char jisx0213_1_emp_decmap_rodata[] = {
};
optimizesize void *jisx0213_1_emp_decmap(void) {
if (jisx0213_1_emp_decmap_once) return jisx0213_1_emp_decmap_ptr;
return xload(&jisx0213_1_emp_decmap_once,
&jisx0213_1_emp_decmap_ptr,
return xload(&jisx0213_1_emp_decmap_ptr,
jisx0213_1_emp_decmap_rodata,
67, 1024); /* 6.54297% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisx0213_2_bmp_decmap_once;
static void *jisx0213_2_bmp_decmap_ptr;
static _Atomic(void *) jisx0213_2_bmp_decmap_ptr;
static const unsigned char jisx0213_2_bmp_decmap_rodata[] = {
0x63, 0x60, 0x18, 0x78, 0xc0, 0xc8, 0xa0, 0x54, 0x07, 0xa2, 0xe3, 0x18, 0x14,
0xeb, 0xf6, 0x00, 0xb1, 0x14, 0xa3, 0x62, 0x2d, 0x4c, 0xae, 0x9c, 0x51, 0xb1,
@ -16,9 +15,7 @@ static const unsigned char jisx0213_2_bmp_decmap_rodata[] = {
};
optimizesize void *jisx0213_2_bmp_decmap(void) {
if (jisx0213_2_bmp_decmap_once) return jisx0213_2_bmp_decmap_ptr;
return xload(&jisx0213_2_bmp_decmap_once,
&jisx0213_2_bmp_decmap_ptr,
return xload(&jisx0213_2_bmp_decmap_ptr,
jisx0213_2_bmp_decmap_rodata,
112, 1024); /* 10.9375% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisx0213_2_emp_decmap_once;
static void *jisx0213_2_emp_decmap_ptr;
static _Atomic(void *) jisx0213_2_emp_decmap_ptr;
static const unsigned char jisx0213_2_emp_decmap_rodata[] = {
0x63, 0x60, 0x18, 0x78, 0xc0, 0xc8, 0xa0, 0x58, 0x09, 0xa2, 0xa3, 0x18, 0x94,
0xca, 0x37, 0x30, 0x68, 0x95, 0xfe, 0x61, 0x50, 0xad, 0x83, 0xc9, 0x85, 0x31,
@ -17,9 +16,7 @@ static const unsigned char jisx0213_2_emp_decmap_rodata[] = {
};
optimizesize void *jisx0213_2_emp_decmap(void) {
if (jisx0213_2_emp_decmap_once) return jisx0213_2_emp_decmap_ptr;
return xload(&jisx0213_2_emp_decmap_once,
&jisx0213_2_emp_decmap_ptr,
return xload(&jisx0213_2_emp_decmap_ptr,
jisx0213_2_emp_decmap_rodata,
125, 1024); /* 12.207% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisx0213_bmp_encmap_once;
static void *jisx0213_bmp_encmap_ptr;
static _Atomic(void *) jisx0213_bmp_encmap_ptr;
static const unsigned char jisx0213_bmp_encmap_rodata[] = {
0x63, 0x64, 0xa8, 0xfb, 0xdf, 0xcc, 0xc0, 0xf0, 0xb7, 0x91, 0x31, 0xe0, 0xa5,
0x34, 0x13, 0xc3, 0x21, 0x06, 0x3a, 0x81, 0x7b, 0x4c, 0x76, 0xf6, 0x0f, 0x98,
@ -51,9 +50,7 @@ static const unsigned char jisx0213_bmp_encmap_rodata[] = {
};
optimizesize void *jisx0213_bmp_encmap(void) {
if (jisx0213_bmp_encmap_once) return jisx0213_bmp_encmap_ptr;
return xload(&jisx0213_bmp_encmap_once,
&jisx0213_bmp_encmap_ptr,
return xload(&jisx0213_bmp_encmap_ptr,
jisx0213_bmp_encmap_rodata,
563, 1024); /* 54.9805% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisx0213_emp_encmap_once;
static void *jisx0213_emp_encmap_ptr;
static _Atomic(void *) jisx0213_emp_encmap_ptr;
static const unsigned char jisx0213_emp_encmap_rodata[] = {
0x63, 0x64, 0xe0, 0x5e, 0x32, 0x9b, 0x61, 0xd1, 0xa2, 0x39, 0x0c, 0xc2, 0xc2,
0x73, 0x19, 0xb4, 0x7f, 0xe6, 0x30, 0x7a, 0x79, 0xe5, 0x32, 0x72, 0x5e, 0xb3,
@ -53,9 +52,7 @@ static const unsigned char jisx0213_emp_encmap_rodata[] = {
};
optimizesize void *jisx0213_emp_encmap(void) {
if (jisx0213_emp_encmap_once) return jisx0213_emp_encmap_ptr;
return xload(&jisx0213_emp_encmap_once,
&jisx0213_emp_encmap_ptr,
return xload(&jisx0213_emp_encmap_ptr,
jisx0213_emp_encmap_rodata,
591, 1024); /* 57.7148% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisx0213_pair_decmap_once;
static void *jisx0213_pair_decmap_ptr;
static _Atomic(void *) jisx0213_pair_decmap_ptr;
static const unsigned char jisx0213_pair_decmap_rodata[] = {
0x63, 0x60, 0x18, 0x5c, 0x80, 0x91, 0xa1, 0xbc, 0x9a, 0x8d, 0xa1, 0xbc, 0x8e,
0x8f, 0xa1, 0xa2, 0x02, 0x5d, 0x8e, 0x9f, 0xc1, 0x25, 0x8d, 0x61, 0x14, 0x8c,
@ -10,9 +9,7 @@ static const unsigned char jisx0213_pair_decmap_rodata[] = {
};
optimizesize void *jisx0213_pair_decmap(void) {
if (jisx0213_pair_decmap_once) return jisx0213_pair_decmap_ptr;
return xload(&jisx0213_pair_decmap_once,
&jisx0213_pair_decmap_ptr,
return xload(&jisx0213_pair_decmap_ptr,
jisx0213_pair_decmap_rodata,
32, 1024); /* 3.125% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisx0213_pair_encmap_once;
static void *jisx0213_pair_encmap_ptr;
static _Atomic(void *) jisx0213_pair_encmap_ptr;
static const unsigned char jisx0213_pair_encmap_rodata[] = {
0x1d, 0xc8, 0x31, 0x4e, 0xc2, 0x70, 0x18, 0x86, 0xf1, 0xcf, 0x8f, 0xab, 0x80,
0x09, 0x69, 0x08, 0x6f, 0xc3, 0xa0, 0x09, 0xa3, 0x0c, 0x68, 0xad, 0x0d, 0x81,
@ -23,9 +22,7 @@ static const unsigned char jisx0213_pair_encmap_rodata[] = {
};
optimizesize void *jisx0213_pair_encmap(void) {
if (jisx0213_pair_encmap_once) return jisx0213_pair_encmap_ptr;
return xload(&jisx0213_pair_encmap_once,
&jisx0213_pair_encmap_ptr,
return xload(&jisx0213_pair_encmap_ptr,
jisx0213_pair_encmap_rodata,
207, 368); /* 56.25% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool jisxcommon_encmap_once;
static void *jisxcommon_encmap_ptr;
static _Atomic(void *) jisxcommon_encmap_ptr;
static const unsigned char jisxcommon_encmap_rodata[] = {
0xed, 0xcb, 0x3d, 0x4f, 0x93, 0x61, 0x18, 0xc5, 0xf1, 0x73, 0xdd, 0xcf, 0x53,
0x6a, 0xd1, 0x0a, 0xad, 0xa8, 0x55, 0xaa, 0xf8, 0x86, 0x50, 0xb0, 0x82, 0x56,
@ -36,9 +35,7 @@ static const unsigned char jisxcommon_encmap_rodata[] = {
};
optimizesize void *jisxcommon_encmap(void) {
if (jisxcommon_encmap_once) return jisxcommon_encmap_ptr;
return xload(&jisxcommon_encmap_once,
&jisxcommon_encmap_ptr,
return xload(&jisxcommon_encmap_ptr,
jisxcommon_encmap_rodata,
370, 1024); /* 36.1328% profit */
}

View file

@ -1,8 +1,7 @@
#include "libc/x/x.h"
/* clang-format off */
static bool ksx1001_decmap_once;
static void *ksx1001_decmap_ptr;
static _Atomic(void *) ksx1001_decmap_ptr;
static const unsigned char ksx1001_decmap_rodata[] = {
0xed, 0xd0, 0xb1, 0x2b, 0xc4, 0x71, 0x18, 0xc7, 0xf1, 0xdf, 0xd7, 0xef, 0x38,
0xe7, 0x1c, 0x0e, 0xe7, 0x70, 0xce, 0xf5, 0x19, 0x64, 0x30, 0xc8, 0x20, 0x83,
@ -28,9 +27,7 @@ static const unsigned char ksx1001_decmap_rodata[] = {
};
optimizesize void *ksx1001_decmap(void) {
if (ksx1001_decmap_once) return ksx1001_decmap_ptr;
return xload(&ksx1001_decmap_once,
&ksx1001_decmap_ptr,
return xload(&ksx1001_decmap_ptr,
ksx1001_decmap_rodata,
270, 1024); /* 26.3672% profit */
}

View file

@ -18,10 +18,10 @@
*/
#define PY_SSIZE_T_CLEAN
#include "dsp/scale/cdecimate2xuint8x8.h"
#include "libc/intrin/popcnt.h"
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/popcnt.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
@ -271,13 +271,13 @@ static int FtracerObject_init(PyObject* self, PyObject *args, PyObject *kwargs)
static PyObject* FtracerObject_enter(PyObject *self, PyObject *Py_UNUSED(ignored))
{
++__ftrace;
ftrace_enabled(+1);
return self;
}
static PyObject* FtracerObject_exit(PyObject *self, PyObject *args)
{
--__ftrace;
ftrace_enabled(-1);
return self;
}

View file

@ -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);

View file

@ -158,7 +158,7 @@ struct state {
* buffer, using shift right, and new bytes are appended to the top of the
* bit buffer, using shift left.
*/
local int bits(struct state *s, int need)
local noinstrument int bits(struct state *s, int need)
{
long val; /* bit accumulator (can use up to 20 bits) */