Skip to content
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

[mono][interp] Fix handing of native types #61612

Merged
merged 2 commits into from
Nov 25, 2021
Merged

Conversation

BrzVlad
Copy link
Member

@BrzVlad BrzVlad commented Nov 15, 2021

Fixes #61153

Use a single g_print in bulk for every instruction. Otherwise, the instruction ends up being displayed on multiple lines.
These structures are valuetypes, but their mint_type is a primitive. This means that a LDFLD applied on the type would have attempted to do a pointer dereference, because it saw that the current top of stack is not STACK_TYPE_VT. This was fixed in the past by passing the managed pointer to the valuetype rather than the valuetype itself, against the normal call convention, which lead to inconsistencies in the code.

This commit removes that hack and fixes the problem by ignoring LDFLD applied to nint/nfloat valuetypes in the first place.
@ghost
Copy link

ghost commented Nov 15, 2021

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

Issue Details

Fixes #61153

Author: BrzVlad
Assignees: -
Labels:

area-Codegen-Interpreter-mono

Milestone: -

@BrzVlad
Copy link
Member Author

BrzVlad commented Nov 15, 2021

@marek-safar @rolfbjarne @lambdageek My understanding was that we used these native types to compensate for a lack of support within the C# language. However, if I'm not mistaken these types were added recently in the language and they are implemented differently. Do we still need these long term ? Seems like iOS is still using them.

@rolfbjarne Is there any way to test my change on iOS. I'm not sure if we have tests for this functionality in dotnet/runtime

@rolfbjarne
Copy link
Member

@BrzVlad we'll need the support for our nfloat type going forward, but not for nint and nuint.

There are some tests here, not sure if those could apply to this scenario:

https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/src/mono/mono/mini/builtin-types.cs

@BrzVlad
Copy link
Member Author

BrzVlad commented Nov 18, 2021

Wasn't able to test this on 32bit so I just submitted this change to mono/mono for some additional test running : mono/mono#21317

@SamMonoRT
Copy link
Member

@BrzVlad please correct me if I'm wrong here --- but all validation is complete now. the change was ported to mono\mono locally to run a few more tests, and it's all green.
@steveisok @Redth @rolfbjarne - this is ready to be merged to main now and to be backported to the 6.0-maui (or whatever final name we settled on). @steveisok can you kick off whatever backport command needs to be done. At this point we don't think we need this in 6.0.x servicing.

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.

[Bug] MAUI templates crashing on iOS (Foundation.NSMutableData:AppendBytes)
4 participants