Fix struct padding issues with SysV struct classification.
authorPat Gavlin <pagavlin@microsoft.com>
Fri, 6 Nov 2015 19:15:29 +0000 (11:15 -0800)
committerPat Gavlin <pagavlin@microsoft.com>
Wed, 18 Nov 2015 18:42:21 +0000 (10:42 -0800)
commit89da20944fc507a7d7fe4c05b4d1bf101fd93ac1
tree4f566f0cd99b3c46fbc1f8566d1ff7115991bd72
parentdaa24b15ea785252397bf105a6788d01b7fb936e
Fix struct padding issues with SysV struct classification.

This change revises the handling of padding bytes between struct fields
and bytes that trail the last field in a struct. These changes address
problems with structs that contain > 8 bytes between fields as well as
C# fixed arrays (which are emitted as a struct with a single field of
the fixed array element type and an explicit size derived from the
number of elements and the size of the element type).

The classification given to a particular byte that is not part of a
formal field depends on whether that byte is between fields or
trails the final field in a struct. Bytes in the former category--
padding bytes--are classified as NO_CLASS as per the SysV ABI spec.
Bytes in the latter category--"leftover" bytes after the final
field of a struct--are assigned the classification of the final
field in the struct. This allows C# fixed-size arrays to work
properly, as their representative structs are logically (but
unfortunately not physically) structs with element-count fields of
the element type. Were they explicit, each of these fields would
have the same classification.
src/vm/methodtable.cpp
src/vm/methodtable.h