git: 1a550987749d - main - java/openjdk18: Fix the build on aarch64

From: Greg Lewis <glewis_at_FreeBSD.org>
Date: Sun, 08 May 2022 05:25:16 UTC
The branch main has been updated by glewis:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1a550987749db80b46153ef8ad5016313b23a51e

commit 1a550987749db80b46153ef8ad5016313b23a51e
Author:     Greg Lewis <glewis@FreeBSD.org>
AuthorDate: 2022-05-08 05:24:21 +0000
Commit:     Greg Lewis <glewis@FreeBSD.org>
CommitDate: 2022-05-08 05:24:21 +0000

    java/openjdk18: Fix the build on aarch64
---
 ...pot_os__cpu_bsd__aarch64_atomic__bsd__aarch64.S | 31 ++++++++++++++++++
 ...t_os__cpu_bsd__aarch64_atomic__bsd__aarch64.hpp | 38 ++++++++++++++++++++++
 2 files changed, 69 insertions(+)

diff --git a/java/openjdk18/files/patch-src_hotspot_os__cpu_bsd__aarch64_atomic__bsd__aarch64.S b/java/openjdk18/files/patch-src_hotspot_os__cpu_bsd__aarch64_atomic__bsd__aarch64.S
new file mode 100644
index 000000000000..35c926fd1a0a
--- /dev/null
+++ b/java/openjdk18/files/patch-src_hotspot_os__cpu_bsd__aarch64_atomic__bsd__aarch64.S
@@ -0,0 +1,31 @@
+--- src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.S
++++ src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.S
+@@ -47,6 +47,28 @@ aarch64_atomic_fetch_add_4_default_impl:
+         mov     w0, w2
+         ret
+ 
++        .global aarch64_atomic_fetch_add_8_relaxed_default_impl
++        .align 5
++aarch64_atomic_fetch_add_8_relaxed_default_impl:
++        prfm    pstl1strm, [x0]
++0:      ldxr    x2, [x0]
++        add     x8, x2, x1
++        stxr    w9, x8, [x0]
++        cbnz    w9, 0b
++        mov     x0, x2
++        ret
++
++        .global aarch64_atomic_fetch_add_4_relaxed_default_impl
++        .align 5
++aarch64_atomic_fetch_add_4_relaxed_default_impl:
++        prfm    pstl1strm, [x0]
++0:      ldxr    w2, [x0]
++        add     w8, w2, w1
++        stxr    w9, w8, [x0]
++        cbnz    w9, 0b
++        mov     w0, w2
++        ret
++
+         .globl aarch64_atomic_xchg_4_default_impl
+         .align 5
+ aarch64_atomic_xchg_4_default_impl:
diff --git a/java/openjdk18/files/patch-src_hotspot_os__cpu_bsd__aarch64_atomic__bsd__aarch64.hpp b/java/openjdk18/files/patch-src_hotspot_os__cpu_bsd__aarch64_atomic__bsd__aarch64.hpp
new file mode 100644
index 000000000000..a71932f53fe2
--- /dev/null
+++ b/java/openjdk18/files/patch-src_hotspot_os__cpu_bsd__aarch64_atomic__bsd__aarch64.hpp
@@ -0,0 +1,38 @@
+--- src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp
++++ src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp
+@@ -184,9 +184,14 @@ inline D Atomic::PlatformAdd<4>::fetch_and_add(D volatile* dest, I add_value,
+                                                atomic_memory_order order) const {
+   STATIC_ASSERT(4 == sizeof(I));
+   STATIC_ASSERT(4 == sizeof(D));
+-  D old_value
+-    = atomic_fastcall(aarch64_atomic_fetch_add_4_impl, dest, add_value);
+-  return old_value;
++  aarch64_atomic_stub_t stub;
++  switch (order) {
++  case memory_order_relaxed:
++    stub = aarch64_atomic_fetch_add_4_relaxed_impl; break;
++  default:
++    stub = aarch64_atomic_fetch_add_4_impl; break;
++  }
++  return atomic_fastcall(stub, dest, add_value);
+ }
+ 
+ template<>
+@@ -195,9 +200,14 @@ inline D Atomic::PlatformAdd<8>::fetch_and_add(D volatile* dest, I add_value,
+                                                atomic_memory_order order) const {
+   STATIC_ASSERT(8 == sizeof(I));
+   STATIC_ASSERT(8 == sizeof(D));
+-  D old_value
+-    = atomic_fastcall(aarch64_atomic_fetch_add_8_impl, dest, add_value);
+-  return old_value;
++  aarch64_atomic_stub_t stub;
++  switch (order) {
++  case memory_order_relaxed:
++    stub = aarch64_atomic_fetch_add_8_relaxed_impl; break;
++  default:
++    stub = aarch64_atomic_fetch_add_8_impl; break;
++  }
++  return atomic_fastcall(stub, dest, add_value);
+ }
+ 
+ template<>