Skip to content

Fix handling of TypedReference returns in call stubs#127603

Open
BrzVlad wants to merge 1 commit intodotnet:mainfrom
BrzVlad:fix-clrinterp-typedbyref
Open

Fix handling of TypedReference returns in call stubs#127603
BrzVlad wants to merge 1 commit intodotnet:mainfrom
BrzVlad:fix-clrinterp-typedbyref

Conversation

@BrzVlad
Copy link
Copy Markdown
Member

@BrzVlad BrzVlad commented Apr 30, 2026

We special case it as consisting of 2 I8s. Fixes System.Resources.Extensions.BinaryFormat.Tests crashes when a method returning TypedReference gets called from interpreter via JIT.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
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 updates CoreCLR’s interpreter/JIT call stub return-type classification to correctly handle methods returning TypedReference, which is a 2-pointer (16-byte on 64-bit) return value, preventing crashes seen in System.Resources.Extensions.BinaryFormat.Tests.

Changes:

  • Removes ELEMENT_TYPE_TYPEDBYREF from the “treat like pointer/ref” return-type bucket.
  • Adds explicit handling for ELEMENT_TYPE_TYPEDBYREF, intending to classify it as two 8-byte integer returns on 64-bit.

Comment on lines +2710 to +2711
#else
return ReturnType2I8;
Comment thread src/coreclr/vm/callstubgenerator.cpp Outdated
Comment on lines +2708 to +2709
assert(!"Implement TypedByRef support on 32bit");
break;
Comment thread src/coreclr/vm/callstubgenerator.cpp Outdated
Comment on lines +2708 to +2709
assert(!"Implement TypedByRef support on 32bit");
break;
We special case it as consisting of 2 I8s.
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.

2 participants