This is the mail archive of the java-discuss@sourceware.cygnus.com 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]

Re: Patches for faster interface dispatch, type checking


>>>>> "Bryce" == Bryce McKinlay <bryce@albatross.co.nz> writes:

Bryce> inline void *
Bryce> _Jv_LookupInterfaceMethod0 (jclass klass, jclass iface, int method_idx)
Bryce> {
Bryce>   _Jv_IDispatchTable *cldt = klass->idt;
Bryce>   int idx = iface->idt->iface.ioffsets[cldt->cls.iindex] + method_idx;
Bryce>   void *ncode = cldt->cls.itable[idx];
Bryce>   if (!ncode)
Bryce>     JvThrow (new java::lang::NoSuchMethodError
Bryce>       (_Jv_GetMethodString (klass, iface->methods[method_idx].name)));
Bryce>   return ncode;
Bryce> }

Bryce> So, we'd take a hit of about 25% doing it by-the-book. The
Bryce> method also maybe becomes too long to realistically inline in
Bryce> most cases.

You don't have to do an extra check.  Instead, when constructing the
table, point missing entries to a function which just throws
the exception.

T

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