From f0e8f7dcd0bf506c2f0d624c5ca506f17e02d39d Mon Sep 17 00:00:00 2001 From: ahgamut <41098605+ahgamut@users.noreply.github.com> Date: Tue, 2 Nov 2021 04:25:28 +0530 Subject: [PATCH] change noinline to dontinline third-party libraries often use __attribute__((noinline)) which clashes with the defined macro noinline in libc/integral/c.inc. this commit changes the noinline macro to dontinline (similar to wontreturn) to avoid the clash. the chibicc parser checks for attributes by discarding the underscores first. the only place where noinline shouldn't be replaced. --- dsp/tty/ttyraster.c | 2 +- examples/forkrand.c | 2 +- libc/calls/getuid.c | 2 +- libc/calls/sched_setaffinity.c | 2 +- libc/calls/ttyname_r.c | 2 +- libc/dns/gethoststxt.c | 2 +- libc/fmt/formatint32.c | 2 +- libc/fmt/formatint64.c | 2 +- libc/fmt/formatint64thousands.c | 2 +- libc/fmt/itoa128radix10.greg.c | 2 +- libc/fmt/itoa64.c | 2 +- libc/fmt/itoa64radix10.greg.c | 2 +- libc/fmt/itoa64radix8.c | 2 +- libc/integral/c.inc | 8 +++--- libc/intrin/bzero.c | 2 +- libc/intrin/memcmp.c | 2 +- libc/intrin/memset.c | 2 +- libc/mem/arena.c | 2 +- libc/rand/rdrand.c | 2 +- libc/runtime/arch_prctl.c | 4 +-- libc/runtime/clktck.c | 2 +- libc/runtime/fork-nt.c | 6 ++-- libc/runtime/mmap.c | 2 +- libc/sock/epoll.c | 6 ++-- libc/stdio/dirstream.c | 6 ++-- libc/str/bcmp.c | 2 +- libc/str/djbsort.c | 2 +- libc/str/strclen.c | 2 +- libc/str/strclen16.c | 2 +- libc/str/timingsafe_bcmp.c | 2 +- libc/time/times.c | 4 +-- test/libc/intrin/intrin_test.c | 2 +- test/libc/nexgen32e/gclongjmp_test.c | 4 +-- test/libc/nexgen32e/memmove_test.c | 2 +- test/libc/rand/mt19937_test.c | 8 +++--- test/libc/str/crc32c_test.c | 2 +- test/libc/str/strcmp_test.c | 4 +-- third_party/chibicc/as.c | 40 +++++++++++++-------------- third_party/chibicc/tokenize.c | 2 +- third_party/compiler_rt/extendhfsf2.c | 2 +- third_party/compiler_rt/truncsfhf2.c | 2 +- third_party/dlmalloc/dlmalloc.c | 2 +- third_party/mbedtls/aes.c | 2 +- third_party/mbedtls/ecp.c | 2 +- third_party/mbedtls/test/lib.c | 2 +- third_party/python/Include/pymath.h | 4 +-- third_party/python/Objects/abstract.c | 2 +- third_party/python/Python/ceval.c | 2 +- third_party/quickjs/libbf.c | 22 +++++++-------- third_party/quickjs/quickjs.c | 2 +- third_party/sqlite3/json1.c | 2 +- third_party/sqlite3/sqliteInt.inc | 2 +- third_party/stb/stb_image.c | 8 +++--- third_party/stb/stb_vorbis.c | 12 ++++---- tool/build/emubin/prime.c | 2 +- tool/build/lib/disarg.c | 2 +- tool/build/lib/instruction.c | 2 +- tool/emacs/c.lang | 2 +- tool/emacs/cosmo-c-keywords.el | 2 +- tool/emacs/key.py | 4 +-- tool/net/redbean.c | 14 +++++----- tool/viz/derasterize.c | 4 +-- tool/viz/lib/stringbuilder.c | 2 +- tool/viz/magikarp.c | 6 ++-- 64 files changed, 128 insertions(+), 128 deletions(-) diff --git a/dsp/tty/ttyraster.c b/dsp/tty/ttyraster.c index fec1adf3d..51430b4eb 100644 --- a/dsp/tty/ttyraster.c +++ b/dsp/tty/ttyraster.c @@ -739,7 +739,7 @@ static struct TtyRgb *CopyChunk(struct TtyRgb chunk[hasatleast 4], return chunk; } -static noinline char *CopyRun(char *v, size_t n, +static dontinline char *CopyRun(char *v, size_t n, struct TtyRgb lastchunk[hasatleast 4], const struct TtyRgb **c, size_t *x, struct TtyRgb *bg, struct TtyRgb *fg, diff --git a/examples/forkrand.c b/examples/forkrand.c index 1123643c9..971eff04b 100644 --- a/examples/forkrand.c +++ b/examples/forkrand.c @@ -16,7 +16,7 @@ #include "libc/stdio/stdio.h" #include "libc/time/time.h" -noinline void dostuff(const char *s) { +dontinline void dostuff(const char *s) { int i, us; srand(rand64()); /* seeds rand() w/ intel rdrnd, auxv, etc. */ for (i = 0; i < 5; ++i) { diff --git a/libc/calls/getuid.c b/libc/calls/getuid.c index 3780b8c19..f801a93f7 100644 --- a/libc/calls/getuid.c +++ b/libc/calls/getuid.c @@ -34,7 +34,7 @@ static uint32_t KnuthMultiplicativeHash32(const void *buf, size_t size) { return h; } -static textwindows noinline uint32_t GetUserNameHash(void) { +static textwindows dontinline uint32_t GetUserNameHash(void) { char16_t buf[257]; uint32_t size = ARRAYLEN(buf); GetUserName(&buf, &size); diff --git a/libc/calls/sched_setaffinity.c b/libc/calls/sched_setaffinity.c index d4ce3ef08..508d61748 100644 --- a/libc/calls/sched_setaffinity.c +++ b/libc/calls/sched_setaffinity.c @@ -28,7 +28,7 @@ #include "libc/nt/thread.h" #include "libc/str/str.h" -static textwindows noinline int sys_sched_setaffinity_nt(int pid, +static textwindows dontinline int sys_sched_setaffinity_nt(int pid, uint64_t bitsetsize, const void *bitset) { int rc; diff --git a/libc/calls/ttyname_r.c b/libc/calls/ttyname_r.c index 49d97adf5..7f9ab945f 100644 --- a/libc/calls/ttyname_r.c +++ b/libc/calls/ttyname_r.c @@ -28,7 +28,7 @@ #include "libc/str/str.h" #include "libc/sysv/errfuns.h" -static textwindows noinline int sys_ttyname_nt(int fd, char *buf, size_t size) { +static textwindows dontinline int sys_ttyname_nt(int fd, char *buf, size_t size) { uint32_t mode; if (GetConsoleMode(g_fds.p[fd].handle, &mode)) { if (mode & kNtEnableVirtualTerminalInput) { diff --git a/libc/dns/gethoststxt.c b/libc/dns/gethoststxt.c index 1fed2f92e..9a8b8a012 100644 --- a/libc/dns/gethoststxt.c +++ b/libc/dns/gethoststxt.c @@ -36,7 +36,7 @@ static struct HostsTxtInitialStaticMemory { char strings[64]; } g_hoststxt_init; -static textwindows noinline char *GetNtHostsTxtPath(char *pathbuf, +static textwindows dontinline char *GetNtHostsTxtPath(char *pathbuf, uint32_t size) { const char *const kWinHostsPath = "\\drivers\\etc\\hosts"; uint32_t len = GetSystemDirectoryA(&pathbuf[0], size); diff --git a/libc/fmt/formatint32.c b/libc/fmt/formatint32.c index a4f5052ed..4637eb710 100644 --- a/libc/fmt/formatint32.c +++ b/libc/fmt/formatint32.c @@ -24,7 +24,7 @@ * @param p needs at least 12 bytes * @return pointer to nul byte */ -noinline char *FormatUint32(char p[static 12], uint32_t x) { +dontinline char *FormatUint32(char p[static 12], uint32_t x) { char t; size_t i, a, b; i = 0; diff --git a/libc/fmt/formatint64.c b/libc/fmt/formatint64.c index bd57d8694..833e7ff56 100644 --- a/libc/fmt/formatint64.c +++ b/libc/fmt/formatint64.c @@ -24,7 +24,7 @@ * @param p needs at least 21 bytes * @return pointer to nul byte */ -noinline char *FormatUint64(char p[static 21], uint64_t x) { +dontinline char *FormatUint64(char p[static 21], uint64_t x) { char t; size_t i, a, b; i = 0; diff --git a/libc/fmt/formatint64thousands.c b/libc/fmt/formatint64thousands.c index 40ea8bc7f..a7a213936 100644 --- a/libc/fmt/formatint64thousands.c +++ b/libc/fmt/formatint64thousands.c @@ -24,7 +24,7 @@ * @param p needs at least 21 bytes * @return pointer to nul byte */ -noinline char *FormatUint64Thousands(char p[static 27], uint64_t x) { +dontinline char *FormatUint64Thousands(char p[static 27], uint64_t x) { size_t i; char m[26]; i = 0; diff --git a/libc/fmt/itoa128radix10.greg.c b/libc/fmt/itoa128radix10.greg.c index 266d02114..57f76f584 100644 --- a/libc/fmt/itoa128radix10.greg.c +++ b/libc/fmt/itoa128radix10.greg.c @@ -28,7 +28,7 @@ uint128_t __udivmodti4(uint128_t, uint128_t, uint128_t *); * @param a needs at least 40 bytes * @return bytes written w/o nul */ -noinline size_t uint128toarray_radix10(uint128_t i, char *a) { +dontinline size_t uint128toarray_radix10(uint128_t i, char *a) { size_t j; uint128_t rem; j = 0; diff --git a/libc/fmt/itoa64.c b/libc/fmt/itoa64.c index c3c0e7017..3d3b82f81 100644 --- a/libc/fmt/itoa64.c +++ b/libc/fmt/itoa64.c @@ -20,7 +20,7 @@ #include "libc/fmt/conv.h" #include "libc/fmt/itoa.h" -noinline size_t uint64toarray(uint64_t i, char *a, int r) { +dontinline size_t uint64toarray(uint64_t i, char *a, int r) { size_t j; j = 0; do { diff --git a/libc/fmt/itoa64radix10.greg.c b/libc/fmt/itoa64radix10.greg.c index b49742f4a..25d403a8c 100644 --- a/libc/fmt/itoa64radix10.greg.c +++ b/libc/fmt/itoa64radix10.greg.c @@ -26,7 +26,7 @@ * @param a needs at least 21 bytes * @return bytes written w/o nul */ -noinline size_t uint64toarray_radix10(uint64_t i, char a[hasatleast 21]) { +dontinline size_t uint64toarray_radix10(uint64_t i, char a[hasatleast 21]) { size_t j = 0; do { a[j++] = i % 10 + '0'; diff --git a/libc/fmt/itoa64radix8.c b/libc/fmt/itoa64radix8.c index 13c882429..5f7035623 100644 --- a/libc/fmt/itoa64radix8.c +++ b/libc/fmt/itoa64radix8.c @@ -26,7 +26,7 @@ * @param a needs at least 24 bytes * @return bytes written w/o nul */ -noinline size_t uint64toarray_radix8(uint64_t i, char a[hasatleast 24]) { +dontinline size_t uint64toarray_radix8(uint64_t i, char a[hasatleast 24]) { size_t j; j = 0; do { diff --git a/libc/integral/c.inc b/libc/integral/c.inc index c6004586a..1dfbc05bb 100644 --- a/libc/integral/c.inc +++ b/libc/integral/c.inc @@ -241,13 +241,13 @@ typedef uint64_t uintmax_t; #endif #endif -#ifndef noinline +#ifndef dontinline #if !defined(__STRICT_ANSI__) && \ (__has_attribute(__noinline__) || \ (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 301) -#define noinline __attribute__((__noinline__)) +#define dontinline __attribute__((__noinline__)) #else -#define noinline +#define dontinline #endif #endif @@ -606,7 +606,7 @@ typedef uint64_t uintmax_t; } while (0) #ifndef __STRICT_ANSI__ -#define testonly noinline _Section(".test") +#define testonly dontinline _Section(".test") #define textstartup _Section(".text.startup") noinstrument #define textexit _Section(".text.exit") noinstrument #define textreal _Section(".text.real") diff --git a/libc/intrin/bzero.c b/libc/intrin/bzero.c index b7a59105b..cb5e0c48d 100644 --- a/libc/intrin/bzero.c +++ b/libc/intrin/bzero.c @@ -26,7 +26,7 @@ typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(1))); typedef long long xmm_a __attribute__((__vector_size__(16), __aligned__(16))); -noasan static noinline antiquity void bzero_sse(char *p, size_t n) { +noasan static dontinline antiquity void bzero_sse(char *p, size_t n) { xmm_t v = {0}; if (IsAsan()) __asan_verify(p, n); if (n <= 32) { diff --git a/libc/intrin/memcmp.c b/libc/intrin/memcmp.c index ceb73d077..d46eeb261 100644 --- a/libc/intrin/memcmp.c +++ b/libc/intrin/memcmp.c @@ -25,7 +25,7 @@ typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(1))); -static noinline antiquity int memcmp_sse(const unsigned char *p, +static dontinline antiquity int memcmp_sse(const unsigned char *p, const unsigned char *q, size_t n) { uint64_t w; unsigned u, u0, u1, u2, u3; diff --git a/libc/intrin/memset.c b/libc/intrin/memset.c index e712273cb..30d8e8f72 100644 --- a/libc/intrin/memset.c +++ b/libc/intrin/memset.c @@ -26,7 +26,7 @@ typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(1))); typedef long long xmm_a __attribute__((__vector_size__(16), __aligned__(16))); -noasan static noinline antiquity void *memset_sse(char *p, char c, size_t n) { +noasan static dontinline antiquity void *memset_sse(char *p, char c, size_t n) { xmm_t v = {c, c, c, c, c, c, c, c, c, c, c, c, c, c, c, c}; if (IsAsan()) __asan_verify(p, n); if (n <= 32) { diff --git a/libc/mem/arena.c b/libc/mem/arena.c index 233dd05c0..a6cf0168a 100644 --- a/libc/mem/arena.c +++ b/libc/mem/arena.c @@ -103,7 +103,7 @@ static size_t __arena_bulk_free(void *p[], size_t n) { return 0; } -static noinline bool __arena_grow(size_t offset, size_t request) { +static dontinline bool __arena_grow(size_t offset, size_t request) { size_t greed; greed = __arena.size + 1; do { diff --git a/libc/rand/rdrand.c b/libc/rand/rdrand.c index a98c2f850..8a42afb1c 100644 --- a/libc/rand/rdrand.c +++ b/libc/rand/rdrand.c @@ -24,7 +24,7 @@ STATIC_YOINK("rdrand_init"); -static noinline uint64_t rdrand_failover(void) { +static dontinline uint64_t rdrand_failover(void) { int f; size_t i; ssize_t r; diff --git a/libc/runtime/arch_prctl.c b/libc/runtime/arch_prctl.c index 2dbd6ffa0..6cd3ec76b 100644 --- a/libc/runtime/arch_prctl.c +++ b/libc/runtime/arch_prctl.c @@ -111,7 +111,7 @@ static int arch_prctl_freebsd(int code, int64_t addr) { } } -static privileged noinline int arch_prctl_xnu(int code, int64_t addr) { +static privileged dontinline int arch_prctl_xnu(int code, int64_t addr) { int ax; switch (code) { case ARCH_SET_GS: @@ -129,7 +129,7 @@ static privileged noinline int arch_prctl_xnu(int code, int64_t addr) { } } -static privileged noinline int arch_prctl_openbsd(int code, int64_t addr) { +static privileged dontinline int arch_prctl_openbsd(int code, int64_t addr) { int64_t rax; switch (code) { case ARCH_GET_FS: diff --git a/libc/runtime/clktck.c b/libc/runtime/clktck.c index adcd86e20..6bb6d02f5 100644 --- a/libc/runtime/clktck.c +++ b/libc/runtime/clktck.c @@ -32,7 +32,7 @@ struct clockinfo_netbsd { static int clk_tck; -static noinline int __clk_tck_init(void) { +static dontinline int __clk_tck_init(void) { int x; int cmd[2]; size_t len; diff --git a/libc/runtime/fork-nt.c b/libc/runtime/fork-nt.c index cc94a6464..c455c792c 100644 --- a/libc/runtime/fork-nt.c +++ b/libc/runtime/fork-nt.c @@ -59,7 +59,7 @@ static textwindows noasan char16_t *ParseInt(char16_t *p, int64_t *x) { return p; } -static noinline textwindows noasan bool ForkIo(int64_t h, void *buf, size_t n, +static dontinline textwindows noasan bool ForkIo(int64_t h, void *buf, size_t n, bool32 (*f)()) { char *p; size_t i; @@ -72,14 +72,14 @@ static noinline textwindows noasan bool ForkIo(int64_t h, void *buf, size_t n, return true; } -static noinline textwindows noasan void WriteAll(int64_t h, void *buf, +static dontinline textwindows noasan void WriteAll(int64_t h, void *buf, size_t n) { if (!ForkIo(h, buf, n, WriteFile)) { SYSDEBUG("fork() WriteFile(%zu) failed %d\n", n, GetLastError()); } } -static textwindows noinline noasan void ReadAll(int64_t h, void *buf, +static textwindows dontinline noasan void ReadAll(int64_t h, void *buf, size_t n) { if (!ForkIo(h, buf, n, ReadFile)) { SYSDEBUG("fork() ReadFile(%zu) failed %d\n", n, GetLastError()); diff --git a/libc/runtime/mmap.c b/libc/runtime/mmap.c index 6da054cf2..ee58ac8cf 100644 --- a/libc/runtime/mmap.c +++ b/libc/runtime/mmap.c @@ -150,7 +150,7 @@ static noasan void *MapMemory(void *addr, size_t size, int prot, int flags, * This is useful on Windows since it allows us to partially unmap or * punch holes into existing mappings. */ -static textwindows noinline noasan void *MapMemories(char *addr, size_t size, +static textwindows dontinline noasan void *MapMemories(char *addr, size_t size, int prot, int flags, int fd, int64_t off, int f, int x, size_t n) { diff --git a/libc/sock/epoll.c b/libc/sock/epoll.c index 4aa723e62..4425fc2db 100644 --- a/libc/sock/epoll.c +++ b/libc/sock/epoll.c @@ -1318,7 +1318,7 @@ static textwindows struct PortState *port_state_from_handle_tree_node( return CONTAINOF(tree_node, struct PortState, handle_tree_node); } -static textwindows noinline int sys_epoll_create1_nt(uint32_t flags) { +static textwindows dontinline int sys_epoll_create1_nt(uint32_t flags) { int fd; int64_t ephnd; struct PortState *port_state; @@ -1344,7 +1344,7 @@ static textwindows noinline int sys_epoll_create1_nt(uint32_t flags) { return fd; } -static textwindows noinline int sys_epoll_ctl_nt(int epfd, int op, int fd, +static textwindows dontinline int sys_epoll_ctl_nt(int epfd, int op, int fd, struct epoll_event *ev) { int r; struct PortState *port_state; @@ -1374,7 +1374,7 @@ static textwindows noinline int sys_epoll_ctl_nt(int epfd, int op, int fd, } } -static textwindows noinline int sys_epoll_wait_nt(int epfd, +static textwindows dontinline int sys_epoll_wait_nt(int epfd, struct epoll_event *events, int maxevents, int timeoutms) { diff --git a/libc/stdio/dirstream.c b/libc/stdio/dirstream.c index 65a469845..2f8bdb2aa 100644 --- a/libc/stdio/dirstream.c +++ b/libc/stdio/dirstream.c @@ -134,7 +134,7 @@ static textwindows DIR *opendir_nt_impl(char16_t *name, size_t len) { return NULL; } -static textwindows noinline DIR *opendir_nt(const char *path) { +static textwindows dontinline DIR *opendir_nt(const char *path) { int len; DIR *res; char16_t *name; @@ -149,7 +149,7 @@ static textwindows noinline DIR *opendir_nt(const char *path) { return NULL; } -static textwindows noinline DIR *fdopendir_nt(int fd) { +static textwindows dontinline DIR *fdopendir_nt(int fd) { DIR *res; char16_t *name; if (__isfdkind(fd, kFdFile)) { @@ -189,7 +189,7 @@ static textwindows uint8_t GetNtDirentType(struct NtWin32FindData *w) { } } -static textwindows noinline struct dirent *readdir_nt(DIR *dir) { +static textwindows dontinline struct dirent *readdir_nt(DIR *dir) { size_t i; if (!dir->isdone) { bzero(&dir->ent, sizeof(dir->ent)); diff --git a/libc/str/bcmp.c b/libc/str/bcmp.c index 4feb05a11..a572741b0 100644 --- a/libc/str/bcmp.c +++ b/libc/str/bcmp.c @@ -23,7 +23,7 @@ typedef uint64_t xmm_t __attribute__((__vector_size__(16), __aligned__(1))); -static noinline antiquity int memcmp_sse(const char *p, const char *q, +static dontinline antiquity int memcmp_sse(const char *p, const char *q, size_t n) { xmm_t a; while (n > 32) { diff --git a/libc/str/djbsort.c b/libc/str/djbsort.c index 5b33859b6..477097ec7 100644 --- a/libc/str/djbsort.c +++ b/libc/str/djbsort.c @@ -25,7 +25,7 @@ void djbsort_avx2(int32_t *, long); -static noinline void intsort(int *x, size_t n, size_t t) { +static dontinline void intsort(int *x, size_t n, size_t t) { int a, b, c; size_t i, p, q; for (p = t; p > 0; p >>= 1) { diff --git a/libc/str/strclen.c b/libc/str/strclen.c index 050105ada..6929c70b0 100644 --- a/libc/str/strclen.c +++ b/libc/str/strclen.c @@ -25,7 +25,7 @@ size_t strclen(const char *s) { return strnclen(s, -1); } -noinline size_t strnclen(const char *s, size_t n) { +dontinline size_t strnclen(const char *s, size_t n) { size_t r = 0; if (n) { while (n && *s && (*s & 0300) == 0200) ++s, --n; diff --git a/libc/str/strclen16.c b/libc/str/strclen16.c index 238c5e84f..339f92223 100644 --- a/libc/str/strclen16.c +++ b/libc/str/strclen16.c @@ -26,7 +26,7 @@ size_t strclen16(const char16_t *s) { return strnclen16(s, -1ull); } -noinline size_t strnclen16(const char16_t *p, size_t n) { +dontinline size_t strnclen16(const char16_t *p, size_t n) { size_t l = 0; if (n) { while (*p) { diff --git a/libc/str/timingsafe_bcmp.c b/libc/str/timingsafe_bcmp.c index 797c3a5d6..9600df9eb 100644 --- a/libc/str/timingsafe_bcmp.c +++ b/libc/str/timingsafe_bcmp.c @@ -24,7 +24,7 @@ typedef uint64_t xmm_t __attribute__((__vector_size__(16), __aligned__(1))); -noasan static noinline antiquity unsigned timingsafe_bcmp_sse(const char *p, +noasan static dontinline antiquity unsigned timingsafe_bcmp_sse(const char *p, const char *q, size_t n) { uint64_t w; diff --git a/libc/time/times.c b/libc/time/times.c index 462615a18..2ff442c98 100644 --- a/libc/time/times.c +++ b/libc/time/times.c @@ -30,11 +30,11 @@ #include "libc/sysv/consts/rusage.h" #include "libc/time/time.h" -static noinline long ConvertMicros(struct timeval tv) { +static dontinline long ConvertMicros(struct timeval tv) { return tv.tv_sec * CLK_TCK + tv.tv_usec / (1000000 / CLK_TCK); } -static noinline long times2(struct tms *out_times, struct rusage *ru) { +static dontinline long times2(struct tms *out_times, struct rusage *ru) { struct timeval tv; struct NtFileTime CreationTime, ExitTime, KernelTime, UserTime; if (!IsWindows()) { diff --git a/test/libc/intrin/intrin_test.c b/test/libc/intrin/intrin_test.c index b9b4a3b59..f659c17e8 100644 --- a/test/libc/intrin/intrin_test.c +++ b/test/libc/intrin/intrin_test.c @@ -119,7 +119,7 @@ forceinline uint64_t Rando(void) { KnuthLinearCongruentialGenerator(&g_rando) >> 32; } -noinline void RngSet(void *mem, size_t size) { +dontinline void RngSet(void *mem, size_t size) { uint64_t coin; DCHECK(size % 8 == 0); for (size >>= 3; size--;) { diff --git a/test/libc/nexgen32e/gclongjmp_test.c b/test/libc/nexgen32e/gclongjmp_test.c index 7d9adb58c..a39227ef2 100644 --- a/test/libc/nexgen32e/gclongjmp_test.c +++ b/test/libc/nexgen32e/gclongjmp_test.c @@ -76,12 +76,12 @@ TEST(gclongjmp, test) { free(x); } -noinline void F1(void) { +dontinline void F1(void) { /* 3x slower than F2() but sooo worth it */ gc(malloc(16)); } -noinline void F2(void) { +dontinline void F2(void) { void *volatile p; p = malloc(16); free(p); diff --git a/test/libc/nexgen32e/memmove_test.c b/test/libc/nexgen32e/memmove_test.c index 2edf4f309..9ec2311d0 100644 --- a/test/libc/nexgen32e/memmove_test.c +++ b/test/libc/nexgen32e/memmove_test.c @@ -29,7 +29,7 @@ long i, j, n; char *b0, *b1, *b2; -noinline char *PosixMemmove(char *dst, const char *src, size_t n) { +dontinline char *PosixMemmove(char *dst, const char *src, size_t n) { char *tmp; tmp = malloc(n); memcpy(tmp, src, n); diff --git a/test/libc/rand/mt19937_test.c b/test/libc/rand/mt19937_test.c index 8c57910f0..39a3343e0 100644 --- a/test/libc/rand/mt19937_test.c +++ b/test/libc/rand/mt19937_test.c @@ -76,7 +76,7 @@ void ctrdrbg2(void *p, size_t n) { mbedtls_ctr_drbg_free(&rng); } -noinline uint64_t xorshift(void) { +dontinline uint64_t xorshift(void) { static uint64_t s = 88172645463325252; uint64_t x = s; x ^= x << 13; @@ -85,7 +85,7 @@ noinline uint64_t xorshift(void) { return (s = x); } -noinline void xorshifta(char *p, size_t n) { +dontinline void xorshifta(char *p, size_t n) { static uint64_t s = 88172645463325252; uint64_t x = s; while (n >= 8) { @@ -103,7 +103,7 @@ noinline void xorshifta(char *p, size_t n) { } } -noinline uint64_t knuth(void) { +dontinline uint64_t knuth(void) { uint64_t a, b; static uint64_t x = 1; x *= 6364136223846793005; @@ -115,7 +115,7 @@ noinline uint64_t knuth(void) { return a | b << 32; } -noinline void knutha(char *p, size_t n) { +dontinline void knutha(char *p, size_t n) { static uint64_t s = 1; uint32_t u; uint64_t x = s; diff --git a/test/libc/str/crc32c_test.c b/test/libc/str/crc32c_test.c index 939748048..b80c2492d 100644 --- a/test/libc/str/crc32c_test.c +++ b/test/libc/str/crc32c_test.c @@ -50,7 +50,7 @@ TEST(crc32c, test) { EXPECT_EQ(0xecc9871d, crc32c(0, kHyperion, kHyperionSize)); } -noinline uint64_t fnv_hash(char *s, int len) { +dontinline uint64_t fnv_hash(char *s, int len) { uint64_t hash = 0xcbf29ce484222325; for (int i = 0; i < len; i++) { hash *= 0x100000001b3; diff --git a/test/libc/str/strcmp_test.c b/test/libc/str/strcmp_test.c index 12d00c015..61db28ee4 100644 --- a/test/libc/str/strcmp_test.c +++ b/test/libc/str/strcmp_test.c @@ -496,14 +496,14 @@ TEST(wcsncmp, testTwosComplementBane) { │ test/libc/str/strcmp_test.c § benchmarks ─╬─│┼ ╚────────────────────────────────────────────────────────────────────────────│*/ -testonly noinline int strcmp_pure(const char *a, const char *b) { +testonly dontinline int strcmp_pure(const char *a, const char *b) { for (; *a == *b; a++, b++) { if (!*a) break; } return (*a & 0xff) - (*b & 0xff); } -testonly noinline int strcasecmp_pure(const char *a, const char *b) { +testonly dontinline int strcasecmp_pure(const char *a, const char *b) { for (; *a && *b; a++, b++) { if (!(*a == *b || tolower(*a & 0xff) == tolower(*b & 0xff))) { break; diff --git a/third_party/chibicc/as.c b/third_party/chibicc/as.c index a19a00a89..1e0382a6c 100644 --- a/third_party/chibicc/as.c +++ b/third_party/chibicc/as.c @@ -2247,7 +2247,7 @@ static void OnMovslq(struct As *a, struct Slice s) { EmitModrm(a, reg, modrm, disp); } -static noinline void OpAluImpl(struct As *a, struct Slice opname, int op) { +static dontinline void OpAluImpl(struct As *a, struct Slice opname, int op) { int reg, modrm, imm, disp; if (IsPunct(a, a->i, '$')) { // imm -> reg/modrm ++a->i; @@ -2270,11 +2270,11 @@ static noinline void OpAluImpl(struct As *a, struct Slice opname, int op) { } } -static noinline void OpAlu(struct As *a, struct Slice opname, int op) { +static dontinline void OpAlu(struct As *a, struct Slice opname, int op) { OpAluImpl(a, opname, op); } -static noinline void OpBsuImpl(struct As *a, struct Slice opname, int op) { +static dontinline void OpBsuImpl(struct As *a, struct Slice opname, int op) { int reg, modrm, imm, disp; if (IsPunct(a, a->i, '$')) { ++a->i; @@ -2303,11 +2303,11 @@ static noinline void OpBsuImpl(struct As *a, struct Slice opname, int op) { EmitExpr(a, imm, R_X86_64_8, EmitByte); } -static noinline void OpBsu(struct As *a, struct Slice opname, int op) { +static dontinline void OpBsu(struct As *a, struct Slice opname, int op) { OpBsuImpl(a, opname, op); } -static noinline int OpF6Impl(struct As *a, struct Slice s, int reg) { +static dontinline int OpF6Impl(struct As *a, struct Slice s, int reg) { int modrm, imm, disp; modrm = ParseModrm(a, &disp); reg |= GetOpSize(a, s, modrm, 1) << 3; @@ -2315,7 +2315,7 @@ static noinline int OpF6Impl(struct As *a, struct Slice s, int reg) { return reg; } -static noinline int OpF6(struct As *a, struct Slice s, int reg) { +static dontinline int OpF6(struct As *a, struct Slice s, int reg) { return OpF6Impl(a, s, reg); } @@ -2516,7 +2516,7 @@ static bool IsSsePrefix(int c) { return c == 0x66 || c == 0xF2 || c == 0xF3; // must come before rex } -static noinline void OpSseImpl(struct As *a, int op) { +static dontinline void OpSseImpl(struct As *a, int op) { int reg, modrm, disp; if (IsSsePrefix((op & 0xff000000) >> 24)) { EmitByte(a, (op & 0xff000000) >> 24); @@ -2532,11 +2532,11 @@ static noinline void OpSseImpl(struct As *a, int op) { EmitRexOpModrm(a, op, reg, modrm, disp, 0); } -static noinline void OpSse(struct As *a, int op) { +static dontinline void OpSse(struct As *a, int op) { OpSseImpl(a, op); } -static noinline void OpSseIbImpl(struct As *a, int op) { +static dontinline void OpSseIbImpl(struct As *a, int op) { int imm; ConsumePunct(a, '$'); imm = Parse(a); @@ -2545,7 +2545,7 @@ static noinline void OpSseIbImpl(struct As *a, int op) { EmitExpr(a, imm, R_X86_64_8, EmitByte); } -static noinline void OpSseIb(struct As *a, int op) { +static dontinline void OpSseIb(struct As *a, int op) { OpSseIbImpl(a, op); } @@ -2611,7 +2611,7 @@ static void OnRet(struct As *a, struct Slice s) { } } -static noinline void OpCmovccImpl(struct As *a, int cc) { +static dontinline void OpCmovccImpl(struct As *a, int cc) { int reg, modrm, disp; modrm = ParseModrm(a, &disp); ConsumeComma(a); @@ -2619,17 +2619,17 @@ static noinline void OpCmovccImpl(struct As *a, int cc) { EmitRexOpModrm(a, 0x0F40 | cc, reg, modrm, disp, 0); } -static noinline void OpCmovcc(struct As *a, int cc) { +static dontinline void OpCmovcc(struct As *a, int cc) { OpCmovccImpl(a, cc); } -static noinline void OpSetccImpl(struct As *a, int cc) { +static dontinline void OpSetccImpl(struct As *a, int cc) { int modrm, disp; modrm = ParseModrm(a, &disp); EmitRexOpModrm(a, 0x0F90 | cc, 6, modrm, disp, 0); } -static noinline void OpSetcc(struct As *a, int cc) { +static dontinline void OpSetcc(struct As *a, int cc) { OpSetccImpl(a, cc); } @@ -2662,7 +2662,7 @@ static void OnCall(struct As *a, struct Slice s) { } } -static noinline void OpJmpImpl(struct As *a, int cc) { +static dontinline void OpJmpImpl(struct As *a, int cc) { int modrm, disp; if (IsPunct(a, a->i, '*')) ++a->i; modrm = RemoveRexw(ParseModrm(a, &disp)); @@ -2682,17 +2682,17 @@ static noinline void OpJmpImpl(struct As *a, int cc) { } } -static noinline void OpJmp(struct As *a, int cc) { +static dontinline void OpJmp(struct As *a, int cc) { OpJmpImpl(a, cc); } -static noinline void OpFpu1Impl(struct As *a, int op, int reg) { +static dontinline void OpFpu1Impl(struct As *a, int op, int reg) { int modrm, disp; modrm = ParseModrm(a, &disp); EmitRexOpModrm(a, op, reg, modrm, disp, 0); } -static noinline void OpFpu1(struct As *a, int op, int reg) { +static dontinline void OpFpu1(struct As *a, int op, int reg) { OpFpu1Impl(a, op, reg); } @@ -2711,7 +2711,7 @@ static void OnBswap(struct As *a, struct Slice s) { EmitByte(a, 0310 | srm & 7); } -static noinline void OpFcomImpl(struct As *a, int op) { +static dontinline void OpFcomImpl(struct As *a, int op) { int rm; if (IsSemicolon(a)) { rm = 1; @@ -2727,7 +2727,7 @@ static noinline void OpFcomImpl(struct As *a, int op) { EmitVarword(a, op | rm & 7); } -static noinline void OpFcom(struct As *a, int op) { +static dontinline void OpFcom(struct As *a, int op) { OpFcomImpl(a, op); } diff --git a/third_party/chibicc/tokenize.c b/third_party/chibicc/tokenize.c index 9da784d20..3be9520bf 100644 --- a/third_party/chibicc/tokenize.c +++ b/third_party/chibicc/tokenize.c @@ -120,7 +120,7 @@ static Token *new_token(TokenKind kind, char *start, char *end) { // Read an identifier and returns the length of it. // If p does not point to a valid identifier, 0 is returned. -noinline int read_ident(char *start) { +dontinline int read_ident(char *start) { uint32_t c; char *p = start; if (('a' <= *p && *p <= 'z') || ('A' <= *p && *p <= 'Z') || *p == '_') { diff --git a/third_party/compiler_rt/extendhfsf2.c b/third_party/compiler_rt/extendhfsf2.c index 8d5361dc0..8c47b370e 100644 --- a/third_party/compiler_rt/extendhfsf2.c +++ b/third_party/compiler_rt/extendhfsf2.c @@ -15,7 +15,7 @@ STATIC_YOINK("huge_compiler_rt_license"); #define DST_SINGLE #include "third_party/compiler_rt/fp_extend_impl.inc" -// Use a forwarding definition and noinline to implement a poor man's alias, +// Use a forwarding definition and dontinline to implement a poor man's alias, // as there isn't a good cross-platform way of defining one. COMPILER_RT_ABI __attribute__((__noinline__)) float __extendhfsf2(uint16_t a) { return __extendXfYf2__(a); diff --git a/third_party/compiler_rt/truncsfhf2.c b/third_party/compiler_rt/truncsfhf2.c index 5e0905f4e..ce7999503 100644 --- a/third_party/compiler_rt/truncsfhf2.c +++ b/third_party/compiler_rt/truncsfhf2.c @@ -14,7 +14,7 @@ STATIC_YOINK("huge_compiler_rt_license"); #define DST_HALF #include "third_party/compiler_rt/fp_trunc_impl.inc" -// Use a forwarding definition and noinline to implement a poor man's alias, +// Use a forwarding definition and dontinline to implement a poor man's alias, // as there isn't a good cross-platform way of defining one. COMPILER_RT_ABI __attribute__((__noinline__)) uint16_t __truncsfhf2(float a) { return __truncXfYf2__(a); diff --git a/third_party/dlmalloc/dlmalloc.c b/third_party/dlmalloc/dlmalloc.c index 302967311..c77830922 100644 --- a/third_party/dlmalloc/dlmalloc.c +++ b/third_party/dlmalloc/dlmalloc.c @@ -166,7 +166,7 @@ static void dlmalloc_add_segment(struct MallocState *m, char *tbase, /* ─────────────────────────── system integration ─────────────────────────── */ /* Return true if segment contains a segment link */ -noinline int has_segment_link(struct MallocState *m, msegmentptr ss) { +dontinline int has_segment_link(struct MallocState *m, msegmentptr ss) { msegmentptr sp; assert(m); sp = &m->seg; diff --git a/third_party/mbedtls/aes.c b/third_party/mbedtls/aes.c index 2d4196ff8..a8763ddec 100644 --- a/third_party/mbedtls/aes.c +++ b/third_party/mbedtls/aes.c @@ -368,7 +368,7 @@ static uint32_t RCON[10]; static int aes_init_done; -static noinline void aes_gen_tables( void ) +static dontinline void aes_gen_tables( void ) { int i, x, y, z; int pow[256]; diff --git a/third_party/mbedtls/ecp.c b/third_party/mbedtls/ecp.c index 39aa2c10d..c60d6fc64 100644 --- a/third_party/mbedtls/ecp.c +++ b/third_party/mbedtls/ecp.c @@ -3128,7 +3128,7 @@ int mbedtls_ecp_check_pubkey( const mbedtls_ecp_group *grp, * private key for the given curve. * \return Another negative error code on other kinds of failure. */ -noinline int mbedtls_ecp_check_privkey( const mbedtls_ecp_group *grp, +dontinline int mbedtls_ecp_check_privkey( const mbedtls_ecp_group *grp, const mbedtls_mpi *d ) { ECP_VALIDATE_RET( grp ); diff --git a/third_party/mbedtls/test/lib.c b/third_party/mbedtls/test/lib.c index 822479dce..2869ea005 100644 --- a/third_party/mbedtls/test/lib.c +++ b/third_party/mbedtls/test/lib.c @@ -794,7 +794,7 @@ static int convert_params(size_t cnt, char **params, int *int_params_store) { * * \return 0 for success else 1 */ -static noinline int test_snprintf(size_t n, const char *ref_buf, int ref_ret) { +static dontinline int test_snprintf(size_t n, const char *ref_buf, int ref_ret) { int ret; char buf[10] = "xxxxxxxxx"; const char ref[10] = "xxxxxxxxx"; diff --git a/third_party/python/Include/pymath.h b/third_party/python/Include/pymath.h index 88b9aaa1a..2cb08893d 100644 --- a/third_party/python/Include/pymath.h +++ b/third_party/python/Include/pymath.h @@ -164,9 +164,9 @@ void _Py_set_387controlword(unsigned short); #pragma float_control(precise, on) #pragma float_control(except, on) #if defined(_MSC_VER) -__declspec(noinline) +__declspec(dontinline) #else /* Linux */ -__attribute__((noinline)) +__attribute__((dontinline)) #endif /* _MSC_VER */ static double __icc_nan() { return sqrt(-1.0); diff --git a/third_party/python/Objects/abstract.c b/third_party/python/Objects/abstract.c index 35beea0d5..e77b46cb9 100644 --- a/third_party/python/Objects/abstract.c +++ b/third_party/python/Objects/abstract.c @@ -2280,7 +2280,7 @@ PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs) /* Issue #29234: Inlining _PyStack_AsTuple() into callers increases their stack consumption, Disable inlining to optimize the stack consumption. */ -PyObject* noinline +PyObject* dontinline _PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs) { PyObject *args; diff --git a/third_party/python/Python/ceval.c b/third_party/python/Python/ceval.c index f4bd4d67a..a8b5237ad 100644 --- a/third_party/python/Python/ceval.c +++ b/third_party/python/Python/ceval.c @@ -4210,7 +4210,7 @@ restore_and_clear_exc_state(PyThreadState *tstate, PyFrameObject *f) /* Logic for the raise statement (too complicated for inlining). This *consumes* a reference count to each of its arguments. */ -static noinline int +static dontinline int do_raise(PyObject *exc, PyObject *cause) { PyObject *type = NULL, *value = NULL; diff --git a/third_party/quickjs/libbf.c b/third_party/quickjs/libbf.c index 977bb24d3..4ded06508 100644 --- a/third_party/quickjs/libbf.c +++ b/third_party/quickjs/libbf.c @@ -85,7 +85,7 @@ typedef int bf_op2_func_t(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, #define FFT_MUL_R_OVERLAP_B (1 << 1) #define FFT_MUL_R_NORESIZE (1 << 2) -static noinline int fft_mul(bf_context_t *s, +static dontinline int fft_mul(bf_context_t *s, bf_t *res, limb_t *a_tab, limb_t a_len, limb_t *b_tab, limb_t b_len, int mul_flags); static void fft_clear_cache(bf_context_t *s); @@ -2192,7 +2192,7 @@ int bf_sqrt(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags) return BF_ST_MEM_ERROR; } -static noinline int bf_op2(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, +static dontinline int bf_op2(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, bf_op2_func_t *func) { bf_t tmp; @@ -7570,7 +7570,7 @@ static void ntt_free(BFNTTState *s, void *ptr) bf_aligned_free(s->ctx, ptr); } -static noinline int ntt_fft(BFNTTState *s, +static dontinline int ntt_fft(BFNTTState *s, NTTLimb *out_buf, NTTLimb *in_buf, NTTLimb *tmp_buf, int fft_len_log2, int inverse, int m_idx) @@ -7703,7 +7703,7 @@ static void ntt_vec_mul(BFNTTState *s, } } -static noinline void mul_trig(NTTLimb *buf, +static dontinline void mul_trig(NTTLimb *buf, limb_t n, limb_t c1, limb_t m, limb_t m_inv1) { limb_t i, c2, c3, c4; @@ -7751,7 +7751,7 @@ static inline NTTLimb int_to_ntt_limb(slimb_t a, limb_t m) return a; } -static noinline int ntt_fft(BFNTTState *s, NTTLimb *out_buf, NTTLimb *in_buf, +static dontinline int ntt_fft(BFNTTState *s, NTTLimb *out_buf, NTTLimb *in_buf, NTTLimb *tmp_buf, int fft_len_log2, int inverse, int m_idx) { @@ -7833,7 +7833,7 @@ static void ntt_vec_mul(BFNTTState *s, } } -static noinline void mul_trig(NTTLimb *buf, +static dontinline void mul_trig(NTTLimb *buf, limb_t n, limb_t c_mul, limb_t m, limb_t m_inv) { limb_t i, c0, c_mul_inv; @@ -7848,7 +7848,7 @@ static noinline void mul_trig(NTTLimb *buf, #endif /* !AVX2 */ -static noinline NTTLimb *get_trig(BFNTTState *s, +static dontinline NTTLimb *get_trig(BFNTTState *s, int k, int inverse, int m_idx) { NTTLimb *tab; @@ -8003,7 +8003,7 @@ static int ntt_conv(BFNTTState *s, NTTLimb *buf1, NTTLimb *buf2, } -static noinline void limb_to_ntt(BFNTTState *s, +static dontinline void limb_to_ntt(BFNTTState *s, NTTLimb *tabr, limb_t fft_len, const limb_t *taba, limb_t a_len, int dpl, int first_m_idx, int nb_mods) @@ -8072,7 +8072,7 @@ typedef union { double d[4]; } VecUnion; -static noinline void ntt_to_limb(BFNTTState *s, limb_t *tabr, limb_t r_len, +static dontinline void ntt_to_limb(BFNTTState *s, limb_t *tabr, limb_t r_len, const NTTLimb *buf, int fft_len_log2, int dpl, int nb_mods) { @@ -8176,7 +8176,7 @@ static noinline void ntt_to_limb(BFNTTState *s, limb_t *tabr, limb_t r_len, } } #else -static noinline void ntt_to_limb(BFNTTState *s, limb_t *tabr, limb_t r_len, +static dontinline void ntt_to_limb(BFNTTState *s, limb_t *tabr, limb_t r_len, const NTTLimb *buf, int fft_len_log2, int dpl, int nb_mods) { @@ -8389,7 +8389,7 @@ int bf_get_fft_size(int *pdpl, int *pnb_mods, limb_t len) } /* return 0 if OK, -1 if memory error */ -static noinline int fft_mul(bf_context_t *s1, +static dontinline int fft_mul(bf_context_t *s1, bf_t *res, limb_t *a_tab, limb_t a_len, limb_t *b_tab, limb_t b_len, int mul_flags) { diff --git a/third_party/quickjs/quickjs.c b/third_party/quickjs/quickjs.c index 514d7cce2..00b941cf8 100644 --- a/third_party/quickjs/quickjs.c +++ b/third_party/quickjs/quickjs.c @@ -3543,7 +3543,7 @@ JSProperty *add_property(JSContext *ctx, JSObject *p, JSAtom prop, int prop_flag /* can be called on Array or Arguments objects. return < 0 if memory alloc error. */ -static noinline __exception int convert_fast_array_to_array(JSContext *ctx, +static dontinline __exception int convert_fast_array_to_array(JSContext *ctx, JSObject *p) { JSProperty *pr; diff --git a/third_party/sqlite3/json1.c b/third_party/sqlite3/json1.c index 17183d782..c75e4691a 100644 --- a/third_party/sqlite3/json1.c +++ b/third_party/sqlite3/json1.c @@ -720,7 +720,7 @@ static int jsonParseAddNode(JsonParse*,u32,u32,const char*); #if defined(__GNUC__) #define JSON_NOINLINE __attribute__((__noinline__)) #elif defined(_MSC_VER) && _MSC_VER >= 1310 -#define JSON_NOINLINE __declspec(noinline) +#define JSON_NOINLINE __declspec(dontinline) #else # define JSON_NOINLINE #endif diff --git a/third_party/sqlite3/sqliteInt.inc b/third_party/sqlite3/sqliteInt.inc index 092529e43..83839283e 100644 --- a/third_party/sqlite3/sqliteInt.inc +++ b/third_party/sqlite3/sqliteInt.inc @@ -242,7 +242,7 @@ #if defined(__GNUC__) #define SQLITE_NOINLINE __attribute__((__noinline__)) #elif defined(_MSC_VER) && _MSC_VER >= 1310 -#define SQLITE_NOINLINE __declspec(noinline) +#define SQLITE_NOINLINE __declspec(dontinline) #else # define SQLITE_NOINLINE #endif diff --git a/third_party/stb/stb_image.c b/third_party/stb/stb_image.c index b00d093cd..31fb1bac7 100644 --- a/third_party/stb/stb_image.c +++ b/third_party/stb/stb_image.c @@ -2112,7 +2112,7 @@ static unsigned char *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, } } -static noinline void *stbi__jpeg_load(stbi__context *s, int *x, int *y, +static dontinline void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) { unsigned char *result; @@ -3413,7 +3413,7 @@ static void *stbi__do_png(stbi__png *p, int *x, int *y, int *n, int req_comp, return result; } -static noinline void *stbi__png_load(stbi__context *s, int *x, int *y, +static dontinline void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) { stbi__png p; @@ -3916,7 +3916,7 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, } } -static noinline void *stbi__gif_load(stbi__context *s, int *x, int *y, +static dontinline void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) { unsigned char *u = 0; @@ -3969,7 +3969,7 @@ static int stbi__pnm_test(stbi__context *s) { return 1; } -static noinline void *stbi__pnm_load(stbi__context *s, int *x, int *y, +static dontinline void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) { unsigned char *out; diff --git a/third_party/stb/stb_vorbis.c b/third_party/stb/stb_vorbis.c index 71510298f..75c964d7c 100644 --- a/third_party/stb/stb_vorbis.c +++ b/third_party/stb/stb_vorbis.c @@ -480,7 +480,7 @@ static int error(vorb *f, enum STBVorbisError e) { // given a sufficiently large block of memory, make an array of pointers to // subblocks of it -static noinline void *make_block_array(void *mem, int count, int size) { +static dontinline void *make_block_array(void *mem, int count, int size) { int i; void **p = (void **)mem; char *q = (char *)(p + count); @@ -491,7 +491,7 @@ static noinline void *make_block_array(void *mem, int count, int size) { return p; } -static noinline void *setup_malloc(vorb *f, int sz) { +static dontinline void *setup_malloc(vorb *f, int sz) { sz = (sz + 3) & ~3; f->setup_memory_required += sz; if (f->alloc.alloc_buffer) { @@ -503,12 +503,12 @@ static noinline void *setup_malloc(vorb *f, int sz) { return sz ? malloc(sz) : NULL; } -static noinline void setup_free(vorb *f, void *p) { +static dontinline void setup_free(vorb *f, void *p) { if (f->alloc.alloc_buffer) return; // do nothing; setup mem is a stack free(p); } -static noinline void *setup_temp_malloc(vorb *f, int sz) { +static dontinline void *setup_temp_malloc(vorb *f, int sz) { sz = (sz + 3) & ~3; if (f->alloc.alloc_buffer) { if (f->temp_offset - sz < f->setup_offset) return NULL; @@ -518,7 +518,7 @@ static noinline void *setup_temp_malloc(vorb *f, int sz) { return malloc(sz); } -static noinline void setup_temp_free(vorb *f, void *p, int sz) { +static dontinline void setup_temp_free(vorb *f, void *p, int sz) { if (f->alloc.alloc_buffer) { f->temp_offset += (sz + 3) & ~3; return; @@ -551,7 +551,7 @@ static float square(float x) { // log2(4) = 3 as required by the specification. fast(?) implementation from // stb.h // @OPTIMIZE: called multiple times per-packet with "constants"; move to setup -static noinline int ilog(int32 n) { +static dontinline int ilog(int32 n) { static signed char log2_4[16] = {0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4}; if (n < 0) return 0; // signed n returns 0 diff --git a/tool/build/emubin/prime.c b/tool/build/emubin/prime.c index be9c5ea0d..213a40d35 100644 --- a/tool/build/emubin/prime.c +++ b/tool/build/emubin/prime.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -noinline bool IsPrime(int i) { +dontinline bool IsPrime(int i) { int j, n; for (j = 3, n = VEIL("r", 3); j <= n; j += 2) { if (VEIL("r", i) % VEIL("r", j) == 0) { diff --git a/tool/build/lib/disarg.c b/tool/build/lib/disarg.c index 48d96cac4..a5e68581b 100644 --- a/tool/build/lib/disarg.c +++ b/tool/build/lib/disarg.c @@ -318,7 +318,7 @@ static char *DisRegMem(struct Dis *d, uint32_t rde, char *p, } } -static noinline char *DisE(struct Dis *d, uint32_t rde, char *p, +static dontinline char *DisE(struct Dis *d, uint32_t rde, char *p, char *f(struct Dis *, uint32_t, char *, bool, int)) { if (IsModrmRegister(rde)) { return f(d, rde, p, Rexb(rde), ModrmRm(rde)); diff --git a/tool/build/lib/instruction.c b/tool/build/lib/instruction.c index 038d12d25..13460a152 100644 --- a/tool/build/lib/instruction.c +++ b/tool/build/lib/instruction.c @@ -53,7 +53,7 @@ static void DecodeInstruction(struct Machine *m, uint8_t *p, unsigned n) { } } -static noinline void LoadInstructionSlow(struct Machine *m, uint64_t ip) { +static dontinline void LoadInstructionSlow(struct Machine *m, uint64_t ip) { unsigned i; uint8_t *addr; uint8_t copy[15], *toil; diff --git a/tool/emacs/c.lang b/tool/emacs/c.lang index af98cfa34..3ab13c568 100644 --- a/tool/emacs/c.lang +++ b/tool/emacs/c.lang @@ -88,7 +88,7 @@ Keywords={ "forcealignargpointer", "textexit", "externinline", -"noinline", +"dontinline", "noclone", "donothing", "printfesque", diff --git a/tool/emacs/cosmo-c-keywords.el b/tool/emacs/cosmo-c-keywords.el index a5970c1ea..85b91f18e 100644 --- a/tool/emacs/cosmo-c-keywords.el +++ b/tool/emacs/cosmo-c-keywords.el @@ -132,7 +132,7 @@ "forcealignargpointer" "textexit" "externinline" - "noinline" + "dontinline" "noclone" "donothing" "printfesque" diff --git a/tool/emacs/key.py b/tool/emacs/key.py index 7edb41fe1..44c8c99df 100644 --- a/tool/emacs/key.py +++ b/tool/emacs/key.py @@ -346,7 +346,7 @@ cosmo_kws = frozenset([ "nocallback", "nodebuginfo", "nodiscard", - "noinline", + "dontinline", "noinstrument", "nointerpose", "nooptimize", @@ -409,7 +409,7 @@ cosmo_kws = frozenset([ "nocallback", "nodebuginfo", "nodiscard", - "noinline", + "dontinline", "noinstrument", "nointerpose", "nooptimize", diff --git a/tool/net/redbean.c b/tool/net/redbean.c index 30e692ce5..6fb7a4201 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -4521,7 +4521,7 @@ static int LuaIsAcceptablePort(lua_State *L) { return LuaIsValid(L, IsAcceptablePort); } -static noinline int LuaCoderImpl(lua_State *L, +static dontinline int LuaCoderImpl(lua_State *L, char *C(const char *, size_t, size_t *)) { void *p; size_t n; @@ -4532,7 +4532,7 @@ static noinline int LuaCoderImpl(lua_State *L, return 1; } -static noinline int LuaCoder(lua_State *L, +static dontinline int LuaCoder(lua_State *L, char *C(const char *, size_t, size_t *)) { return LuaCoderImpl(L, C); } @@ -4597,7 +4597,7 @@ static int LuaVisualizeControlCodes(lua_State *L) { return LuaCoder(L, VisualizeControlCodes); } -static noinline int LuaHasherImpl(lua_State *L, size_t k, +static dontinline int LuaHasherImpl(lua_State *L, size_t k, int H(const void *, size_t, uint8_t *)) { void *p; size_t n; @@ -4609,7 +4609,7 @@ static noinline int LuaHasherImpl(lua_State *L, size_t k, return 1; } -static noinline int LuaHasher(lua_State *L, size_t k, +static dontinline int LuaHasher(lua_State *L, size_t k, int H(const void *, size_t, uint8_t *)) { return LuaHasherImpl(L, k, H); } @@ -4759,7 +4759,7 @@ static int LuaCrc32c(lua_State *L) { return LuaHash(L, crc32c); } -static noinline int LuaProgramInt(lua_State *L, void P(long)) { +static dontinline int LuaProgramInt(lua_State *L, void P(long)) { P(luaL_checkinteger(L, 1)); return 0; } @@ -4794,7 +4794,7 @@ static int LuaProgramSslTicketLifetime(lua_State *L) { return LuaProgramInt(L, ProgramSslTicketLifetime); } -static noinline int LuaProgramString(lua_State *L, void P(const char *)) { +static dontinline int LuaProgramString(lua_State *L, void P(const char *)) { P(luaL_checkstring(L, 1)); return 0; } @@ -4905,7 +4905,7 @@ static int LuaProgramRedirect(lua_State *L) { return 0; } -static noinline int LuaProgramBool(lua_State *L, bool *b) { +static dontinline int LuaProgramBool(lua_State *L, bool *b) { *b = lua_toboolean(L, 1); return 0; } diff --git a/tool/viz/derasterize.c b/tool/viz/derasterize.c index c5e9ae6f2..f6fe689c1 100644 --- a/tool/viz/derasterize.c +++ b/tool/viz/derasterize.c @@ -185,7 +185,7 @@ static void float2rgb(unsigned n, unsigned char *u, float *f) { * This makes subtraction look good by flattening out the bias curve * that PC display manufacturers like to use. */ -static noinline void rgb2lin(unsigned n, float *f, const unsigned char *u) { +static dontinline void rgb2lin(unsigned n, float *f, const unsigned char *u) { unsigned i; rgb2float(n, f, u); for (i = 0; i < n; ++i) f[i] = frgb2lin(f[i]); @@ -194,7 +194,7 @@ static noinline void rgb2lin(unsigned n, float *f, const unsigned char *u) { /** * Converts linear RGB to standard RGB. */ -static noinline void rgb2std(unsigned n, unsigned char *u, float *f) { +static dontinline void rgb2std(unsigned n, unsigned char *u, float *f) { unsigned i; for (i = 0; i < n; ++i) f[i] = frgb2std(f[i]); float2rgb(n, u, f); diff --git a/tool/viz/lib/stringbuilder.c b/tool/viz/lib/stringbuilder.c index e4edb3fe2..19bc06820 100644 --- a/tool/viz/lib/stringbuilder.c +++ b/tool/viz/lib/stringbuilder.c @@ -23,7 +23,7 @@ #include "libc/x/x.h" #include "tool/viz/lib/stringbuilder.h" -static noinline void StringBuilderGrow(size_t need, struct StringBuilder *sb) { +static dontinline void StringBuilderGrow(size_t need, struct StringBuilder *sb) { size_t n2; n2 = MAX(16, sb->n); while (sb->i + need > n2) n2 += n2 >> 1; diff --git a/tool/viz/magikarp.c b/tool/viz/magikarp.c index 434cea938..253d89445 100644 --- a/tool/viz/magikarp.c +++ b/tool/viz/magikarp.c @@ -464,7 +464,7 @@ static unsigned char Opacify2(unsigned yw, unsigned xw, } } -static noinline void PrintImage2(unsigned yw, unsigned xw, +static dontinline void PrintImage2(unsigned yw, unsigned xw, unsigned char img[4][yw][xw], unsigned yn, unsigned xn) { bool didhalfy; @@ -500,7 +500,7 @@ static noinline void PrintImage2(unsigned yw, unsigned xw, printf("\e[0m\n"); } -static noinline void *DeblinterlaceRgba2(unsigned yn, unsigned xn, +static dontinline void *DeblinterlaceRgba2(unsigned yn, unsigned xn, unsigned char D[4][yn][xn], const unsigned char S[yn][xn][4]) { unsigned y, x; @@ -587,7 +587,7 @@ void ProcessImageMagikarp(unsigned yn, unsigned xn, yn, xn, lround(r_)); } -noinline void WithImageFile(const char *path, +dontinline void WithImageFile(const char *path, void fn(unsigned yn, unsigned xn, unsigned char img[yn][xn][4])) { struct stat st;