Skip to content

[clr-interp] StackMark handling for interpreter#120278

Merged
davidwrighton merged 5 commits intodotnet:mainfrom
davidwrighton:InterpreterStackMarks
Oct 1, 2025
Merged

[clr-interp] StackMark handling for interpreter#120278
davidwrighton merged 5 commits intodotnet:mainfrom
davidwrighton:InterpreterStackMarks

Conversation

@davidwrighton
Copy link
Member

  • StackMark handling relies on comparing the stackmark's address to the stack pointer, but the interpreter stack is seperate.
  • Fix this by converting the StackMark pointer to a pointer on the OS stack and then do the compares

- StackMark handling relies on comparing the stackmark's address to the stack pointer, but the interpreter stack is seperate.
- Fix this by converting the StackMark pointer to a pointer on the OS stack and then do the compares
Copilot AI review requested due to automatic review settings September 30, 2025 23:02
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 StackMark handling for the interpreter by addressing the issue that StackMark pointer comparisons don't work correctly when the interpreter uses a separate stack from the OS stack.

Key changes:

  • Adds a new function to convert StackMark pointers from interpreter stack to OS stack addresses
  • Updates StackMark usage patterns in reflection and appdomain code to use converted pointers for stack comparisons
  • Maintains backward compatibility by conditionally compiling interpreter-specific logic

Reviewed Changes

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

File Description
src/coreclr/vm/stackwalk.h Declares new conversion function for StackMark pointers
src/coreclr/vm/stackwalk.cpp Implements logic to convert interpreter stack pointers to OS stack pointers
src/coreclr/vm/reflectioninvocation.cpp Updates SkipStruct to use converted StackMark pointers for frame comparisons
src/coreclr/vm/appdomain.cpp Updates CallersDataWithStackMark to use converted StackMark pointers for frame comparisons

@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.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

davidwrighton and others added 2 commits September 30, 2025 16:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@davidwrighton davidwrighton enabled auto-merge (squash) September 30, 2025 23:46
Removed unnecessary while loops for traversing interpreter method context frames.
Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@davidwrighton davidwrighton merged commit 8d2e261 into dotnet:main Oct 1, 2025
98 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 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.

3 participants