RFR: 8271627: Use local field access in favor of Class.getClassLoader0
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. ------------- Commit messages: - Merge branch 'master' into startup_classLoader0 - Avoid getClassLoader0 calls from within Class - Reuse SecurityConstants.ACCESS_PERMISSION from MethodHandles Changes: https://git.openjdk.java.net/jdk/pull/4960/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4960&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8271627 Stats: 10 lines in 1 file changed: 0 ins; 0 del; 10 mod Patch: https://git.openjdk.java.net/jdk/pull/4960.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/4960/head:pull/4960 PR: https://git.openjdk.java.net/jdk/pull/4960
On Mon, 2 Aug 2021 18:27:00 GMT, Claes Redestad <redestad@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
On Mon, 2 Aug 2021 19:44:22 GMT, Mandy Chung <mchung@openjdk.org> wrote:
Do you see any startup improvement by this change?
Very tiny, ~90 calls on bootstrap.
This looks okay.
Thanks!
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?
Yes. Many of these things that will be executed only when loading and bootstrapping, so might be interpreted for most of a JVM lifecycle. Right off the bat see a thousand or so less bytecode get executed on a hello world with this patch. ------------- PR: https://git.openjdk.java.net/jdk/pull/4960
On Mon, 2 Aug 2021 18:27:00 GMT, Claes Redestad <redestad@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 pull request has now been integrated. Changeset: e621cffa Author: Claes Redestad <redestad@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/e621cffa4fee0b403a8650519c70e0a6cb76... Stats: 10 lines in 1 file changed: 0 ins; 0 del; 10 mod 8271627: Use local field access in favor of Class.getClassLoader0 Reviewed-by: mchung ------------- PR: https://git.openjdk.java.net/jdk/pull/4960
participants (2)
-
Claes Redestad
-
Mandy Chung