bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Provide a module for `clear_cache'


From: Marc Nieper-Wißkirchen
Subject: Provide a module for `clear_cache'
Date: Mon, 6 Nov 2023 17:32:43 +0100

The idea is to offer the builtin procedure

__builtin__clear_cache (void *begin, void *end),

which is provided at least by gcc and clang, in a portable manner.  From the documentation of gcc's version:

"This function is used to flush the processor’s instruction cache for the region of memory between begin inclusive and end exclusive. Some targets require that the instruction cache be flushed, after modifying memory containing code, in order to obtain deterministic behavior."

Clients for such a procedure are, in particular, JIT compilers.  GNU lightning currently calls libgcc's `__clear_cache' directly ([1]), but this will fail on systems that do not have libgcc.

Having a Gnulib module that tests for the builtin analogous to the module `builtin-expect' ([2]) would be great.
Thanks,

Marc

--

[1] -- https://git.savannah.gnu.org/cgit/lightning.git/tree/lib/jit_aarch64.c#n73
[2] -- https://www.gnu.org/software/gnulib/MODULES.html#module=builtin-expect


reply via email to

[Prev in Thread] Current Thread [Next in Thread]