C2: multiple slices for flattened value type arrays
rwestrel at redhat.com
Tue Jan 10 14:23:29 UTC 2017
This patch has a couple small improvements on top of Tobias' change to
support flattened value type arrays: 1) it changes the type of flattened
value type arrays from array of pointers to value types to array of
value types 2) it tweaks alias analysis so each field of the value type
element has its own slice.
To achieve 2), TypeAryPtr now keeps track of a field_offset, the offset
within the value type for the field being accessed.
The change is big because I decided to introduce an Offset class to
manipulates the 2 cases where we have an offset in the types (offset
from a pointer: TypePtr::_offset and field offset in arrays:
TypeAryPtr::_field_offset). This avoids some code duplication but
mainly, this helps getting calls to type factory methods and
constructors right: type factory methods and constructors have so many
arguments, many of the same types or types that the c++ compiler can
implicit cast between that it's very easy to call a factory method and
pass a boolean where an int is expected and have no compiled time error.
More information about the valhalla-dev