RFR: 8232613: Move Object.registerNatives into HotSpot
Claes Redestad
claes.redestad at oracle.com
Mon Oct 21 14:55:43 UTC 2019
Hi,
Object.java currently registers various native functions via the
registerNatives facility.
private static native void registerNatives();
static {
registerNatives();
}
Not costly in and off itself, but this has the side effect that these
two methods are taken into account every time the VM has to generate
default methods and overpasses for some class during class load, which
can take up substantial time. When prototyping JDK-8219713[1],
explicitly excluding these two methods showed some improvement to
default method generation, but adding special cases to the logic was
decided against.
If we instead can get rid of the Object <clinit> and the registerNatives
altogether we get the same (or a slightly better) speedup. This
effectively reduces memory use and instructions retired doing default
method generation by 3-5%.
Webrev: http://cr.openjdk.java.net/~redestad/8232613/open.00/
Bug: https://bugs.openjdk.java.net/browse/JDK-8232613
Testing:
- tier1-7
- Added a test which naively redefines Object and ensures native methods
keep working
Thanks!
/Claes
More information about the hotspot-runtime-dev
mailing list