This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: Make Method.invoke() and JNI_CallAnyMethod use vtables
- From: Bryce McKinlay <bryce at mckinlay dot net dot nz>
- To: GCC libjava patches <java-patches at gcc dot gnu dot org>
- Date: Sun, 26 Oct 2003 15:08:25 +1300
- Subject: FYI: Patch: Make Method.invoke() and JNI_CallAnyMethod use vtables
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
Attachment:
invoke.patch.txt
Description: Text document