RFR: 8231895: Avoid String allocations in JVM_FindLoadedClass

Claes Redestad claes.redestad at oracle.com
Sat Oct 5 22:50:52 UTC 2019


Hi,

JVM_FindLoadedClass allocates a java String from JVM code to transform
class names from external to internal representation (java.lang.Class ->
java/lang/Class). This is both inefficient and redundant since we'll
directly transform it to a utf-8 char* and then ignore the newly created
String.

Instead we should mutate the C string. There's a small improvement in
a targeted microbenchmark (order of 100ns/op, see bug for details),
although effect on most applications is likely to be in the noise.

Webrev: http://cr.openjdk.java.net/~redestad/8231895/open.00/
Bug:    https://bugs.openjdk.java.net/browse/JDK-8231895

Testing: tier1-3

Thanks!

/Claes


More information about the hotspot-runtime-dev mailing list