[mono][interp] Keep delegate alive during invocation#100832
Merged
BrzVlad merged 1 commit intodotnet:mainfrom Apr 10, 2024
Merged
[mono][interp] Keep delegate alive during invocation#100832BrzVlad merged 1 commit intodotnet:mainfrom
BrzVlad merged 1 commit intodotnet:mainfrom
Conversation
When invoking a delegate, we were overwritting the stack slot containing the delegate object reference. In the case of invoking a delegate for a dynamic method, we were running into issues when the delegate object is collected while the method is executed because the method code is also discarded.
Contributor
|
Tagging subscribers to this area: @BrzVlad, @kotlarmilos |
Member
|
Is it bad that for long-running method bodies, we never null out the ref_slot_offset after a call? It potentially means we leak a delegate instance for a while, but I can't imagine a realistic scenario where that would cause a program to meaningfully degrade just from one delegate surviving GC during a loop. Could break synthetic GC tests maybe. |
kg
approved these changes
Apr 9, 2024
kg
reviewed
Apr 9, 2024
| @@ -4164,6 +4164,9 @@ mono_interp_exec_method (InterpFrame *frame, ThreadContext *context, FrameClause | |||
| } | |||
| cmethod = del_imethod; | |||
| if (!is_multicast) { | |||
Member
There was a problem hiding this comment.
does multicast not need this deathgrip var because multicast invokes are done by a helper method that has 'this' on the stack?
This was referenced Apr 9, 2024
matouskozak
pushed a commit
to matouskozak/runtime
that referenced
this pull request
Apr 30, 2024
When invoking a delegate, we were overwritting the stack slot containing the delegate object reference. In the case of invoking a delegate for a dynamic method, we were running into issues when the delegate object is collected while the method is executed because the method code is also discarded.
This was referenced May 3, 2024
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.
When invoking a delegate, we were overwritting the stack slot containing the delegate object reference. In the case of invoking a delegate for a dynamic method, we were running into issues when the delegate object is collected while the method is executed because the method code is also discarded.