Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

julia_gc: compensate for Julia guard pages #5737

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/julia_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,28 @@

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 know think it may actually be due to a bug on the Julia side. See
// <https://github.com/JuliaLang/julia/pull/54639> for details.
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
//
// 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);

Check warning on line 438 in src/julia_gc.c

View check run for this annotation

Codecov / codecov/patch

src/julia_gc.c#L438

Added line #L438 was not covered by tests
if ((uintptr_t)new_start <= (uintptr_t)end) {
start = new_start;

Check warning on line 440 in src/julia_gc.c

View check run for this annotation

Codecov / codecov/patch

src/julia_gc.c#L440

Added line #L440 was not covered by tests
}
}
#endif
char * p = (char *)(align_ptr(start));
char * q = (char *)end - sizeof(void *);
while (!lt_ptr(q, p)) {
Expand Down
Loading