-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Handle blittable byref returns in built-in marshalling #72433
Conversation
{ | ||
var pointedAtType = type.GetParameterType(); | ||
if (!pointedAtType.IsPrimitive && !type.IsEnum && marshallerType != MarshallerType.Field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type.IsEnum
was always false here since type
was a byref.
type = type.GetParameterType(); | ||
|
||
if (!type.IsPrimitive && type.IsValueType && marshallerType != MarshallerType.Field | ||
if (type.IsValueType && !type.IsPrimitive && !type.IsEnum && !isField |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to make these conditions consistent and more in sync with CoreCLR logic. This path should be only ever used by managed C++ so it does not matter a whole lot anyway.
{ | ||
ILEmitter emitter = _ilCodeStreams.Emitter; | ||
|
||
_managedHome = new Home(emitter.NewLocal(ManagedParameterType), ManagedParameterType, isByRef: false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just need to create locals of the right type. The default implementation works fine otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes #72316