[lworld] RFR: 8255046: [lworld] JIT should make use of array layout encoding in markWord [v2]
Tobias Hartmann
thartmann at openjdk.java.net
Fri Nov 13 10:31:26 UTC 2020
> This patch re-implements the flat array check in C1 and C2 by using the mark word bits instead of the layout helper from the array Klass (see [JDK-8247299](https://bugs.openjdk.java.net/browse/JDK-8247299)). Unfortunately, this turned out to be far from trivial to implement in C2.
>
> I've introduced a new FlatArrayCheck macro node to wrap the logic of the new check and to make it easier for the loop unswitching optimization to detect and hoist the check. One major problem is that we can't use immutable memory anymore because we are loading the mark word which is mutable (`AliasType::_is_rewritable` is `true`). Although the bits we are interested in are in fact immutable (we check for `markWord::unlocked_value`), we need to use raw memory to not break anti dependency analysis. As a result, flat array checks are not hoisted out of loops anymore and loop unswitching fails. `PhaseIdealLoop::move_flat_array_check_out_of_loop` will attempt to still move flat array checks out of loops by walking up the memory edge to before the loop and re-wiring the check accordingly.
>
> This patch also fixes an existing issue in Escape Analysis that was only triggered now that we are able to fold the flat array check in more cases due to the `::Ideal`/`::Value `transformations.
>
> @kuksenko, could you please evaluate performance of this change? Disabling the `UseArrayMarkWordCheck` flag allows to switch back to the old check using the layout helper.
>
> Thanks,
> Tobias
Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:
EA fix
-------------
Changes:
- all: https://git.openjdk.java.net/valhalla/pull/256/files
- new: https://git.openjdk.java.net/valhalla/pull/256/files/565d64d7..8320b34d
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=256&range=01
- incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=256&range=00-01
Stats: 35 lines in 1 file changed: 10 ins; 17 del; 8 mod
Patch: https://git.openjdk.java.net/valhalla/pull/256.diff
Fetch: git fetch https://git.openjdk.java.net/valhalla pull/256/head:pull/256
PR: https://git.openjdk.java.net/valhalla/pull/256
More information about the valhalla-dev
mailing list