On Tue, 12 Nov 2024 16:00:39 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:
> See the bug for more discussion and reproducer. This PR replaces the ad-hoc > linked list with the `ArrayList` wrapper that manages synchronization, search > and replacements efficiently. Arrays are easy targets for GC. There are > possible improvements here, most glaring is parallelism that is currently > knee-capped by global synchronization. The synchronization scheme follows > what we have in original code, and I think it is safer to continue with it > right now. > > I'll put performance data in a separate comment. > > Additional testing: > - [x] Original reproducer improves drastically > - [x] New microbenchmark shows no regression on "churning" tests, which > covers insertion/removal perf > - [x] New microbenchmark shows improvement on Full GC times (crude, but > repeatable), serves as a proxy for reproducer > - [x] `java/lang/ref` tests in release > - [ ] `all` tests in fastdebug Changes requested by bchristi (Reviewer). src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java line 300: > 298: return true; > 299: } > 300: } It looks like the new `PhantomCleanableList.remove()` puts 100% trust in the correctness of the PhantomCleanable's `index`. What would you think of adding some sort of check/assert that `list.get(phc.index) == phc` ? ------------- PR Review: https://git.openjdk.org/jdk/pull/22043#pullrequestreview-2431221723 PR Review Comment: https://git.openjdk.org/jdk/pull/22043#discussion_r1839073366