Skip to content

Conversation

BrzVlad
Copy link
Member

@BrzVlad BrzVlad commented Jul 4, 2025

Fixes #115859

@Copilot Copilot AI review requested due to automatic review settings July 4, 2025 05:54
@BrzVlad BrzVlad requested a review from lateralusX July 4, 2025 05:54
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 ensures that 32-bit integer return values from interpreted methods on amd64 are sign-extended to match JIT expectations and updates the call-result widening logic to include the interpreter backend alongside LLVM.

  • Sign-extend I4 return values in the amd64 interpreter call context.
  • Extend mono_emit_widen_call_res to treat the interpreter path similarly to LLVM for return-value widening.

Reviewed Changes

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

File Description
src/mono/mono/mini/mini-amd64.c Sign-extend I4 return value on the amd64 interpreter path when returning in RAX.
src/mono/mono/mini/method-to-ir.c Rename and extend the “might_use_llvm” flag to also cover the interpreter path.
Comments suppressed due to low confidence (2)

src/mono/mono/mini/method-to-ir.c:2238

  • Update this comment to mention that widening now applies for both LLVM and the interpreter backends, not just LLVM.
		// LLVM code doesn't uses zero extend the full word while jit expects it.

src/mono/mono/mini/mini-amd64.c:1480

  • Add a unit test for the interpreter on amd64 to verify that negative I4 return values are correctly sign-extended when placed in RAX.
		if (sig->ret->type == MONO_TYPE_I4 && ainfo->storage == ArgInIReg && ainfo->reg == AMD64_RAX)

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @steveisok, @vitek-karas
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@lateralusX lateralusX left a comment

Choose a reason for hiding this comment

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

LGTM!

@BrzVlad
Copy link
Member Author

BrzVlad commented Jul 10, 2025

Replaced by #117336

@BrzVlad BrzVlad closed this Jul 10, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 10, 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.

[Mono] An unexpected System.OutOfMemoryException occurred in AOT-interpreter mode

2 participants