<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Oct 27, 2013 at 11:11 AM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2013/10/26 Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>>:<br>
<div class="im">>   I think we should have ABI-specific thunks, something like MSThunkInfo, MSThisAdjustment, MSReturnAdjustment.  With the change you've written here, CGVTables will no longer access fields of ThunkInfo, instead it will pass them through to the ABI code.<br>

><br>
>   However, splitting apart the uses of ThunkInfoVectorTy + ThunkMapTy seems hard.  What do you think?  Is it worth spending a few hours on it to see if it can be done?<br>
><br>
>   I probably wouldn't go so far as to add support for cast<> to these, because it would require space in ThunkInfo, and we allocate these things in arrays.<br>
<br>
</div>I'm concerned about ThunkInfos being passed in arrays around.<br>
<br>
Fixing EmitThunks() (line 450) doesn't look hard.<br>
There's also CreateVTableInitializer() which takes<br>
VTableLayout::VTableThunkTy, which is an array of pair<index,<br>
ThunkInfo>.<br>
<br>
The codegen for thunks is very similar in both ABIs we support, other<br>
than applying the vbase offset, so I'm not sure we want to make<br>
different codegen codepaths for different ABIs. Yet we want the<br>
ThunkInfos we pass around to hold ABI-specific data... We can probably<br>
store ThunkInfo* in the vectors, but that'd require storing the<br>
ThunkInfo-derived objects in some ABI-specific storage which<br>
guarantees not to move around. That sounds like a not-very-small<br>
change.<br>
And I do believe we'll want casts<> there, be it static_cast or<br>
[dyn_]cast<>, the latter being less error-prone.<br>
<br>
What do you think?<br>
</blockquote><div><br></div><div>I changed my mind, I don't think it's worth it.  The union seems fine. <br></div></div></div></div>