From 8d4b47298b6c9eeb9a3f79a5b80d894f80ed4a45 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 27 Dec 2025 03:05:05 +0000 Subject: Do away with memcpy/memset/memcmp Now everything is either explicitly a rep thing, or explicitly some other small run of reasonably efficient instructions. No library calls or function call overhead of any kind. Code size remains nice and small. Ban a few other bad libc functions while we're at it. More can be added later if we decide that's a useful idea. This will require some discipline and workarounds to cope with Clang's tendency to shove mem* calls in places you don't want them even when you tell it not to. Well, c'est la vie. I'm a little nervous that the __builtin_memmove() usage in shuntvars() could still one day emit actual library calls. It appears we're not importing memmove() from anywhere at the moment, though. So I guess it's good enough for now. Also I had to get rid of alloca() in con_.c but that was kind of bad anyway, so that's fine. --- src/langext.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/langext.h') diff --git a/src/langext.h b/src/langext.h index 7e3cbdb..6c57b24 100644 --- a/src/langext.h +++ b/src/langext.h @@ -18,6 +18,7 @@ #define assume(x) ((void)(!!(x) || (unreachable, 0))) #define cold __attribute((__cold__, __noinline__)) #define asm_only __attribute((__naked__)) // N.B.: may not actually work in GCC? +#define forceinline inline __attribute((__always_inline__)) #else #define if_hot(x) if (x) #define if_cold(x) if (x) @@ -27,12 +28,14 @@ #define assume(x) ((void)(__assume(x), 0)) #define cold __declspec(noinline) #define asm_only __declspec(naked) +#define forceinline __forceinline #else static inline _Noreturn void _invoke_ub() {} #define unreachable (_invoke_ub()) #define assume(x) ((void)(!!(x) || (_invoke_ub(), 0))) #define cold //#define asm_only // Can't use this without Clang/GCC/MSVC. Too bad. +#define forceinline inline #endif #endif -- cgit v1.2.3-54-g00ecf