RFR: 8346781: [JVMCI] Limit ServiceLoader to class initializers [v2]
Doug Simon
dnsimon at openjdk.org
Mon Feb 17 16:12:41 UTC 2025
> In the context of libgraal, the current use of ServiceLoader in JVMCI is problematic as libgraal does all class loading at image build time. There are static fields such as `JVMCIServiceLocator.cachedLocators` that need to be initialized [via reflection](https://github.com/oracle/graal/blob/30492c3f7847a13ae7f8dc50663a5a039e49a8e7/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/BuildTime.java#L175-L180) when building libgraal.
>
> This PR removes the need for such reflection by moving all use of ServiceLoader in JVMCI into `<clinit>` methods. These methods are executed when building libgraal. It also removes a few other public methods and fields that are no longer used by Graal. Given that JVMCI is still experimental and only has qualified exports to Graal, I don't think this needs a CSR.
Doug Simon has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
- Merge remote-tracking branch 'openjdk-jdk/master' into JDK-8346781
- remove non-native-image build time use of ServiceLoader
- make Cleaner.clean public
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/22869/files
- new: https://git.openjdk.org/jdk/pull/22869/files/24bb39be..7c91d00c
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=22869&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=22869&range=00-01
Stats: 212534 lines in 5089 files changed: 102007 ins; 88290 del; 22237 mod
Patch: https://git.openjdk.org/jdk/pull/22869.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22869/head:pull/22869
PR: https://git.openjdk.org/jdk/pull/22869
More information about the hotspot-compiler-dev
mailing list