tarantool / tarantool/tarantool
JIT fails to allocate mcode memory on M1 for Tarantool
@Buristan is already working on this.
Since Aug 15, 2022.
- Dominant language
- Lua
- Stars
- 3.7k
- Forks
- 419
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 88
Description
During running JIT-related tests the trace assembling occasionally fails with the following reason in jit.dump output:
failed to allocate mcode memory
This is happens due to none of probed pseudo-random addresses are suited for JIT engine, because all of them are out of LJ_TARGET_JUMPRANGE (+-27Mb). Looks like this happens due to bunch of loaded .dylib libraries (libcurl, libicu, etc.) so all well-suited addresses are already in use and mmap() just returned to big address.
Also, a bunch of problems I faced while trying to resolve the issue:
- We can't link with the shared luajit library as far as Tarantool uses internal routines from the luajit, so they won't be provided by the shared library.
- On M1 due to security reasons we can't link the final executed binary with
-no_pieoption:
ld: warning: -no_pie ignored for arm64
As a result, we can't set -image_base for it too:
ld: warning: Linking with PIE, -image_base will be ignored
- Looks like there are no analogues of linker scripts for macos (at least I don't find any suited replacements for
ld --verbose,-Toption), so we can't just add something like the following in the default linker script:
.text.luajit : {
. = 0x21000000;
*libluajit.a:*(.text .text.*)
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.