Skip to content

Conversation

@janvorli
Copy link
Member

@janvorli janvorli commented Dec 5, 2025

The ReflectionInvocation::TryEnsureSufficientExecutionStack was not taking into account the fact that with interpreter enabled, the code can be executed either by the interpreter or it can be AOTed. The interpreter has its own stack with its own limit.

3 libraries tests suites were failing due to this problem.

As a best effort fix, this change adds check for the interpreter stack too and the method returns true only if there is enough space on both real and the interpreter stack, as it is not possible to decide which of them will be used.

The ReflectionInvocation::TryEnsureSufficientExecutionStack was not taking into
account the fact that with interpreter enabled, the code can be executed either
by the interpreter or it can be AOTed. The interpreter has its own stack with
its own limit.

3 libraries tests suites were failing due to this problem.

As a best effort fix, this change adds check for the interpreter stack too and
the method returns true only if there is enough space on both real and the
interpreter stack, as it is not possible to decide which of them will be
used.
@janvorli janvorli added this to the 11.0.0 milestone Dec 5, 2025
@janvorli janvorli requested review from davidwrighton and kg December 5, 2025 23:02
@janvorli janvorli self-assigned this Dec 5, 2025
Copilot AI review requested due to automatic review settings December 5, 2025 23:02
@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.

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 a bug in TryEnsureSufficientExecutionStack where the interpreter's stack was not being checked. The method now correctly checks both the native stack and the interpreter stack when the interpreter is enabled, ensuring that code execution has sufficient stack space regardless of whether it's executed by the interpreter or AOT-compiled code.

Key Changes:

  • Added interpreter stack checking alongside existing native stack checking
  • Uses the same minimum stack size thresholds as the native stack (128KB on 64-bit, 64KB on 32-bit)
  • Returns true only when both stacks have sufficient space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants