Experiences using GCJ as an embedded compiler
Jon Olson
olson@mmsi.com
Mon Mar 29 22:10:00 GMT 1999
> Well, this is just LOOKUP_INTERFACE, and that is simple enough that
> it can and probably should be inlined.
> > Since most classes don't implement
> > very many interfaces (few more than 2 as your statistics show),
> > even a linear scan through the implemented interfaces would be fast.
> But there is still the overhead of a subroutine call, a loop, and
> some comparisons. Just doing some indirect lookups is much better.
Just tested an example of the LOOKUP_INTERFACE expansion. Assuming
a constant METHODINDEX and `cl' and `iface' in registers, it
compiles to the following lengths on various microprocessors:
#define LOOKUP_INTERFACE(CL, IFACE, IMETHODINDEX) \
(CLASS_ITABLE(CL)[CLASS_IMAP(IFACE)[CLASS_IINDEX(cl)]][IMETHODINDEX])
ARM 7 instructions
29K 12 instructions
SuperH 11 instructions
X86 9 instructions
sparc 8 instructions
Pretty good for an interface call! Definitely a candidate for
inlining, but I'd still like the ability for the compiler to generate
subroutine calls for debugging, interfaces with different runtime
implementations, and when optimizing for size.
--
Jon Olson, Modular Mining Systems
3289 E. Hemisphere Loop
Tucson, AZ 85706
INTERNET: olson@mmsi.com
PHONE: (520)746-9127
FAX: (520)889-5790
More information about the Java
mailing list