From 8191fec458dfcdae327f98daec15e5ee1fa5c9b0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 24 Jan 2025 23:58:18 +0100 Subject: [PATCH] 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. --- src/julia_gc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/julia_gc.c b/src/julia_gc.c index ac3b035b0d..41b9201fd1 100644 --- a/src/julia_gc.c +++ b/src/julia_gc.c @@ -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 - // for details. + // Julia -- this was due to a bug on the Julia side. It was finally fixed + // by , 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 - // 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 but that PR was + // later reverted by . // // 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)) {