-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix generic argument access in filter funclets #121332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix generic argument access in filter funclets #121332
Conversation
In funclets of generic methods, access to the generic argument may be needed. It doesn't work correctly, because the filter funclet has its own locals and various IR instructions that use that argument cannot access it. This change adds copying of that argument from the parent frame to the funclet frame at the same offset so that the access to it just works.
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where filter clauses in generic methods could not access the generic type parameter argument. The fix ensures that the generic parameter argument is copied from the parent frame to the filter's frame when entering a filter clause.
Key Changes
- Initialized
m_paramArgIndexto-1to indicate when no generic parameter argument exists - Added logic to copy the generic parameter argument from parent frame to filter frame when entering filter clauses
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/interpreter/compiler.h | Initialized m_paramArgIndex to -1 as a sentinel value to indicate absence of a parameter argument |
| src/coreclr/interpreter/compiler.cpp | Added code to copy the generic parameter argument from parent frame to filter frame when entering filter clauses in generic methods |
|
There is something wrong now, maybe some cleanup / refactoring I did after the local testing has caused this to not to work. I am investigating. |
|
There was a bug in the SetDVar being passed a variable offset instead of index. |
|
/ba-g the failures are infra issues unrelated to the change |
In funclets of generic methods, access to the generic argument may be needed. It doesn't work correctly, because the filter funclet has its own locals and various IR instructions that use that argument cannot access it.
This change adds copying of that argument from the parent frame to the funclet frame at the same offset so that the access to it just works.