FYI: Patch: Make Method.invoke() and JNI_CallAnyMethod use vtables
Bryce McKinlay
bryce@mckinlay.net.nz
Sun Oct 26 02:17:00 GMT 2003
This patch improves Method.invoke() and JNI by having them dispatch via
the vtable instead of doing runtime lookups via
_Jv_LookupDeclaredMethod. This makes Method.invoke() about 25% faster
for a simple virtual call test with no arguments, and probably a lot
more than that in cases where the target class has a lot of methods or
complex inheritance. It should also fix potential bugs, eg a virtual
call to a package-private method that hides a similar declaration in
its superclass. No "make check" regressions.
My tests show we're now only slightly slower than the JRE for a
no-argument, public Method.invoke() call, but are 3-4X slower when
arguments are involved. Incidentally, JNI calls seem to be at least 10X
slower than the JRE (for java->native calls, which this patch doesn't
effect). I imagine that speeding JNI up would help SWT and AWT
significantly.
Regards
Bryce
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: invoke.patch.txt
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20031026/7b7ff354/attachment.txt>
-------------- next part --------------
More information about the Java-patches
mailing list