On 4/10/2013 4:00 AM, Manu wrote:
It doesn't have all sources. It could load a library. That can never be 
guaranteed.

Currently, a virtual call is done with:

   (*vtbl[i])(args...)

It makes me wonder if the following would be faster:

   method_fp = vtbl[i];
   if (method_fp == &method)
       method(args...)
   else
       (*method_fp)(args...)

Anyone care to dummy this up and run a benchmark?

It's also possible to, for the per-class static data, have a flag that says "isfinal", which is set to false at runtime whenever a new is done for a derived class. Then, the method test above becomes:

    if (isfinal)

Reply via email to