julia
98cacef8 - Make `jl_object_in_image` thread-safe (#61386)

Commit
38 days ago
Make `jl_object_in_image` thread-safe (#61386) This was being accessed from `method.c` / `module.c`, where it was a data race. This moves the Eytzinger code into `src/support` so that it can be maintained separately from `staticdata.c` and adds a `rwlock` to make the concurrent access thread-safe. This lock does have significant overhead, compared to this (small) search. `jl_object_in_image` queries are typically ~15 ns w/o PR, and ~50 ns with (>2x regression). However since this is no longer used in the GC, this overhead amounts to ~2-3 milliseconds of total runtime even with many (200+) packages loaded. My real motivation is to have an async-signal-safe range query that I can use for https://github.com/JuliaLang/julia/pull/61294 (I need to query whether we faulted in a pkgimage to know whether to throw a `DivideError`). Claude 🤖 was used to assist with the re-factor. Also discussed various atomics-related minutia. --------- Co-authored-by: Claude <claude@anthropic.com>
Author
Parents
Loading