Will Java go native?
Dmitry Leskov
dleskov at excelsior-usa.com
Sun Sep 22 23:53:22 PDT 2013
On Friday, 20 September 2013 at 07:19:44 UTC, deadalnix wrote:
> On Friday, 20 September 2013 at 05:31:09 UTC, Dmitry Leskov
> wrote:
>> Our AOT compiler does inline virtual calls of non-final
>> methods that are not overloaded in any subclass known at
>> compile time. Of course, there is a runtime check and a backup
>> virtual call, but the check is cheap and code size increase in
>> negligible.
>>
>> What we don't do (yet) is profile-guided optimizations, but
>> that is on our to-do list.
>>
>
> So basically what you do is :
>
> funptr = load from vtbl;
> if (funptr == compile_time_known_value) {
> compile_time_known_value();
> } else {
> funptr();
> }
>
> Which avoid the indirection if the function is actually called
> most of the time. Am I right ?
Almost:
funptr = load from vtbl;
if (funptr == compile_time_known_value) {
// Inlined body of compile_time_known_value() goes here
} else {
funptr();
}
More information about the Digitalmars-d
mailing list