Skip to content

Commit

Permalink
julia_gc: enable guard page hack for Julia >= 1.12, too (#5913)
Browse files Browse the repository at this point in the history
My change to make it unnecessary there was reverted, so
it is wrong to disable our workaround there.
  • Loading branch information
fingolfin committed Jan 24, 2025
1 parent 2f5918d commit 8191fec
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/julia_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,27 +420,27 @@ static inline void * align_ptr(void * p)
static void FindLiveRangeReverse(PtrArray * arr, void * start, void * end)
{
// HACK: the following deals with stacks of 'negative size' exposed by
// Julia -- however, despite us having this code in here for a few years,
// I now think it may actually be due to a bug on the Julia side. See
// <https://github.com/JuliaLang/julia/pull/54639> for details.
// Julia -- this was due to a bug on the Julia side. It was finally fixed
// by <https://github.com/JuliaLang/julia/pull/54639>, which should
// hopefully appear in Julia 1.12.
if (lt_ptr(end, start)) {
SWAP(void *, start, end);
}
#if JULIA_VERSION_MAJOR == 1 && JULIA_VERSION_MINOR <= 11
// adjust for Julia guard pages if necessary
// In Julia >= 1.12 this is no longer necessary thanks
// to <https://github.com/JuliaLang/julia/pull/54591>
// TODO: hopefully this actually also gets backported to 1.11.0
//
// For a time I hoped this wouldn't be necessary anymore in Julia >= 1.12
// due to <https://github.com/JuliaLang/julia/pull/54591> but that PR was
// later reverted by <https://github.com/JuliaLang/julia/pull/55555>.
//
// unfortunately jl_guard_size is not exported; fortunately it
// is the same in all Julia versions were we need it
else {
void * new_start = (char *)start + (4096 * 8);
const size_t jl_guard_size = (4096 * 8);
void * new_start = (char *)start + jl_guard_size;
if ((uintptr_t)new_start <= (uintptr_t)end) {
start = new_start;
}
}
#endif
char * p = (char *)(align_ptr(start));
char * q = (char *)end - sizeof(void *);
while (!lt_ptr(q, p)) {
Expand Down

0 comments on commit 8191fec

Please sign in to comment.