Fix few startup path issues with interpreter#118448
Merged
janvorli merged 7 commits intodotnet:mainfrom Aug 7, 2025
Merged
Conversation
This change fixes the following issues: * Reverse pinvoke to method marked by UnmanagedCallersOnly attribute. The InterpExecMethod is entered in GC preemptive mode in that case, but it is expected to run in GC cooperative mode. * Pinvoke to method marked by SuppressGCTransition attribute . The pinvoke is entered in GC preemtive mode, but it needs to be called in GC cooperative mode. * Calling a delegate or a similar case when IL stub is used. The interpreter code is set only on the IL stub MethodDesc, but it needs to be set on both the IL stub and the original MethodDesc.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes three interpreter-related startup path issues in the CoreCLR runtime related to GC mode transitions and method descriptor setup:
- Fixes reverse pinvoke methods with UnmanagedCallersOnly attribute to run in GC cooperative mode instead of preemptive mode
- Ensures pinvoke methods with SuppressGCTransition attribute are called in GC cooperative mode
- Sets interpreter code on both IL stub and original MethodDesc when using delegates or similar IL stub scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/vm/prestub.cpp | Adds interpreter code setting for both current and config MethodDesc, and implements GC mode transition for UnmanagedCallersOnly methods |
| src/coreclr/vm/interpexec.cpp | Adds conditional GC cooperative mode transition for methods with SuppressGCTransition attribute |
Comments suppressed due to low confidence (1)
src/coreclr/vm/interpexec.cpp:1881
- This closing brace appears to be misplaced. It should close the GCX_MAYBE_COOP block, but the indentation and structure suggest it's closing the wrong scope. The GCX_MAYBE_COOP block on line 1878 should have its closing brace aligned with its opening.
}
Contributor
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
BrzVlad
reviewed
Aug 6, 2025
jkotas
reviewed
Aug 6, 2025
BrzVlad
reviewed
Aug 6, 2025
jkotas
reviewed
Aug 6, 2025
jkotas
reviewed
Aug 7, 2025
jkotas
reviewed
Aug 7, 2025
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
BrzVlad
reviewed
Aug 7, 2025
BrzVlad
reviewed
Aug 7, 2025
No longer needed after the previous commit
davidwrighton
approved these changes
Aug 7, 2025
Member
davidwrighton
left a comment
There was a problem hiding this comment.
This looks good to me now.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This change fixes the following issues: