You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: Bypass bulk write barrier wrapper for small struct copies - #134345
Bypass the managed bulk-write-barrier wrapper for GC-containing struct copies up to 128 bytes in JIT, ReadyToRun, and NativeAOT. Larger copies retain the existing helper.
Azure Pipelines:
Successfully started running 6 pipeline(s).
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.
The current Bulk WB is calling a managed impl (very likely via an indirect call). the managed impl does a size check and calls FCall. Given JIT always knows the size of the layout and in most cases it's not too big, we can bypass that transition.
An additional version can be made for "definitely on the heap (aka unchecked)" to avoid the "is on the heap" check, but that is probably more churn for less benefits.
PS: not sure we need to abstract BULK_WRITEBARRIER_SMALL_SIZE under a JIT-EE. Presumably it's not a correctness issue if they don't match with whatever is used in the managed impl. It's just have to be not too big.
Limit direct copies to 128 bytes and add the R2R helper ID, versioning, and NativeAOT Wasm ABI mapping.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d2554ff3-cb18-47b0-9789-b44b8d03f59f
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
Address the missing boundary coverage and preserve a GC poll for repeated small copies.
Review effort: Lite Findings: None
Previously missed (1)
In code that hasn't changed since last review
Add boundary and AOT coverage for 128-byte helper mapping
src/coreclr/jit/lower.cpp:10402
This introduces a new 128-byte boundary and deliberately removes the GC poll for the <=128-byte path, but there is no targeted coverage for the exact 128/129 split or for the new helper through ReadyToRun/NativeAOT. Please add a focused runtime/codegen test covering both sides of the boundary so an off-by-one or incomplete helper mapping cannot silently change GC safepoint behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bypass the managed bulk-write-barrier wrapper for GC-containing struct copies up to 128 bytes in JIT, ReadyToRun, and NativeAOT. Larger copies retain the existing helper.
Benchmark - shows 5-15% improvement for 5 refs struct.