You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And an instance Write<GStruct<string>>, generic sharing will create a Write<T_INST> instance where T_INST is constrained to GStruct<T_REF>. The JIT currently calls mini_get_underlying_type () in many places which transform T_INST into GStruct<T_REF>.
This causes problems at runtime in the generic sharing code, which expects to find T_INST.
I.e. inflate_info () can inflate T_INST to GStruct<string>, but it can't inflate GStruct<T_REF> to GStruct<string>.
As a workaround, disable gsharing in (some) of these cases.
…s used with generic structures.
Fixesdotnet#89398.
For a method like
```
static void Write<T>(ref byte b, T value) => Unsafe.WriteUnaligned<T>(ref b, value);
```
And an instance ```Write<GStruct<string>>```, generic sharing will create a ```Write<T_INST>```
instance where T_INST is constrained to GStruct<T_REF>. The JIT currently calls
```mini_get_underlying_type ()``` in many places which transform T_INST into GStruct<T_REF>.
This causes problems at runtime in the generic sharing code, which expects to find T_INST.
I.e. ```inflate_info ()``` can inflate ```T_INST``` to ```GStruct<string>```, but it can't inflate
```GStruct<T_REF>``` to ```GStruct<string>```.
As a workaround, disable gsharing in (some) of these cases.
Is this going to disable sharing for every generic method that has a Span<T> argument? nevermind, I thought this was in method-to-ir, but it's just intrinsics.
Should this be in method-to-ir? this mini_get_underlying_type issue seems like it would show up in other places, too
The reason will be displayed to describe this comment to others. Learn more.
@vargaz can you make a GH Issue about the general problem. If we get this kind of crash in other situations, it would be good to have something that explains what is happening.
ghost
locked as resolved and limited conversation to collaborators
Aug 25, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…s used with generic structures.
Fixes#89398.
For a method like
And an instance
Write<GStruct<string>>, generic sharing will create aWrite<T_INST>instance where T_INST is constrained to GStruct<T_REF>. The JIT currently callsmini_get_underlying_type ()in many places which transform T_INST into GStruct<T_REF>.This causes problems at runtime in the generic sharing code, which expects to find T_INST.
I.e.
inflate_info ()can inflateT_INSTtoGStruct<string>, but it can't inflateGStruct<T_REF>toGStruct<string>.As a workaround, disable gsharing in (some) of these cases.