RFR 6642881: Improve performance of Class.getClassLoader()

Alan Bateman Alan.Bateman at oracle.com
Mon Jun 16 18:06:21 UTC 2014


On 16/06/2014 16:42, Coleen Phillimore wrote:
> Summary: Add classLoader to java/lang/Class instance for fast access
>
> In order to improve performance of Class.getClassLoader() in a way to 
> allow the compilers to automatically optimize this call, I added the 
> classLoader to the instance of java/lang/Class.  For microbenchmarks, 
> this results in a 98% improvement, which was expected.  For Oracle 
> internal applications, this results in a 10-12% improvement on 
> solaris/sparc.   The increase in size of java/lang/Class can be offset 
> by other changes (removing constant pool lock, or removing signers).
>
> See bug link https://bugs.openjdk.java.net/browse/JDK-6642881 and 
> associated linked bugs for more details.
>
> open webrev at http://cr.openjdk.java.net/~coleenp/6642881_hotspot/
> open webrev at http://cr.openjdk.java.net/~coleenp/6642881_jdk/
>
> There is both hotspot and jdk changes for this change.  The hotspot 
> changes can work without the jdk changes (check for optional field), 
> but not vice-versa.  I'll file another bug (and compatibility request) 
> to remove JVM_GetClassLoader from hotspot.
>
The jdk changes look okay to me. One thing that I mentioned to Coleen 
off-list is that we have some dead code in the old verifier that uses 
JVM_GetClassLoader - I don't know the history to that but it should be 
checked and probably removed.

-Alan


More information about the jdk9-dev mailing list