This is the mail archive of the java-patches@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]

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



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