Integrated: 8257069: C2: Clarify and sanity test RegMask/RegMaskIterator
Claes Redestad
redestad at openjdk.java.net
Thu Nov 26 13:45:59 UTC 2020
On Wed, 25 Nov 2020 14:23:53 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> This patch adds a sanity test to RegMask. It's not (yet) exhaustive, but it covers most common operations and iteration.
>
> While implementing this test I noticed that the code have a strong, implied assumption that RM_SIZE is even on 64-bit platforms, and a few things could have broken badly if RM_SIZE was odd (mismatch between set_AllStack/is_AllStack, extra bits after CHUNK_SIZE). That RM_SIZE is even is thankfully an invariant, since the AD preprocessor aligns up RM_SIZE. Add a static assert to this effect, and prefer _RM_SIZE for clarity.
>
> The iteration algorithm in RegMaskIterator, which I borrowed from IndexSetIterator, has garnered a few raised eyebrows. I think the quirky scheme of not shifting out the bit of interest but instead clear is mainly explained by the need to avoid undefined behavior in the corner case when only the highest bit is set. I've added some commentary to try and clarify the quirks.
This pull request has now been integrated.
Changeset: 2d30a101
Author: Claes Redestad <redestad at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/2d30a101
Stats: 214 lines in 3 files changed: 180 ins; 0 del; 34 mod
8257069: C2: Clarify and sanity test RegMask/RegMaskIterator
Reviewed-by: jvernee, kvn
-------------
PR: https://git.openjdk.java.net/jdk/pull/1437
More information about the hotspot-compiler-dev
mailing list