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
* Fix fields alignment
Fixes#115363
The problem happened in MethodTableBuilder::PlaceInstanceFields where in wasm case
the fields were placed at wrong offsets.
The native representation looks like this:
```
class field wasm type offset
-----------------------------------------------------------------------------------------------
Object
PTR_MethodTable m_pMethTab i32 0
AssemblyLoadContextBaseObject
int64_t _id i64 8
OBJECTREF _unloadLock i32 12
OBJECTREF _resolvingUnmanagedDll i32
OBJECTREF _resolving i32
OBJECTREF _unloading i32
OBJECTREF _name i32
INT_PTR _nativeAssemblyLoadContext i32
DWORD _state i32 40
CLR_BOOL _isCollectible i8 44
```
While the managed field offsets were calculated wrong, the _id was
placed at offset 4 and thus all the following fields were at wrong
offsets too. The size check then failed.
By enabling FEATURE_64BIT_ALIGNMENT the dwOffsetBias is set to
TARGET_POINTER_SIZE and the fields layout is calculated properly.
The 8 bytes types in wasm should be aligned to 8 bytes
https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md#data-representation
so hopefully the rest of the changes enabled by this feature should
apply as well. Before this feature was enabled only for arm 32bits.
* Update conditions to use TARGET_WASM
* Apply suggestions from code review
* Apply suggestions from code review
---------
Co-authored-by: Jan Kotas <[email protected]>
0 commit comments