RFR: 8242452: During module definition, move conversion of packages from native to VM
harold.seigel at oracle.com
Fri Apr 17 13:32:09 UTC 2020
The change looks good. Just a couple of minor things.
In JavaClasses.cpp, line 652, does length need to be initialized to zero?
The indentation looks wrong at line 658.
The changes in modules.cpp look good! Maybe as_symbol() could
eventually be moved to symbolTable.hpp.
Very minor typos in modules.hpp ("to to").
I don't need to see another webrev.
One change that we looked at but did not do is to have one call from the
JDK to the JVM to, for example, add all of a module's qualified
exports. Currently, each export is a separate call from the JDK to the
VM. I'm not sure if this is worth doing.
On 4/13/2020 3:22 PM, Claes Redestad wrote:
> during JDK 9 development we ended up converting package name Strings
> from external to internal form in the JNI layer rather than in Java - a
> reasonable optimization at the time.
> In light of recent startup optimization work, profiles now show clearly
> that we still have some overhead here. Partly due calling many times
> over into the VM from JNI. Moving the conversion completely into VM we
> reduce overhead of Module.defineModule0, with a measurable effect
> on bootstrap overhead.
> Patch: http://cr.openjdk.java.net/~redestad/8242452/open.00/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8242452
> Testing: tier1-6, complete headless run of JCK 15-b04 locally
> The patch includes a few enhancement to internal utilities, e.g., an
> as_utf8_string variant which allows (re-)using a provided char buffer if
> it's sufficiently sized, but which does not truncate the converted
> string if the buffer is too small. I'm open to splitting that out into a
> standalone RFE if preferable.
>  https://bugs.openjdk.java.net/browse/JDK-8171855
> perf stat -r 250 java HelloWorld
> 103,884,846 instructions # 0.81 insns per cycle ( +- 0.07% )
> 20,470,109 branches # 419.732 M/sec ( +- 0.07% )
> 740,708 branch-misses # 3.62% of all branches ( +- 0.14% )
> 0.033977482 seconds time elapsed ( +- 0.23% )
> 102,459,412 instructions # 0.80 insns per cycle ( +- 0.08% )
> 20,192,923 branches # 416.229 M/sec ( +- 0.08% )
> 733,137 branch-misses # 3.63% of all branches ( +- 0.13% )
> 0.033858386 seconds time elapsed ( +- 0.32% )
More information about the hotspot-runtime-dev