On 6/6/2013 11:27 AM, Walter Bright wrote:
On 6/6/2013 11:11 AM, deadalnix wrote:
It is also possible to automatically generate code like :
if (virtualMethod == givenMethod) {
     givenMethod();
} else {
     virtualMethod();
}

It sound like it is completely stupid, but in fact, as the compiler know the
call you'll do, it can run optimizations.

You're right, that is a valid optimization for virtual methods.

(Also, this is often done as a profile guided optimization, with givenMethod being the most often case.)

Reply via email to