-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
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).
-
reffields inrefstructs. Consume Roslyn withreffields support #71498
For Mono due to conservative stack scanning, it is likely that the only additional work forreffields is to verify that we don't rejectreffields during loading and class initialization. -
safe fixed size buffers
(This is in flux pending the outcome of the[API Proposal]: InlineArrayAttribute #61135FixSizedBufferAttributeproposal Expose an attribute to allow sizing a fixed sized buffer based on type and element count. #12320).
The approach withInlineArrayAttributeis 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 theFixedBufferAttributeon 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)