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
The emitter for FieldRVA data used in Reflection.Emit does not 8 byte align field RVA fields when the data may have 8 byte alignment requiring data. This interferes with compatibility with the CreateSpan<T> feature. See #60948.
Reproduction Steps
Use reflection emit to allocate RVA static fields. They will not be 8 byte aligned.
In support of CreateSpan (#60948), improve alignment for RVA static pre-initialized fields to align memory blocks which may contain long, ulong, or double primitive arrays on 8 byte boundaries.
Mono fix is more involved
- Fix Ref-Emit generated RVA statics
- Set the HasFieldRVA bit. NOTE: earlier code that attempts to set the bit doesn't actually do that as the FieldRVA bit is in FieldAttributes.ReservedMask which is masked away in the FieldBuilder constructor
- Fix the Swizzle lookup. We should not be using the 8 byte swizzle in the final else clause.
- Enhance ref-emitted field to allow for use with CreateSpan
- Ref-emitted fields should specify a pack size appropriate for minimum alignment of the CreateSpan targetted data
- Respect the packing_size specified so that RVA static fields generated for CreateSpan can be properly aligned
Fixes#62314
ghost
removed
the
in-pr
There is an active PR which will close this issue when it is merged
label
Jan 27, 2022
ghost
locked as resolved and limited conversation to collaborators
Feb 27, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
The emitter for FieldRVA data used in Reflection.Emit does not 8 byte align field RVA fields when the data may have 8 byte alignment requiring data. This interferes with compatibility with the
CreateSpan<T>
feature. See #60948.Reproduction Steps
Use reflection emit to allocate RVA static fields. They will not be 8 byte aligned.
See
runtime/src/coreclr/vm/commodule.cpp
Line 509 in c87e932
where the data is DWORD aligned (4 bytes), not ever 8 byte aligned.
Expected behavior
If the data potentially contains an 8 byte sized value, the data should be 8 byte aligned.
Actual behavior
The data will only be 4 byte aligned as only 4 byte alignment is requested o fthe ICeeGenInternal api.
Regression?
No
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: