[lworld] Integrated: 8255046: [lworld] JIT should make use of array layout encoding in markWord

Tobias Hartmann thartmann at openjdk.java.net
Fri Nov 13 12:04:10 UTC 2020


On Thu, 12 Nov 2020 13:34:20 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: 1b1aefaa
Author:    Tobias Hartmann <thartmann at openjdk.org>
URL:       https://git.openjdk.java.net/valhalla/commit/1b1aefaa
Stats:     666 lines in 19 files changed: 565 ins; 44 del; 57 mod

8255046: [lworld] JIT should make use of array layout encoding in markWord

Reviewed-by: roland

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

PR: https://git.openjdk.java.net/valhalla/pull/256



More information about the valhalla-dev mailing list