On Wed, Jun 02, 2010 at 06:52:11PM +0100, Richard Earnshaw wrote: > > Currently targetm is a struct with function pointers, so calling > > targetm.hook_xyz (); > > means reading a pointer from &targetm + off, then calling it. > > If you make it a class with virtual functions and targetm > > would be an object of that class, then > > targetm.hook_xyz (); > > call means reading pointer from &targetm (the vtable pointer), followed > > by reading the function pointer from the virtual table, then calling it. > > One extra memory read for hook call. > > A missing virtual hook would be a build failure, rather than a runtime > error. So the advantage is easier maintenance.
All the target hooks have defaults, so what means a missing virtual hook? And, how often are target hooks changed compared to how often target hooks are called during compilation? Jakub