[aarch64-port-dev ] RFR: JDK-8203041 : AArch64: fix overflow in immediate cmp/cmn instruction

Andrew Haley aph at redhat.com
Fri May 18 08:41:34 UTC 2018


On 05/18/2018 04:03 AM, Joshua Zhu wrote:
> 
> 
> JVM crashed with "-XX:SoftwarePrefetchHintDistance=32760" option.

It didn't crash: it was an assertion failure.

> This causes overflow in immediate operand for jtreg TestOptionsWithRanges.
> 
> See JBS for the backtrace.
> 
> Bug: https://bugs.openjdk.java.net/browse/JDK-8203041
> 
> Webrev: http://cr.openjdk.java.net/~zyao/8203041/

Thank you.

This patch is problematic in several ways.  The type of
prefetchLoopThreshold is int, so it's 32 bits.  Casting it (via the
call to cmp()) to unsigned int is probably wrong too.

rscratch1 isn't available for use in a compare instruction because we
sometimes say cmp(rscratch1, imm).  I suspect it'd be better to use a
subsw in generate_large_array_equals() if you can find a spare
register for the destination.

There are several other coding problems in
generate_large_array_equals(), in particular the use of code like

  Register tmp1 = rscratch1

This creates a hidden alias for rscratch1, but rscratch1 is used by
assembler macros.  This is very dangerous.  I'll have a look some
more.

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


More information about the aarch64-port-dev mailing list