Overhaul JIT memory management
Hi all,
This is a MR to discuss (and probably address) the issues we found in !176 (merged).
- Removed all the extra approaches to mappings creation in favour of only anonymous mappings
- This spares us from going through all of the options, which will fail with
noexec
mounts anyway. - It also removes the leak of the temporary file.
- This spares us from going through all of the options, which will fail with
- Fixed the
mmap(2)
calls to berw
, notrwx
- This issue is already the subject of the
execmem
SELinux policy.
- This issue is already the subject of the
- Implemented cache flushing for Windows x86
- This was already required by
VirtualProtect
and implemented by Seungha for Arm
- This was already required by
- Fixed a potential
VirtualAlloc
crash caused by passing a size of 0 to the allocation call- This was previously overridden by the default 65k mapping size
- Also includes logging the error as it happens
- Removed the chunk management in favour of a single mapping per program
- This may be inefficient, but has the big advantage of allowing us to properly free the
OrcProgram
s along with the mappings they use, and remove the need for accessing the global lock
- This may be inefficient, but has the big advantage of allowing us to properly free the
- Unpublished the global lock functions
- There are no more uses after this, except during the library initialisation
🎉
- There are no more uses after this, except during the library initialisation
Let me know what you think!