Skip to content

Commit c026978

Browse files
authored
julia_gc: enable guard page hack for Julia >= 1.12, too (#5913)
My change to make it unnecessary there was reverted, so it is wrong to disable our workaround there.
1 parent dcef556 commit c026978

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/julia_gc.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,27 +420,27 @@ static inline void * align_ptr(void * p)
420420
static void FindLiveRangeReverse(PtrArray * arr, void * start, void * end)
421421
{
422422
// HACK: the following deals with stacks of 'negative size' exposed by
423-
// Julia -- however, despite us having this code in here for a few years,
424-
// I now think it may actually be due to a bug on the Julia side. See
425-
// <https://github.com/JuliaLang/julia/pull/54639> for details.
423+
// Julia -- this was due to a bug on the Julia side. It was finally fixed
424+
// by <https://github.com/JuliaLang/julia/pull/54639>, which should
425+
// hopefully appear in Julia 1.12.
426426
if (lt_ptr(end, start)) {
427427
SWAP(void *, start, end);
428428
}
429-
#if JULIA_VERSION_MAJOR == 1 && JULIA_VERSION_MINOR <= 11
430429
// adjust for Julia guard pages if necessary
431-
// In Julia >= 1.12 this is no longer necessary thanks
432-
// to <https://github.com/JuliaLang/julia/pull/54591>
433-
// TODO: hopefully this actually also gets backported to 1.11.0
430+
//
431+
// For a time I hoped this wouldn't be necessary anymore in Julia >= 1.12
432+
// due to <https://github.com/JuliaLang/julia/pull/54591> but that PR was
433+
// later reverted by <https://github.com/JuliaLang/julia/pull/55555>.
434434
//
435435
// unfortunately jl_guard_size is not exported; fortunately it
436436
// is the same in all Julia versions were we need it
437437
else {
438-
void * new_start = (char *)start + (4096 * 8);
438+
const size_t jl_guard_size = (4096 * 8);
439+
void * new_start = (char *)start + jl_guard_size;
439440
if ((uintptr_t)new_start <= (uintptr_t)end) {
440441
start = new_start;
441442
}
442443
}
443-
#endif
444444
char * p = (char *)(align_ptr(start));
445445
char * q = (char *)end - sizeof(void *);
446446
while (!lt_ptr(q, p)) {

0 commit comments

Comments
 (0)