<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 20, 2009, at 12:27 AM, Talin wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">What's the current status on support for first-class structs? The last I heard was:<div><ul><li>Structs which are smaller or equal to two pointers can be passed / returned / loaded / stored by value.</li><li>There are plans to expand this in the future to support arbitrary-sized structs as first class values. (Probably via some transformation pass the converts the return value into a hidden parameter.)</li>

</ul><div>First question - are those statements still true?</div></div></blockquote><div><br></div>Yes, I think so.  Also support is actually better than that, the sticking issue occurs when passing and returning large aggregates.  I think that improved recently but am not sure of the status.</div><div><br><blockquote type="cite"><div><div>The reason I am asking all of this is that I am starting to work on supporting tuple types in my language - and I'm trying to decide what is the best way to implement them. Since these are value types, not reference types, they need to be copied when passing to or returning from a function. The two approaches I am considering is (a) always pass them by reference internally, using a hidden parameter for the return value, and then have the receiver of the value copy it into an SSA value before use, and (b) for types <= 2 pointers, use SSA values only, and then pass larger types as in case (a). Of course, if support for large, first-class SSA values was finished, then I wouldn't have to care about any of these issues :)</div>

</div></blockquote></div><br><div>I'd pass them by value if they are small but by reference if they are large.  Passing large tuples by value isn't going to provide a win.</div><div><br></div><div>-Chris</div></body></html>