This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcj uses reflection for every INVOKEINTERFACE?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]