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] Issues with handling nested generic structures during generic sharing #89613

Open
vargaz opened this issue Jul 28, 2023 · 0 comments
Open

Comments

@vargaz
Copy link
Contributor

vargaz commented Jul 28, 2023

Description

Currently, the mono generic sharing code has issues with nested structures.

Example:

static void Write<T>(ref byte b, T value) => Unsafe.WriteUnaligned<T>(ref b, value);

If we try to aot an instance like Write<AStruct<string>>, the generic sharing code will aot Write<T_STRUCT>,
there T_STRUCT is a synthetic generic parameter constrained to AStruct<T_REF> where T_REF is a similar parameter constrained to reference types.

Problems can arise if the JIT replaces T_STRUCT with AStruct<T_REF> during JITing, which is done for example by mini_get_underlying_type (). The generic sharing runtime code will expand T_STRUCT to AStruct<string>, but it will not do the same for AStruct<T_REF> leading to problems.
The current workaround is to disable generic sharing, i.e. by setting cfg->prefer_instances.

Re: #89417

Reproduction Steps

.

Expected behavior

.

Actual behavior

.

Regression?

No.

Known Workarounds

.

Configuration

dotnet/runtime master

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 28, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jul 28, 2023
@vargaz vargaz added this to the 9.0.0 milestone Jul 28, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jul 28, 2023
@vargaz vargaz added untriaged New issue has not been triaged by the area owner area-Codegen-AOT-mono and removed untriaged New issue has not been triaged by the area owner labels Jul 28, 2023
@vcsjones vcsjones removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 30, 2023
@steveisok steveisok modified the milestones: 9.0.0, Future Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants