RFR: 8301584: Generational ZGC: Add barrier elision tests

Axel Boldt-Christmas aboldtch at openjdk.org
Mon Feb 6 11:01:19 UTC 2023


On Fri, 3 Feb 2023 15:19:48 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

> This changeset adds test cases exercising C2's barrier elision on combinations of different
> 
> - pairs of dominating / dominated accesses (allocations, loads, stores, atomic operations),
> - control structures (local, conditions, loops),
> - object types (arrays, class instances), and
> - levels of information available during C2's analysis (known vs. unknown array indices).
> 
> The changeset exposes node barrier data to the [IR test framework](https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/compiler/lib/ir_framework/README.md) by including it in the node's dump output. This extension is useful not just for testing but also for debugging purposes, for example when exploring C2's intermediate representation with IGV:
> 
> ![igv](https://user-images.githubusercontent.com/8792647/216639224-aa288dd8-72cc-43a5-a445-a93d65004dac.png)
> 
> The following tests illustrate a missing optimization in C2's barrier elision (reported in [JDK-8301769](https://bugs.openjdk.org/browse/JDK-8301769)), where barriers that should be elided are not:
> 
> - `testStoreThenAtomic`
> - `testAtomicThenLoad`
> - `testAtomicThenStore`
> - `testAtomicThenAtomic`
> 
> The changeset does not contain IR checks expecting elision in these cases, to reduce CI pipeline noise. The tests are restricted by now to x64, since volatile loads and stores in other platforms suffer from the same issue (see [JDK-8301769](https://bugs.openjdk.org/browse/JDK-8301769)).
> 
> **Testing:** tier1-7 (windows-x64, linux-x64, macosx-x64; release and debug mode)

src/hotspot/share/gc/shared/c2/barrierSetC2.hpp line 33:

> 31: #include "opto/matcher.hpp"
> 32: #include "opto/memnode.hpp"
> 33: #include "opto/machnode.hpp"

Include order

src/hotspot/share/opto/machnode.cpp line 26:

> 24: 
> 25: #include "precompiled.hpp"
> 26: #include "gc/shared/barrierSet.hpp"

Seems to need `#include "gc/shared/c2/barrierSetC2.hpp"` on some platforms (just looking at your GHA)

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

PR: https://git.openjdk.org/zgc/pull/12


More information about the zgc-dev mailing list