[mono] Disable gsharing when Unsafe.ReadUnaligned/WriteUnaligned () i…#89417
[mono] Disable gsharing when Unsafe.ReadUnaligned/WriteUnaligned () i…#89417lewing merged 1 commit intodotnet:mainfrom
Conversation
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…s used with generic structures. Fixes dotnet#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.
|
/azp run runtime-wasm |
|
No commit pushedDate could be found for PR 89417 in repo dotnet/runtime |
|
/azp run runtime-wasm |
|
No commit pushedDate could be found for PR 89417 in repo dotnet/runtime |
|
/azp run runtime-wasm |
|
No commit pushedDate could be found for PR 89417 in repo dotnet/runtime |
|
/azp run runtime-wasm |
1 similar comment
|
/azp run runtime-wasm |
|
No commit pushedDate could be found for PR 89417 in repo dotnet/runtime |
1 similar comment
|
No commit pushedDate could be found for PR 89417 in repo dotnet/runtime |
|
Should this be in method-to-ir? this |
lambdageek
left a comment
There was a problem hiding this comment.
@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.
…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.