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 C# low-level struct feature support #48113

Closed
2 tasks done
lambdageek opened this issue Feb 10, 2021 · 2 comments
Closed
2 tasks done

Mono C# low-level struct feature support #48113

lambdageek opened this issue Feb 10, 2021 · 2 comments
Labels
area-VM-meta-mono tracking This issue is tracking the completion of other related issues.
Milestone

Comments

@lambdageek
Copy link
Member

lambdageek commented Feb 10, 2021

See #46104. Basically there are two new C#1language features that we need to support. ref fields in ref structs, and fixed size buffers of any type. (See C# and CoreCLR issues in the linked issue).

  • ref fields in ref structs. Consume Roslyn with ref fields support #71498
    For Mono due to conservative stack scanning, it is likely that the only additional work for ref fields is to verify that we don't reject ref fields during loading and class initialization.

  • safe fixed size buffers (This is in flux pending the outcome of the FixSizedBufferAttribute proposal Expose an attribute to allow sizing a fixed sized buffer based on type and element count. #12320). [API Proposal]: InlineArrayAttribute #61135
    The approach with InlineArrayAttribute is to modify the struct layout algorithm to adjust the inferred size of a single-field struct to contain space for N extra copies of the field. Also the GC descriptor will need to be array-like.
    The rest is based on the proposed translation in https://github.com/dotnet/csharplang/blob/master/proposals/fixed-sized-buffers.md
    The proposed translation relies on creating a generic struct type with potentially thousands of fields.
    ~ - [ ] First cut at support: Just verify that class layout and initialization don't perform pathologically on such giant declarations.~
    ~ - [ ] Second cut at support: Look for the FixedBufferAttribute on the field declaration and synthesize the class layout for the defining class without initializing the underlying thousand-field struct.~
    - [ ] Stretch goal: Ideally also compile the indexer in the struct without doing class layout. (This is hard)

@lambdageek lambdageek added area-VM-meta-mono tracking This issue is tracking the completion of other related issues. labels Feb 10, 2021
@ghost
Copy link

ghost commented Feb 10, 2021

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

Issue Details

See #46014. Basically there are two new C#10 language features tht we need to support. ref fields in ref structs, and fixed size buffers of any type. (See C# and CoreCLR issues in the linked issue).

  • ref fields in ref structs.
    For Mono due to conservative stack scanning, it is likely that the only additional work for ref fields is to verify that we don't reject ref fields during loading and class initialization.

  • safe fixed size buffers
    The proposed translation relies on creating a generic struct type with potentially thousands of fields.

    • First cut at support: Just verify that class layout and initialization don't perform pathologically on such giant declarations.
    • Second cut at support: Look for the FixedBufferAttribute on the field declaration and synthesize the class layout for the defining class without initializing the underlying thousand-field struct.
    • Ideally also compile the indexer in the struct without doing class layout. (This is hard)
Author: lambdageek
Assignees: -
Labels:

area-VM-meta-mono, tracking

Milestone: -

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Feb 10, 2021
@lambdageek lambdageek added this to the 6.0.0 milestone Feb 10, 2021
@lambdageek lambdageek removed the untriaged New issue has not been triaged by the area owner label Feb 10, 2021
@lambdageek lambdageek self-assigned this Feb 10, 2021
@lambdageek lambdageek changed the title Mono low-level struct feature support Mono C# low-level struct feature support Feb 10, 2021
@lambdageek lambdageek modified the milestones: 6.0.0, 7.0.0 Jun 9, 2021
@lambdageek lambdageek modified the milestones: 7.0.0, 8.0.0 Jul 5, 2022
@lambdageek lambdageek removed their assignment Jul 5, 2022
@lambdageek
Copy link
Member Author

.NET 8 work continues in #80798

@ghost ghost locked as resolved and limited conversation to collaborators Feb 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-VM-meta-mono tracking This issue is tracking the completion of other related issues.
Projects
None yet
Development

No branches or pull requests

1 participant