[bitc-dev] Removing INNER_REF

Swaroop Sridhar swaroop at cs.jhu.edu
Wed Mar 5 14:32:12 EST 2008


Jonathan S. Shapiro wrote:
> A while back, I had Swaroop add an INNER-REF operator in BitC. Given a
> reference to a non-union aggregate, INNER-REF returns a pointer to some
> member field. The intended use case had to do with some peculiar storage
> allocators that used vectors of objects.

Precisely, the following are the allowed cases for inner-ref (`e's are
expressions and `L's are labels or literals):

* (inner-ref e:boxed-structure L_field-name)
    - returns (ref inner-field-type)

* (inner-ref e:(ref unboxed-structure) L_field-name)
    - returns (ref inner-field-type)

* (inner-ref e:(vector 'a) E_ndx)
    - returns (ref 'a)

* (inner-ref e:(ref (array 'a L_n)) E_index-value)
    - returns (ref 'a)

Even if inner-ref is removed, it will still be possible take
non-escapable references to individual elements of vectors (for for
example), by passing them by-reference to functions that expect
by-ref arguments.


Swaroop.


More information about the bitc-dev mailing list