JDK-8356192 : Enable AOT code caching only on supported platforms
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 25
  • Priority: P3
  • Status: In Progress
  • Resolution: Unresolved
  • CPU: ppc
  • Submitted: 2025-05-05
  • Updated: 2025-05-09
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 25
25Unresolved
Related Reports
Causes :  
Description
We see lots of crashes in runtime/cds/appcds tests after JDK-8350209:

#  SIGSEGV (0xb) at pc=0x00007fff9f7cd1c4, pid=53191, tid=53194
#
# JRE version: OpenJDK Runtime Environment (25.0) (fastdebug build 25-internal-adhoc.jenkinsi.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 25-internal-adhoc.jenkinsi.jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-ppc64le)
# Problematic frame:
# j  jdk.internal.util.ArraysSupport.hashCodeOfUnsigned([BIII)I+0 java.base@25-internal

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
j  jdk.internal.util.ArraysSupport.hashCodeOfUnsigned([BIII)I+0 java.base@25-internal
J 27 c1 java.lang.String.hashCode()I java.base@25-internal (60 bytes) @ 0x00007fff98400768 [0x00007fff98400440+0x0000000000000328]
j  java.util.concurrent.ConcurrentHashMap.compute(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;+17 java.base@25-internal

Crash happens in interpreter method entry point (kind = zerolocals)
  0x00007fff9f7cd1b8:   lbz     r12,0(r14)
  0x00007fff9f7cd1bc:   addi    r11,r25,18432
  0x00007fff9f7cd1c0:   rldicr  r12,r12,3,60
  0x00007fff9f7cd1c4:   ldx     r11,r11,r12
where r14=0x000003f7008320d8 is pointing into metadata.

Caller is a C1 method
  0x00007fff98400764:   bl      0x00007fff98400920          ; ImmutableOopMap {[96]=Oop }
                                                            ;*invokestatic hashCodeOfUnsigned {reexecute=0 rethrow=0 return_oop=0}
                                                            ; - java.lang.StringLatin1::hashCode@5 (line 191)
                                                            ; - java.lang.String::hashCode@27 (line 2448)
                                                            ;   {static_call}

which uses a call stub
  0x00007fff98400920:   addis   r11,r29,0                   ;   {static_stub}
  0x00007fff98400924:   addi    r11,r11,1024                ;   {section_word}
  0x00007fff98400928:   ld      r19,0(r11)                  ;   {metadata({method} {0x000003f70033cb70} 'hashCodeOfUnsigned' '([BIII)I' in 'jdk/internal/util/ArraysSupport')}
  0x00007fff9840092c:   nop
  0x00007fff98400930:   mr      r0,r11
  0x00007fff98400934:   addis   r11,r29,1874
  0x00007fff98400938:   addi    r11,r11,-14596
  0x00007fff9840093c:   mtctr   r11
  0x00007fff98400940:   mr      r11,r0
  0x00007fff98400944:   nop
  0x00007fff98400948:   bctr    bo=0b10100,bh=0b00[not_return_but_same]

The problem is that some addresses are not updated via AOTCodeAddressTable.

Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/25158 Date: 2025-05-09 21:53:24 +0000
09-05-2025

Or we can simply enable AOT code caching only for aarch64 and x64 on which we are testing AOT. I can do that. What do you think [~mdoerr]?
09-05-2025

You can guard AOT specific code with relocation with AOTCodeCache::is_on_for_dump() check.
09-05-2025

It seems you are missing some relocation declarations in ppc64 adapters generating code. For example: __ load_const_optimized(R25_templateTableBase, (address)Interpreter::dispatch_table((TosState)0), R11_scratch1); __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub(), R0);
09-05-2025