Hi Claes,

My only nit with this is that I don't think register_native and friends belongs in the SystemDictionary class as it has nothing to do with the SD. This code seems to be all about Methods so that seems like the place to put this.

Thanks,
David

On 22/10/2019 12:55 am, Claes Redestad wrote:
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

Reply via email to