Skip to content

Unify generic and concrete checkescape analysis - #15033

Open
tamird wants to merge 1 commit into
google:masterfrom
tamird:checkescape-generics
Open

tamird wants to merge 1 commit into
google:masterfrom
tamird:checkescape-generics

Conversation

@tamird

@tamird tamird commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

checkescape cannot reliably check generic functions or their callers, preventing nosplit helpers from being factored into generic packages. Its concrete analysis also misses implicit calls introduced by the Go compiler.

Analyze generic and concrete functions through one type-aware model of source operations and their possible runtime effects. Use compiled code to rule out eliminated effects in concrete functions; check generic declarations against every permitted type argument and share their facts with callers. Matching compiler calls to the operations that caused them both finds previously missed escapes and avoids attributing unrelated calls to allocations.

Use the existing local exemption for metric field lookup's known stack splitting risk. This lets the analyzer land before a nosplit replacement (#14879), while keeping the remaining metric operations checked.

Landing still requires #15050 to remove interface boxing from the signal-frame nosplit path.

Assisted-by: Codex

@tamird
tamird force-pushed the checkescape-generics branch 2 times, most recently from 2009301 to dcd7c3d Compare September 26, 2026 20:37
@tamird tamird changed the title Support generics in checkescape Unify generic and concrete checkescape analysis Sep 26, 2026
@tamird
tamird force-pushed the checkescape-generics branch 4 times, most recently from 27c9497 to 47f9bf0 Compare September 27, 2026 12:36
@zkoopmans zkoopmans self-assigned this Sep 29, 2026

@zkoopmans zkoopmans left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor nit, but otherwise approved. Thanks for the patch!

Comment thread tools/checkescape/checkescape.go Outdated
@tamird
tamird force-pushed the checkescape-generics branch 3 times, most recently from bcfd027 to 44627fd Compare September 30, 2026 03:50
checkescape cannot reliably check generic functions or their callers,
preventing nosplit helpers from being factored into generic packages.
Its concrete analysis also misses implicit calls introduced by the Go
compiler.

Analyze generic and concrete functions through one type-aware model of
source operations and their possible runtime effects. Use compiled code
to rule out eliminated effects in concrete functions; check generic
declarations against every permitted type argument and share their facts
with callers. Matching compiler calls to the operations that caused them
both finds previously missed escapes and avoids attributing unrelated
calls to allocations.

Use the existing local exemption for metric field lookup's known stack
splitting risk. This lets the analyzer land before a nosplit replacement
(google#14879), while keeping the remaining metric operations checked.

Assisted-by: Codex
@tamird
tamird force-pushed the checkescape-generics branch from 44627fd to 43e2272 Compare October 1, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants