JDK-8244164 : AArch64: jaotc generates incorrect code for compressed OOPs with non-zero heap base
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,14,15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: aarch64
  • Submitted: 2020-04-30
  • Updated: 2020-11-19
  • Resolved: 2020-05-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 15
11.0.11-oracleFixed 15 b24Fixed
Description
From Andrew Haley:

------

If I then run the AOT-compiled code with -Xmx31G I get:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000ffffa142bd3c, pid=9965, tid=10174
#
# JRE version:  (15.0) (slowdebug build )
# Java VM: OpenJDK 64-Bit Server VM (slowdebug 15-internal+0-adhoc.aph.jdk-tmp, mixed mode, aot, tiered, compressed oops, g1 gc, linux-aarch64)
# Problematic frame:
# A 388  java.lang.Thread.setPriority(I)V java.base (56 bytes) @ 0x0000ffffa142bd3c [0x0000ffffa142bac0+0x000000000000027c]

   0x0000ffffa142bd30 <+624>:	ldr	w1, [x4, #56]
   0x0000ffffa142bd34 <+628>:	cbz	w1, 0xffffa142bd84 <java.lang.Thread.setPriority(I)V+708>
   0x0000ffffa142bd38 <+632>:	lsl	x1, x1, #3
   0x0000ffffa142bd3c <+636>:	ldr	w0, [x1, #12]

... so the AOT-compiled code is still trying to use the shift of 3,
but it is not adding in the base, which is 0x1000000000. 

------

jaotc uses the heap base value from the running VM to decide whether to use the heap base register or not. This is wrong as the generated code may later be loaded into a VM with non-zero base.
Comments
jdk11u fix request: I'd like to backport this to 11u as it fixes a crash an end user can easily provoke by using AOT with a large heap as shown in the description. The patch applies on 11u except for a conflict on the copyright date and the test passes.
29-05-2020

[~ngasson] Can you please add a Fix request comment?
29-05-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/4cd328cdd20f User: ngasson Date: 2020-05-20 02:02:13 +0000
20-05-2020

Review thread: https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2020-May/038191.html
11-05-2020