call to __Value methods can't pass fields as arguments

Roland Westrelin rwestrel at
Fri Mar 24 15:28:59 UTC 2017

> Cannot we use T_VALUETYPE instead of T_OBJECT?

That list already includes T_VALUETYPE elements for another
purpose. collect_fields() has a comment that explains why.

// Value type arguments are not passed by reference, instead each
// field of the value type is passed as an argument. This helper
// function collects the fields of the value types (including embedded
// value type's fields) in a list. Included with the field's type is
// the offset of each field in the value type: i2c and c2i adapters
// need that to load or store fields. Finally, the list of fields is
// sorted in order of increasing offsets: the adapters and the
// compiled code need and agreed upon order of fields.
// The list of basic types that is returned starts with a T_VALUETYPE
// and ends with an extra T_VOID. T_VALUETYPE/T_VOID are used as
// delimiters. Every entry between the two is a field of the value
// type. If there's an embedded value type in the list, it also starts
// with a T_VALUETYPE and ends with a T_VOID. This is so we can
// generate a unique fingerprint for the method's adapters and we can
// generate the list of basic types from the interpreter point of view
// (value types passed as reference: iterate on the list until a
// T_VALUETYPE, drop everything until and including the closing
// T_VOID) or the compiler point of view (each field of the value
// types is an argument: drop all T_VALUETYPE/T_VOID from the list).


More information about the valhalla-dev mailing list