RFR: 8271627: Use local field access in favor of Class.getClassLoader0

Mandy Chung mchung at openjdk.java.net
Mon Aug 2 19:47:34 UTC 2021


On Mon, 2 Aug 2021 18:27:00 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> Trivial startup hack/cleanup to use the `classLoader` field directly rather than the `getClassLoader0` accessor. 
> 
> Before aa12c8fbf5b020d168cf29412643bf15514b0439 there was no `classLoader` field and `getClassLoader0` was a native method that retrieved the `ClassLoader` by calling into the runtime. However, now that `classLoader` is injected on mirror creation it makes less sense to use the accessor when not necessary.

This looks okay.    I assume you concern about the early startup when this method is running in interpreted mode.  Do you see any startup improvement by this change?

-------------

Marked as reviewed by mchung (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/4960


More information about the core-libs-dev mailing list