Skip to content

fix: add get_pgcstack_fallback to non-allocating allowlist (aarch64 false positive)#105

Merged
topolarity merged 1 commit into
JuliaLang:mainfrom
ChrisRackauckas-Claude:fix-get-pgcstack-fallback-aarch64
Jun 22, 2026
Merged

fix: add get_pgcstack_fallback to non-allocating allowlist (aarch64 false positive)#105
topolarity merged 1 commit into
JuliaLang:mainfrom
ChrisRackauckas-Claude:fix-get-pgcstack-fallback-aarch64

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

Summary

fn_may_allocate (src/classify.jl) whitelists get_pgcstack and get_pgcstack_static as never-allocating, but omits get_pgcstack_fallback — the variant aarch64 (Apple Silicon) codegen emits to fetch the per-task GC stack pointer.

As a result, classify_runtime_fn("jl_get_pgcstack_fallback") returns (:runtime, true), and check_allocs reports a spurious AllocatingRuntimeCall for allocation-free functions on aarch64.

This one-liner adds "get_pgcstack_fallback" to the never-allocates allowlist, right next to "get_pgcstack_static". It mirrors the earlier _static fix in e44be86.

Fixes #104.

Verification

julia> using AllocCheck

# before this PR (v0.2.5):
julia> AllocCheck.classify_runtime_fn("jl_get_pgcstack_fallback"; ignore_throw=true)
(:runtime, true)

# after this PR:
julia> AllocCheck.classify_runtime_fn("jl_get_pgcstack_fallback"; ignore_throw=true)
(:runtime, false)

Pkg.test() passes on Julia 1.10 with the patch applied.

Context

`fn_may_allocate` already whitelists `get_pgcstack` and `get_pgcstack_static`
as never-allocating, but omits the `get_pgcstack_fallback` variant that
aarch64 (Apple Silicon) codegen emits to fetch the per-task GC stack pointer.

As a result `classify_runtime_fn("jl_get_pgcstack_fallback")` returns
`(:runtime, true)` and `check_allocs` reports a spurious
`AllocatingRuntimeCall` for allocation-free functions on aarch64.

This mirrors the earlier fix for the `_static` variant (e44be86).

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@topolarity topolarity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to suggest TLS is not getting setup correctly somehow @ChrisRackauckas-Claude which is probably worthy of further investigation, but this is a good fix regardless

@topolarity topolarity merged commit e9e670c into JuliaLang:main Jun 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive: jl_get_pgcstack_fallback reported as an AllocatingRuntimeCall on aarch64

3 participants