RFR: 8272573: Redundant unique_concrete_method_4 dependencies [v2]

Vladimir Ivanov vlivanov at openjdk.java.net
Wed Aug 18 10:27:25 UTC 2021


On Tue, 17 Aug 2021 22:24:14 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> On second thought, I don't get how it fixes the issue. Can you explain why it reduce false positive?
> The only difference from original code is that you always run note_dep_seen(dept, x1).

Yes, and that's the crucial difference which fixes the problem. The bug stems from the peculiarities of `note_dep_seen()` implementation.

Consider the original code:

if (note_dep_seen(dept, x0) && note_dep_seen(dept, x1)) {


When a fresh assertion is added, it records only `x0` because `note_dep_seen(dept, x0) == false` and the check fails fast.
Next time the very same assertion is made,  `note_dep_seen(dept, x0) == true` (because `note_dep_seen()` recorded `x0`, but `x1` hasn't been checked before and `note_dep_seen(dept, x1) == false`. So, a duplicate dependency is recorded.

Unconditionally running `note_dep_seen()` on `x0` and `x1` lets `note_dep_seen()` observe both arguments on the first occurrence.

> Can you explain why it reduce false positive?

Checking both arguments filters out cases when second argument differs thus reducing the chances linear scan is performed.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5141


More information about the hotspot-compiler-dev mailing list