Skip to content

Exclude asynchronous handle scanning from single-threaded builds - #137071

Open
MichalStrehovsky wants to merge 2 commits into
dotnet:mainfrom
MichalStrehovsky:gcscan
Open

MichalStrehovsky wants to merge 2 commits into
dotnet:mainfrom
MichalStrehovsky:gcscan

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

Guard asynchronous handle-table dispatch and scanner support with FEATURE_MULTITHREADING. Assert synchronous scan requests without rewriting caller inputs, while preserving handle-table layout and multithreaded behavior.

Taking the address of the function pulls in 2 kB of unnecessary code. If we don't want to take this PR, it's fine, 2 kB is not a huge deal.

Guard asynchronous handle-table dispatch and scanner support with FEATURE_MULTITHREADING. Assert synchronous scan requests without rewriting caller inputs, while preserving handle-table layout and multithreaded behavior.

This provides a 2,356 byte size saving for the size-optimized WASI NativeAOT Release Hello World, shrinking it from 825,570 to 823,214 bytes.

Validated WASI Release/Checked handle-GC probes and Preinitialization, and built Windows x64 Debug workstation/server GC runtimes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9bc3dfee-1040-4648-bdad-86922a749613
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @anicka-net, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Comment thread src/coreclr/gc/handletablescan.cpp Outdated



#ifdef FEATURE_MULTITHREADING

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.

Do we need the fine-grained ifdefs - can we let the compiler/linker get rid of the unreachable code?

Keep FEATURE_MULTITHREADING guards only at asynchronous dispatch sites and remove fine-grained scanner and lock-construction guards, addressing review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b9c54b14-a38c-42b9-89c4-ffacfcc2fe80

This branch was previously deployed

1 inactive (outdated) deployment
copilot-pat-pool — 5a67231b Deployed Nov 6, 2026 by MichalStrehovsky via conclusion #11901
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-GC-coreclr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants