JDK-8308855 : ARM32: TestBooleanVector crashes after 8300257
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 21
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • CPU: arm
  • Submitted: 2023-05-25
  • Updated: 2023-07-12
  • Resolved: 2023-06-19
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 21 JDK 22
21Fixed 22 b03Fixed
Related Reports
Relates :  
Description
TestBooleanVector crashes on Arm32 after these changes:

From 6b2a86a65ef530002aea35ded45d75e04c223802 Mon Sep 17 00:00:00 2001
From: Roland Westrelin <roland@openjdk.org>
Date: Fri, 7 Apr 2023 12:51:44 +0000
Subject: [PATCH] 8300257: C2: vectorization fails on some simple Memory

The reason for the crash is that after moving an invariant out of the loop, the vector store instruction gets an unaligned address of the array.

;; B20: #   out( B20 B21 ) <- in( B19 B20 ) Loop( B20-B20 inner main of N111 strip mined) Freq: 1.04314e+07
 0xf3dbdd10:  sub   r5, r7, r6
 0xf3dbdd14:  add   r8, r4, r5
 0xf3dbdd18:  mvn   ip, #2
 0xf3dbdd1c:  add   r9, r8, #5
 0xf3dbdd20:  add   r5, r8, ip
=> 0xf3dbdd24:  vstr   d13, [r9]

The issue can be reproduced using this simple program:

public class TestBooleanVect {
 public static void main(String args[]) {
   boolean[] a = new boolean[997];
   for (int i = 0; i < 1000; i++) {
       int limit = a.length-1;
       for (int j = 0; j < a.length; j+=1) {
             a[limit-j] = false;
       }
   }
 }
}

The alignment of Array likely changes on all platforms, when we move the invariant out of the loop. ARM32 doesn't allow unaligned access by vector instruction and crashes.
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk21/pull/48 Date: 2023-06-21 10:27:43 +0000
21-06-2023

Changeset: 266f9838 Author: Roland Westrelin <roland@openjdk.org> Date: 2023-06-19 07:02:10 +0000 URL: https://git.openjdk.org/jdk/commit/266f9838ee28fb49b5368fc9778854c456b02b7c
19-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14508 Date: 2023-06-16 07:09:18 +0000
16-06-2023