[interp] Verify stack depth for return opcodes#118976
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds stack depth verification for return opcodes in the CoreCLR interpreter to ensure the evaluation stack has exactly the expected number of items when returning from a method. This addresses a regression test failure in GitHub_25027.
Key changes:
- Introduces a new
CheckStackExactmethod that validates the stack has precisely the expected depth - Replaces existing
CHECK_STACKcalls withCheckStackExactfor return operations to catch both stack underflow and overflow conditions
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/interpreter/compiler.h | Adds declaration for new CheckStackExact method |
| src/coreclr/interpreter/compiler.cpp | Implements CheckStackExact and applies it to return opcodes for precise stack validation |
Comments suppressed due to low confidence (2)
src/coreclr/interpreter/compiler.cpp:3928
- The removed CHECK_STACK(1) call should be documented or explained in the commit message why it was replaced, as this represents a behavior change from checking minimum stack depth to exact stack depth.
{
src/coreclr/interpreter/compiler.cpp:3947
- The removed CHECK_STACK(1) call should be documented or explained in the commit message why it was replaced, as this represents a behavior change from checking minimum stack depth to exact stack depth.
CHECK_STACK(1);
Contributor
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
davidwrighton
approved these changes
Aug 22, 2025
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.
Fixes JIT\regression\jitblue\GitHub_25027