Skip to content

Fix EmitCall in the interpreter compiler #116654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2025

Conversation

janvorli
Copy link
Member

There are two issues there:

  • The token kinds passed to the ResolveToken for NewObj and Method are flipped
  • The doCallInsteadOfNew is set for non-constructor methods too, resulting in overriding the return type to InterpTypeO

There are two issues there:
* The token kinds passed to the ResolveToken for NewObj and Method are
  flipped
* The doCallInsteadOfNew is set for non-constructor methods too,
  resulting in overriding the return type to InterpTypeO
@janvorli janvorli added this to the 10.0.0 milestone Jun 13, 2025
@janvorli janvorli requested a review from davidwrighton June 13, 2025 21:13
@janvorli janvorli self-assigned this Jun 13, 2025
@Copilot Copilot AI review requested due to automatic review settings June 13, 2025 21:13
@janvorli janvorli requested review from BrzVlad and kg as code owners June 13, 2025 21:13
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 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 corrects two issues in EmitCall: it swaps the token kinds passed to ResolveToken for object creation vs. method calls, and it ensures the variable-size object logic only applies to newObj scenarios.

  • Flip CORINFO_TOKENKIND arguments when calling ResolveToken
  • Guard the CORINFO_FLG_VAROBJSIZE branch with newObj
Comments suppressed due to low confidence (1)

src/coreclr/interpreter/compiler.cpp:2346

  • Consider adding or updating unit tests to cover both newObj and non-newObj paths, especially ensuring that the flipped token kinds invoke the correct resolution logic.
ResolveToken(token, newObj ? CORINFO_TOKENKIND_NewObj : CORINFO_TOKENKIND_Method, &resolvedCallToken);

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@janvorli janvorli merged commit 7baa054 into dotnet:main Jun 16, 2025
94 checks passed
@janvorli janvorli deleted the fix-interpreter-call-issue branch June 16, 2025 15:15
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