Skip to content

Conversation

@janvorli
Copy link
Member

This change fixes few issues I have found while investigating coreclr tests failures when running interpreted

  • The GC info for reverse pinvoke stubs didn't have the revPInvokeOffset set
  • When SfiNext reached native marker state, it was doing one more unwind to get to the frame function state. That is benign for non-interpreter scenarios, as it doesn't change the regdisplay, but it is useless due to that. But for interpreter, it can actually incorrectly move to interpreted code. The fix is to not to do that unwind and just return.
  • The StackFrameIterator::SkipTo that is called when SfiNext collides with the previous EH was missing copying of the first argument register that can hold the InterpreterFrame pointer.
  • When SfiNext moved out of the last interpreted code frame and the caller of the interpreted code was not managed code (e.g. the CallDescrWorker), the StackFrameIterator's regdisplay was not updated to that context.

This change fixes few issues I have found while investigating coreclr
tests failures when running interpreted
* The GC info for reverse pinvoke stubs didn't have the revPInvokeOffset
  set
* When SfiNext reached native marker state, it was doing one more unwind
  to get to the frame function state. That is benign for non-interpreter
  scenarios, as it doesn't change the regdisplay, but it is useless due
  to that. But for interpreter, it can actually incorrectly move to
  interpreted code. The fix is to not to do that unwind and just return.
* The StackFrameIterator::SkipTo that is called when SfiNext collides with
  the previous EH was missing copying of the first argument register
  that can hold the InterpreterFrame pointer.
* When SfiNext moved out of the last interpreted code frame and the
  caller of the interpreted code was not managed code (e.g.
  the CallDescrWorker), the StackFrameIterator's regdisplay was not
  updated to that context.
@janvorli janvorli added this to the 11.0.0 milestone Sep 16, 2025
@janvorli janvorli self-assigned this Sep 16, 2025
Copilot AI review requested due to automatic review settings September 16, 2025 22:16
@janvorli janvorli requested review from BrzVlad and kg as code owners September 16, 2025 22:16
Copy link
Contributor

Copilot AI left a 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 several issues with interpreter and exception handling (EH) in the CoreCLR runtime to address test failures when running interpreted code.

Key changes:

  • Fixed GC info for reverse pinvoke stubs by setting the revPInvokeOffset
  • Corrected stack frame iterator behavior when reaching native marker states
  • Added proper register copying for interpreter frame pointers during stack unwinding

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/coreclr/vm/stackwalk.cpp Added first argument register copying for interpreter frame addresses and logging for debugging
src/coreclr/vm/exceptionhandling.cpp Fixed stack frame iterator logic for native markers and interpreter frame unwinding
src/coreclr/interpreter/compiler.cpp Added reverse pinvoke frame slot configuration for unmanaged callers only methods

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

@janvorli janvorli added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Sep 23, 2025
@janvorli
Copy link
Member Author

Adding NO-MERGE until the #119863 gets in. We will need to backport the other to .NET 10 and this would make the backport more complicated.

@janvorli janvorli removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Sep 29, 2025
@janvorli janvorli merged commit 925205d into dotnet:main Sep 29, 2025
101 of 102 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants