RFR: 8337548: Parallel class loading can pass pass is_superclass true for interfaces [v2]
Coleen Phillimore
coleenp at openjdk.org
Tue Jan 28 18:22:28 UTC 2025
> There's an optimization in class loading that looks up class being loaded while loading its superclass, and if the class is found, it will check the superclass name against klass->_super and match class loaders. It's supposed to be a optimization to short circuit taking out the LOAD_SUPER (now called DETECT_CIRCULARITY) placeholder for the class being loaded. So for example, loading class C, super S, we take out a DETECT_CIRCULARITY placeholder for C to detect if S then tries to load C as a super class by the same thread.
>
> This optimization is almost never done because it requires just the right timing for a parallel thread to load the class right before this thread reaches the if statement (perhaps some long stall). The only case where this code is reached normally is for redefinition. Loading a new class file version will find the class in the System Dictionary because we can only redefine already loaded classes.
>
> It should be harmess to remove this if-statement in the case of redefinition also, but I think having a placeholder created for a known already-loaded class seems to break an understanding of how this works. So I opted to just add to the comment and restructure the method a little bit. The dictionary->find_class() call doesn't need to be inside the SystemDictionary_lock.
>
> Tested with tier1-4 and internal parallel class loading tests.
Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
Pass false to check_is_superclass on further thought.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/23322/files
- new: https://git.openjdk.org/jdk/pull/23322/files/865b6081..c24be22b
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=23322&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=23322&range=00-01
Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/23322.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23322/head:pull/23322
PR: https://git.openjdk.org/jdk/pull/23322
More information about the hotspot-runtime-dev
mailing list