<div dir="ltr">I fought and lost a massive argument spanning years about this.<br><div>There are very limited cases where the backend is able to do this successfully.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 26 October 2014 20:37, via D.gnu <span dir="ltr"><<a href="mailto:d.gnu@puremagic.com" target="_blank">d.gnu@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    
      
    
    <div><table border="1" cellspacing="0" cellpadding="8">
        <tbody><tr>
          <th>Bug ID</th>
          <td><a title="NEW - GDC unable to de-virtualise method calls" href="http://bugzilla.gdcproject.org/show_bug.cgi?id=162" target="_blank">162</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>GDC unable to de-virtualise method calls
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>GDC
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>development
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>gdc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td><a href="mailto:ibuclaw@gdcproject.org" target="_blank">ibuclaw@gdcproject.org</a>
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td><a href="mailto:ibuclaw@gdcproject.org" target="_blank">ibuclaw@gdcproject.org</a>
          </td>
        </tr></tbody></table>
      <p>
        </p><div>
        <pre>Currently we emit method calls as the following:

  *(c->__vptr + 40) (c, 1, 2, 3);

Which translate directly into the following trees:

  indirect_ref(pointer_plus(component_ref(c, __vptr), 40))


GCC provides a more simplistic tree code called obj_type_ref, which represents
a virtual method lookup, and given the binfo structure we already pass to the
backed, this would give a chance for the optimiser passes to statically
determine the dynamic type of the object and devirtualise the call.

  obj_type_ref(component_ref(c, __vptr), c, 40)</pre>
        </div>
      <p></p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are watching all bug changes.</li>
      </ul>
    </div>

</blockquote></div><br></div>