RFR: 8333334: C2: Make result of `Node::dominates` more precise to enhance scalar replacement [v9]
Qizheng Xing
qxing at openjdk.org
Thu Aug 22 09:40:22 UTC 2024
> This patch changes the algorithm of `Node::dominates` to make the result more precise, and allows the iterators of `ConcurrentHashMap` to be scalar replaced.
>
> The previous algorithm will return a conservative result when encountering a dead control flow, and only try the first two input paths of a multi-input Region node, which may prevent the scalar replacement in some cases.
>
> For example, with G1 GC enabled, C2 generates GC barriers for `ConcurrentHashMap` iteration operations at some early phases, and then eliminates them in a later IGVN, but `LoadNode` is also idealized in the same IGVN. This causes `LoadNode::Ideal` to see some dead barrier control flows, and refuse to split some instance field loads through Phi due to the conservative result of `Node::dominates`, and thus the scalar replacement can not be applied to iterators in the later macro elimination phase.
>
> This patch allows `Node::dominates` to try other paths of the last multi-input Region node when the first path is dead, and makes `ConcurrentHashMap` iteration ~30% faster:
>
>
> Benchmark (nkeys) Mode Cnt Score Error Units
> Maps.testConcurrentHashMapIterators 10000 avgt 15 414099.085 ± 33230.945 ns/op # baseline
> Maps.testConcurrentHashMapIterators 10000 avgt 15 315490.281 ± 3037.056 ns/op # patch
>
>
> Testing: tier1-4.
Qizheng Xing has updated the pull request incrementally with two additional commits since the last revision:
- Fix whitespace.
- Update comments in method `split_through_phi`.
Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/19496/files
- new: https://git.openjdk.org/jdk/pull/19496/files/8ee38498..f8118454
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=19496&range=08
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=19496&range=07-08
Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/19496.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/19496/head:pull/19496
PR: https://git.openjdk.org/jdk/pull/19496
More information about the hotspot-compiler-dev
mailing list