[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Provide a module for `clear_cache'
|
From: |
Bruno Haible |
|
Subject: |
Re: Provide a module for `clear_cache' |
|
Date: |
Mon, 06 Nov 2023 19:33:02 +0100 |
Hello Marc,
> 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.
I can provide such a thing easily. In fact, I have it already sitting
around on my disk since 2021 :-)
> GNU
> lightning currently calls libgcc's `__clear_cache' directly ([1]), but this
> will fail on systems that do not have libgcc.
And also, libgcc's __clear_cache does not always work. My comments say:
/* GCC >= 4.3 has a GCC built-in.
<https://gcc.gnu.org/onlinedocs/gcc-4.3.6/gcc/Other-Builtins.html>
But it's sometimes not correctly implemented.
So, I can provide the module's code. Can you provide a unit test for it?
Bruno
- Provide a module for `clear_cache', Marc Nieper-Wißkirchen, 2023/11/06
- Re: Provide a module for `clear_cache',
Bruno Haible <=
- Re: Provide a module for `clear_cache', Marc Nieper-Wißkirchen, 2023/11/06
- Re: test environments, Sam James, 2023/11/14
- Re: test environments, Bruno Haible, 2023/11/15
- Re: test environments, matoro, 2023/11/15
- Re: test environments, Bruno Haible, 2023/11/15
- new module 'jit/cache', Bruno Haible, 2023/11/12
- Re: new module 'jit/cache', Bruno Haible, 2023/11/13