Reapply "Inline CORINFO_HELP_ARRADDR_ST helper call, remove WriteBarr… …ier FCall" (#126530)#126547
Draft
EgorBo wants to merge 4 commits intodotnet:mainfrom
Draft
Reapply "Inline CORINFO_HELP_ARRADDR_ST helper call, remove WriteBarr… …ier FCall" (#126530)#126547EgorBo wants to merge 4 commits intodotnet:mainfrom
EgorBo wants to merge 4 commits intodotnet:mainfrom
Conversation
…ier FCall" (dotnet#126530) This reverts commit ab2f538.
Contributor
|
Tagging subscribers to this area: @agocke |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reintroduces JIT inlining for CORINFO_HELP_ARRADDR_ST and replaces the old CastHelpers.WriteBarrier FCall plumbing with a managed RuntimeHelpers.WriteBarrier intrinsic that the JIT expands into an explicit heap store/write-barrier operation.
Changes:
- Introduces
RuntimeHelpers.WriteBarrier(ref object? dst, object? obj)as an intrinsic and updates stelem-ref paths to use it instead of an InternalCall/FCall-based helper. - Updates the JIT to (a) recognize/expand the new
WriteBarrierintrinsic and (b) convertCORINFO_HELP_ARRADDR_SThelper calls into managed user-call equivalents to enable inlining (with fallback handling in morphing). - Removes
JIT_WriteBarrier_Callableand associated mapping/exports across multiple architectures (arm/arm64/amd64/i386/riscv64/loongarch64/wasm) and removes the corresponding ecall list entries.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs | Adds intrinsic RuntimeHelpers.WriteBarrier in CoreLib. |
| src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs | Removes InternalCall WriteBarrier and switches stelem-ref writes to RuntimeHelpers.WriteBarrier; adds AggressiveInlining on StelemRef. |
| src/coreclr/vm/ecalllist.h | Removes CastHelpers.WriteBarrier FCFunc/FCClass registration. |
| src/coreclr/vm/jitinterface.h | Removes JIT_WriteBarrier_Callable declaration and WriteBarrier_Helper macro. |
| src/coreclr/vm/amd64/jithelpers_fast.S | Removes JIT_WriteBarrier_Callable stub. |
| src/coreclr/vm/amd64/JitHelpers_Fast.asm | Removes JIT_WriteBarrier_Callable stub. |
| src/coreclr/vm/i386/jithelp.S | Removes JIT_WriteBarrier_Callable stub. |
| src/coreclr/vm/i386/jithelp.asm | Removes JIT_WriteBarrier_Callable stub. |
| src/coreclr/vm/arm/asmhelpers.S | Removes JIT_WriteBarrier_Callable stub. |
| src/coreclr/vm/arm64/asmhelpers.S | Removes JIT_WriteBarrier_Callable stub. |
| src/coreclr/vm/arm64/asmhelpers.asm | Removes JIT_WriteBarrier_Callable stub. |
| src/coreclr/vm/riscv64/asmhelpers.S | Removes JIT_WriteBarrier_Callable stub. |
| src/coreclr/vm/loongarch64/asmhelpers.S | Removes JIT_WriteBarrier_Callable stub. |
| src/coreclr/vm/wasm/helpers.cpp | Removes unimplemented JIT_WriteBarrier_Callable stub for wasm. |
| src/coreclr/jit/namedintrinsiclist.h | Adds NI_System_Runtime_CompilerServices_RuntimeHelpers_WriteBarrier. |
| src/coreclr/jit/importercalls.cpp | Adds intrinsic expansion for WriteBarrier and introduces impConvertToUserCallAndMarkForInlining. |
| src/coreclr/jit/importer.cpp | Converts CORINFO_HELP_ARRADDR_ST helper call to user call and marks for inlining during import. |
| src/coreclr/jit/morph.cpp | Adjusts ARRADDR_ST morphing to accept helper or user-equivalent calls; converts back to helper if not inlined. |
| src/coreclr/jit/gentree.h | Declares IsHelperCallOrUserEquivalent. |
| src/coreclr/jit/gentree.cpp | Implements IsHelperCallOrUserEquivalent; updates tree display for new intrinsic. |
| src/coreclr/jit/compiler.h | Adds HelperToManagedMap storage/accessors for helper-to-managed call mapping. |
| src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/CompilerServices/RuntimeHelpers.cs | Adds intrinsic RuntimeHelpers.WriteBarrier for NativeAOT Runtime.Base. |
| src/coreclr/nativeaot/Test.CoreLib/src/System/Runtime/RuntimeHelpers.cs | Adds intrinsic RuntimeHelpers.WriteBarrier for Test.CoreLib. |
| src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/InternalCalls.cs | Removes InternalCalls.RhpAssignRef import. |
| src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/TypeCast.cs | Switches stelem-ref write barrier calls from InternalCalls.RhpAssignRef to RuntimeHelpers.WriteBarrier. |
src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/TypeCast.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Member
Author
|
ugh.. I guess CI is totally dead |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CI test