[aarch64] assert(is_power_of_2(x)) failed: x must be a power of 2: 0xffffffff80000000

Andrew Haley aph at redhat.com
Mon Feb 24 14:17:10 UTC 2020


On 2/24/20 1:47 PM, Doerr, Martin wrote:
> I've created an issue:
> https://bugs.openjdk.java.net/browse/JDK-8239861
>
> Failues were observed in e.g. jck tests api/java_awt/Font/LineBreakMeasurer.

This is caused by "8183574: Unify the is_power_of_2 functions".

I think there's a real bug in the new exact_log2().
is_power_of_2((jint)0x8000_0000) returns true but
exact_log2((jint)0x8000_0000) throws an exception. This sounds wrong
to me. We should work around it in the AArch64 back end by converting
the operand to an unsigned type, but I wonder what else broke.

Here:

instruct far_cmpI_branch_bit(cmpOpEqNe cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{
  match(If cmp (CmpI (AndI op1 op2) op3));
  predicate(is_power_of_2(n->in(2)->in(1)->in(2)->get_int()));
  effect(USE labl);

  ins_cost(BRANCH_COST);
  format %{ "tb$cmp   $op1, $op2, $labl" %}
  ins_encode %{
    Label* L = $labl$$label;
    Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode;
    int bit = exact_log2($op2$$constant);

Note that we check that $op2 is a power of two before we call
exact_log2().

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the hotspot-compiler-dev mailing list