KEMBAR78
[mono] Use correct cast_class for IntPtr[] by steveisok · Pull Request #103841 · dotnet/runtime · GitHub
Skip to content

Conversation

@steveisok
Copy link
Member

This change fixes the behavior to be like modern .NET instead of .NET Framework.

Fixes #97145

This change fixes the behavior to be like modern .NET instead of .NET Framework.

Fixes dotnet#97145
Copy link
Member

@kg kg left a comment

Choose a reason for hiding this comment

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

Looks right, but I'm not 100% certain.

@lambdageek
Copy link
Member

I wonder if there's any tests that capture the modern behavior that we previously disabled in Mono.

@kg
Copy link
Member

kg commented Jun 21, 2024

cc @BrzVlad is this going to cause any problems for interp?

@steveisok
Copy link
Member Author

This seems to have crashed on ios/tvos device runs. I ran @lambdageek's sample locally at least works for iossimulator. I'll try on a local device and see if I can get any info out of it.

break;
case MONO_TYPE_U4:
#if TARGET_SIZEOF_VOID_P == 4
case MONO_TYPE_I:
Copy link
Member

Choose a reason for hiding this comment

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

MONO_TYPE_BOOLEAN -> byte_class normalization above looks suspect as well. I do not think regular CoreCLR does normalization like that anywhere.

Copy link
Member

@lambdageek lambdageek Jun 24, 2024

Choose a reason for hiding this comment

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

@jkotas I think the bool -> int8 fixup comes from when I misread I.8.7.2:

A location type T is compatible-with a location type U if and only if one of the following holds.

  1. T and U are not managed pointer types and T is compatible-with U according to the definition in §I.8.7.1.
  2. T and U are both managed pointer types and T is pointer-element-compatible-with U.
    A managed pointer type T is pointer-element-compatible-with a managed pointer type U if and
    only if T has verification type V and U has verification type W and V is identical to W.

The verification type of a bool is defined in I.8.7 as

  1. If the reduced type of T is:
    a. int8 or bool, then its verification type is int8.

The problem is I think I applied the verification type rules to unmanaged pointer types (ie bool*) rather than to managed pointer types (ie bool&)

@steveisok
Copy link
Member Author

Weird, local device runs are fine.

@steveisok
Copy link
Member Author

Appears there's some infra issues with the tvos and ios device legs. I validated system.runtime tests on a local device.

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] Incorrect cast_class for IntPtr[]

5 participants