Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 162 - GDC unable to de-virtualise method calls
Summary: GDC unable to de-virtualise method calls
Status: NEW
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: development
Hardware: All All
: --- enhancement
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2014-10-26 10:37 CET by Iain Buclaw
Modified: 2014-10-26 10:37 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Iain Buclaw 2014-10-26 10:37:29 CET
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)