gcj uses reflection for every INVOKEINTERFACE?
Bryce McKinlay
bryce@mckinlay.net.nz
Fri Feb 27 01:33:00 GMT 2004
On Feb 26, 2004, at 6:26 PM, Adam Megacz wrote:
>
> Hrm, I found this at the bottom of build_invokeinterface():
>
> return build (CALL_EXPR, ptr_type_node,
> build_address_of (soft_lookupinterfacemethod_node),
> lookup_arg, NULL_TREE);
>
> It looks like _Jv_LookupInterfaceMethodIdx() is getting called every
> time a method overriding an interface method is invoked... is this
> true?
Yes, but _Jv_LookupInterfaceMethodIdx doesn't actually use reflection,
but rather the "constant time" interface dispatch dispatch tables - so
the actual lookup is very efficient.
> Is there any way around this?
It would be possible to inline the itable lookup, thus avoiding the
call to _Jv_LookupInterfaceMethodIdx. I expect that would give a
moderate performance gain, but also possibly increase code size. It
would be an interesting experiment.
Regards
Bryce
More information about the Java
mailing list