FreeBSD Bugzilla – Attachment 205818 Details for
Bug 239246
java/openjdk11: add support for aarch64
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
java_openjdk11.patch (text/plain), 156.73 KB, created by
Mikael Urankar
on 2019-07-16 10:55:23 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Mikael Urankar
Created:
2019-07-16 10:55:23 UTC
Size:
156.73 KB
patch
obsolete
>Index: java/bootstrap-openjdk11/Makefile >=================================================================== >--- java/bootstrap-openjdk11/Makefile (revision 506656) >+++ java/bootstrap-openjdk11/Makefile (working copy) >@@ -12,7 +12,7 @@ > > LICENSE= GPLv2 > >-ONLY_FOR_ARCHS= amd64 i386 >+ONLY_FOR_ARCHS= aarch64 amd64 i386 > > USES= tar:xz > >Index: java/bootstrap-openjdk11/distinfo >=================================================================== >--- java/bootstrap-openjdk11/distinfo (revision 506656) >+++ java/bootstrap-openjdk11/distinfo (working copy) >@@ -3,3 +3,5 @@ > SIZE (bootstrap-openjdk11-amd64-11.0.2.9.2.tar.xz) = 102199460 > SHA256 (bootstrap-openjdk11-i386-11.0.2.9.2.tar.xz) = 68b84741d7b8a7241fb30614881f15db3c174d973f999d34e0f53aca6190e00f > SIZE (bootstrap-openjdk11-i386-11.0.2.9.2.tar.xz) = 96936056 >+SHA256 (bootstrap-openjdk11-aarch64-11.0.2.9.2.tar.xz) = 963f7486d80d54920fd8d07a95148fe41ed66045bb5a10d2d2f3d3677c6ca554 >+SIZE (bootstrap-openjdk11-aarch64-11.0.2.9.2.tar.xz) = 105149964 >Index: java/openjdk11/Makefile >=================================================================== >--- java/openjdk11/Makefile (revision 506656) >+++ java/openjdk11/Makefile (working copy) >@@ -11,7 +11,7 @@ > > LICENSE= GPLv2 > >-ONLY_FOR_ARCHS= amd64 i386 >+ONLY_FOR_ARCHS= aarch64 amd64 i386 > > BUILD_DEPENDS= zip:archivers/zip \ > autoconf>0:devel/autoconf \ >@@ -122,6 +122,11 @@ > MAKE_ENV+= USE_CLANG=true > .endif > >+.if ${ARCH} == aarch64 >+CONFIGURE_ARGS+= --disable-warnings-as-errors \ >+ --disable-dtrace >+.endif >+ > .if empty(ICONV_LIB) > ICONV_CFLAGS= -DLIBICONV_PLUG > .else >Index: java/openjdk11/files/patch-aarch64 >=================================================================== >--- java/openjdk11/files/patch-aarch64 (nonexistent) >+++ java/openjdk11/files/patch-aarch64 (working copy) >@@ -0,0 +1,3934 @@ >+From b6b15000fd62882be19223443f0aa6c468c15a14 Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:09:26 +0200 >+Subject: [PATCH 01/17] copy src/hotspot/os_cpu/linux_aarch64/* to >+ src/hotspot/os_cpu/bsd_aarch64/ >+ >+copy src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/aarch64/* to >+src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/ >+ >+and rename files to *bsd* >+ >+mkdir src/hotspot/os_cpu/bsd_aarch64 >+for file in $(ls src/hotspot/os_cpu/linux_aarch64/*) >+do >+ bsd=$(echo $file | sed 's/linux/bsd/g') >+ cp ${file} ${bsd} >+done >+ >+mkdir src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64 >+cp src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/aarch64/LinuxAARCH64CFrame.java \ >+ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java >+cp src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/aarch64/LinuxAARCH64ThreadContext.java \ >+ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java >+--- >+ .../bsd_aarch64/assembler_bsd_aarch64.cpp | 28 + >+ .../os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp | 75 ++ >+ src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.S | 48 ++ >+ src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad | 69 ++ >+ .../bsd_aarch64/bytes_bsd_aarch64.inline.hpp | 45 ++ >+ .../bsd_aarch64/copy_bsd_aarch64.inline.hpp | 188 +++++ >+ .../os_cpu/bsd_aarch64/copy_bsd_aarch64.s | 236 ++++++ >+ .../bsd_aarch64/globals_bsd_aarch64.hpp | 45 ++ >+ .../bsd_aarch64/orderAccess_bsd_aarch64.hpp | 73 ++ >+ .../os_cpu/bsd_aarch64/os_bsd_aarch64.cpp | 733 ++++++++++++++++++ >+ .../os_cpu/bsd_aarch64/os_bsd_aarch64.hpp | 45 ++ >+ .../bsd_aarch64/os_bsd_aarch64.inline.hpp | 40 + >+ .../prefetch_bsd_aarch64.inline.hpp | 46 ++ >+ .../os_cpu/bsd_aarch64/threadLS_bsd_aarch64.s | 44 ++ >+ .../os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp | 104 +++ >+ .../os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp | 80 ++ >+ .../bsd_aarch64/vmStructs_bsd_aarch64.hpp | 55 ++ >+ .../bsd_aarch64/vm_version_bsd_aarch64.cpp | 29 + >+ .../bsd/aarch64/BsdAARCH64CFrame.java | 86 ++ >+ .../bsd/aarch64/BsdAARCH64ThreadContext.java | 47 ++ >+ 20 files changed, 2116 insertions(+) >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/assembler_bsd_aarch64.cpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.S >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/threadLS_bsd_aarch64.s >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp >+ create mode 100644 src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp >+ create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java >+ create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java >+ >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/assembler_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/assembler_bsd_aarch64.cpp >+new file mode 100644 >+index 0000000000..920d94da7f >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/assembler_bsd_aarch64.cpp >+@@ -0,0 +1,28 @@ >++/* >++ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++// nothing required here >++ >++ >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp >+new file mode 100644 >+index 0000000000..e1f59bb43e >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp >+@@ -0,0 +1,75 @@ >++/* >++ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#ifndef OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP >++#define OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP >++ >++#include "vm_version_aarch64.hpp" >++ >++// Implementation of class atomic >++ >++#define FULL_MEM_BARRIER __sync_synchronize() >++#define READ_MEM_BARRIER __atomic_thread_fence(__ATOMIC_ACQUIRE); >++#define WRITE_MEM_BARRIER __atomic_thread_fence(__ATOMIC_RELEASE); >++ >++template<size_t byte_size> >++struct Atomic::PlatformAdd >++ : Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> > >++{ >++ template<typename I, typename D> >++ D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const { >++ return __sync_add_and_fetch(dest, add_value); >++ } >++}; >++ >++template<size_t byte_size> >++template<typename T> >++inline T Atomic::PlatformXchg<byte_size>::operator()(T exchange_value, >++ T volatile* dest, >++ atomic_memory_order order) const { >++ STATIC_ASSERT(byte_size == sizeof(T)); >++ T res = __sync_lock_test_and_set(dest, exchange_value); >++ FULL_MEM_BARRIER; >++ return res; >++} >++ >++template<size_t byte_size> >++template<typename T> >++inline T Atomic::PlatformCmpxchg<byte_size>::operator()(T exchange_value, >++ T volatile* dest, >++ T compare_value, >++ atomic_memory_order order) const { >++ STATIC_ASSERT(byte_size == sizeof(T)); >++ if (order == memory_order_relaxed) { >++ T value = compare_value; >++ __atomic_compare_exchange(dest, &value, &exchange_value, /*weak*/false, >++ __ATOMIC_RELAXED, __ATOMIC_RELAXED); >++ return value; >++ } else { >++ return __sync_val_compare_and_swap(dest, compare_value, exchange_value); >++ } >++} >++ >++#endif // OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.S b/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.S >+new file mode 100644 >+index 0000000000..3c863ad1d2 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.S >+@@ -0,0 +1,48 @@ >++// >++// Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. >++// Copyright (c) 2014, Red Hat Inc. All rights reserved. >++// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++// >++// This code is free software; you can redistribute it and/or modify it >++// under the terms of the GNU General Public License version 2 only, as >++// published by the Free Software Foundation. >++// >++// This code is distributed in the hope that it will be useful, but WITHOUT >++// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++// version 2 for more details (a copy is included in the LICENSE file that >++// accompanied this code). >++// >++// You should have received a copy of the GNU General Public License version >++// 2 along with this work; if not, write to the Free Software Foundation, >++// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++// >++// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++// or visit www.oracle.com if you need additional information or have any >++// questions. >++ >++#ifdef BUILTIN_SIM >++ >++ .globl SafeFetch32, Fetch32PFI, Fetch32Resume >++ .align 16 >++ .type SafeFetch32,@function >++ // Prototype: int SafeFetch32 (int * Adr, int ErrValue) >++SafeFetch32: >++ movl %esi, %eax >++Fetch32PFI: >++ movl (%rdi), %eax >++Fetch32Resume: >++ ret >++ >++ .globl SafeFetchN, FetchNPFI, FetchNResume >++ .align 16 >++ .type SafeFetchN,@function >++ // Prototype: intptr_t SafeFetchN (intptr_t * Adr, intptr_t ErrValue) >++SafeFetchN: >++ movq %rsi, %rax >++FetchNPFI: >++ movq (%rdi), %rax >++FetchNResume: >++ ret >++ >++#endif >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad b/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad >+new file mode 100644 >+index 0000000000..c3b8cd2c45 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad >+@@ -0,0 +1,69 @@ >++// >++// Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. >++// Copyright (c) 2014, Red Hat Inc. All rights reserved. >++// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++// >++// This code is free software; you can redistribute it and/or modify it >++// under the terms of the GNU General Public License version 2 only, as >++// published by the Free Software Foundation. >++// >++// This code is distributed in the hope that it will be useful, but WITHOUT >++// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++// version 2 for more details (a copy is included in the LICENSE file that >++// accompanied this code). >++// >++// You should have received a copy of the GNU General Public License version >++// 2 along with this work; if not, write to the Free Software Foundation, >++// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++// >++// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++// or visit www.oracle.com if you need additional information or have any >++// questions. >++// >++// >++ >++// AArch64 Linux Architecture Description File >++ >++//----------OS-DEPENDENT ENCODING BLOCK---------------------------------------- >++// This block specifies the encoding classes used by the compiler to >++// output byte streams. Encoding classes generate functions which are >++// called by Machine Instruction Nodes in order to generate the bit >++// encoding of the instruction. Operands specify their base encoding >++// interface with the interface keyword. There are currently >++// supported four interfaces, REG_INTER, CONST_INTER, MEMORY_INTER, & >++// COND_INTER. REG_INTER causes an operand to generate a function >++// which returns its register number when queried. CONST_INTER causes >++// an operand to generate a function which returns the value of the >++// constant when queried. MEMORY_INTER causes an operand to generate >++// four functions which return the Base Register, the Index Register, >++// the Scale Value, and the Offset Value of the operand when queried. >++// COND_INTER causes an operand to generate six functions which return >++// the encoding code (ie - encoding bits for the instruction) >++// associated with each basic boolean condition for a conditional >++// instruction. Instructions specify two basic values for encoding. >++// They use the ins_encode keyword to specify their encoding class >++// (which must be one of the class names specified in the encoding >++// block), and they use the opcode keyword to specify, in order, their >++// primary, secondary, and tertiary opcode. Only the opcode sections >++// which a particular instruction needs for encoding need to be >++// specified. >++encode %{ >++ // Build emit functions for each basic byte or larger field in the intel >++ // encoding scheme (opcode, rm, sib, immediate), and call them from C++ >++ // code in the enc_class source block. Emit functions will live in the >++ // main source block for now. In future, we can generalize this by >++ // adding a syntax that specifies the sizes of fields in an order, >++ // so that the adlc can build the emit functions automagically >++ >++ enc_class Java_To_Runtime(method meth) %{ >++ %} >++ >++%} >++ >++ >++// Platform dependent source >++ >++source %{ >++ >++%} >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp >+new file mode 100644 >+index 0000000000..e283f86d10 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp >+@@ -0,0 +1,45 @@ >++/* >++ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#ifndef OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP >++#define OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP >++ >++#include <byteswap.h> >++ >++// Efficient swapping of data bytes from Java byte >++// ordering to native byte ordering and vice versa. >++inline u2 Bytes::swap_u2(u2 x) { >++ return bswap_16(x); >++} >++ >++inline u4 Bytes::swap_u4(u4 x) { >++ return bswap_32(x); >++} >++ >++inline u8 Bytes::swap_u8(u8 x) { >++ return bswap_64(x); >++} >++ >++#endif // OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp >+new file mode 100644 >+index 0000000000..794ab349b0 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp >+@@ -0,0 +1,188 @@ >++/* >++ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#ifndef OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP >++#define OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP >++ >++#define COPY_SMALL(from, to, count) \ >++{ \ >++ long tmp0, tmp1, tmp2, tmp3; \ >++ long tmp4, tmp5, tmp6, tmp7; \ >++ __asm volatile( \ >++" adr %[t0], 0f;" \ >++" add %[t0], %[t0], %[cnt], lsl #5;" \ >++" br %[t0];" \ >++" .align 5;" \ >++"0:" \ >++" b 1f;" \ >++" .align 5;" \ >++" ldr %[t0], [%[s], #0];" \ >++" str %[t0], [%[d], #0];" \ >++" b 1f;" \ >++" .align 5;" \ >++" ldp %[t0], %[t1], [%[s], #0];" \ >++" stp %[t0], %[t1], [%[d], #0];" \ >++" b 1f;" \ >++" .align 5;" \ >++" ldp %[t0], %[t1], [%[s], #0];" \ >++" ldr %[t2], [%[s], #16];" \ >++" stp %[t0], %[t1], [%[d], #0];" \ >++" str %[t2], [%[d], #16];" \ >++" b 1f;" \ >++" .align 5;" \ >++" ldp %[t0], %[t1], [%[s], #0];" \ >++" ldp %[t2], %[t3], [%[s], #16];" \ >++" stp %[t0], %[t1], [%[d], #0];" \ >++" stp %[t2], %[t3], [%[d], #16];" \ >++" b 1f;" \ >++" .align 5;" \ >++" ldp %[t0], %[t1], [%[s], #0];" \ >++" ldp %[t2], %[t3], [%[s], #16];" \ >++" ldr %[t4], [%[s], #32];" \ >++" stp %[t0], %[t1], [%[d], #0];" \ >++" stp %[t2], %[t3], [%[d], #16];" \ >++" str %[t4], [%[d], #32];" \ >++" b 1f;" \ >++" .align 5;" \ >++" ldp %[t0], %[t1], [%[s], #0];" \ >++" ldp %[t2], %[t3], [%[s], #16];" \ >++" ldp %[t4], %[t5], [%[s], #32];" \ >++"2:" \ >++" stp %[t0], %[t1], [%[d], #0];" \ >++" stp %[t2], %[t3], [%[d], #16];" \ >++" stp %[t4], %[t5], [%[d], #32];" \ >++" b 1f;" \ >++" .align 5;" \ >++" ldr %[t6], [%[s], #0];" \ >++" ldp %[t0], %[t1], [%[s], #8];" \ >++" ldp %[t2], %[t3], [%[s], #24];" \ >++" ldp %[t4], %[t5], [%[s], #40];" \ >++" str %[t6], [%[d]], #8;" \ >++" b 2b;" \ >++" .align 5;" \ >++" ldp %[t0], %[t1], [%[s], #0];" \ >++" ldp %[t2], %[t3], [%[s], #16];" \ >++" ldp %[t4], %[t5], [%[s], #32];" \ >++" ldp %[t6], %[t7], [%[s], #48];" \ >++" stp %[t0], %[t1], [%[d], #0];" \ >++" stp %[t2], %[t3], [%[d], #16];" \ >++" stp %[t4], %[t5], [%[d], #32];" \ >++" stp %[t6], %[t7], [%[d], #48];" \ >++"1:" \ >++ \ >++ : [s]"+r"(from), [d]"+r"(to), [cnt]"+r"(count), \ >++ [t0]"=&r"(tmp0), [t1]"=&r"(tmp1), [t2]"=&r"(tmp2), [t3]"=&r"(tmp3), \ >++ [t4]"=&r"(tmp4), [t5]"=&r"(tmp5), [t6]"=&r"(tmp6), [t7]"=&r"(tmp7) \ >++ : \ >++ : "memory", "cc"); \ >++} >++ >++static void pd_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) { >++ __asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory"); >++ if (__builtin_expect(count <= 8, 1)) { >++ COPY_SMALL(from, to, count); >++ return; >++ } >++ _Copy_conjoint_words(from, to, count); >++} >++ >++static void pd_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) { >++ if (__builtin_constant_p(count)) { >++ memcpy(to, from, count * sizeof(HeapWord)); >++ return; >++ } >++ __asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory"); >++ if (__builtin_expect(count <= 8, 1)) { >++ COPY_SMALL(from, to, count); >++ return; >++ } >++ _Copy_disjoint_words(from, to, count); >++} >++ >++static void pd_disjoint_words_atomic(const HeapWord* from, HeapWord* to, size_t count) { >++ __asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory"); >++ if (__builtin_expect(count <= 8, 1)) { >++ COPY_SMALL(from, to, count); >++ return; >++ } >++ _Copy_disjoint_words(from, to, count); >++} >++ >++static void pd_aligned_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) { >++ pd_conjoint_words(from, to, count); >++} >++ >++static void pd_aligned_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) { >++ pd_disjoint_words(from, to, count); >++} >++ >++static void pd_conjoint_bytes(const void* from, void* to, size_t count) { >++ (void)memmove(to, from, count); >++} >++ >++static void pd_conjoint_bytes_atomic(const void* from, void* to, size_t count) { >++ pd_conjoint_bytes(from, to, count); >++} >++ >++static void pd_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) { >++ _Copy_conjoint_jshorts_atomic(from, to, count); >++} >++ >++static void pd_conjoint_jints_atomic(const jint* from, jint* to, size_t count) { >++ _Copy_conjoint_jints_atomic(from, to, count); >++} >++ >++static void pd_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { >++ _Copy_conjoint_jlongs_atomic(from, to, count); >++} >++ >++static void pd_conjoint_oops_atomic(const oop* from, oop* to, size_t count) { >++ assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); >++ _Copy_conjoint_jlongs_atomic((const jlong*)from, (jlong*)to, count); >++} >++ >++static void pd_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) { >++ _Copy_arrayof_conjoint_bytes(from, to, count); >++} >++ >++static void pd_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { >++ _Copy_arrayof_conjoint_jshorts(from, to, count); >++} >++ >++static void pd_arrayof_conjoint_jints(const HeapWord* from, HeapWord* to, size_t count) { >++ _Copy_arrayof_conjoint_jints(from, to, count); >++} >++ >++static void pd_arrayof_conjoint_jlongs(const HeapWord* from, HeapWord* to, size_t count) { >++ _Copy_arrayof_conjoint_jlongs(from, to, count); >++} >++ >++static void pd_arrayof_conjoint_oops(const HeapWord* from, HeapWord* to, size_t count) { >++ assert(!UseCompressedOops, "foo!"); >++ assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); >++ _Copy_arrayof_conjoint_jlongs(from, to, count); >++} >++ >++#endif // OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s >+new file mode 100644 >+index 0000000000..25e3b054f7 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s >+@@ -0,0 +1,236 @@ >++/* >++ * Copyright (c) 2016, Linaro Ltd. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ .global _Copy_conjoint_words >++ .global _Copy_disjoint_words >++ >++s .req x0 >++d .req x1 >++count .req x2 >++t0 .req x3 >++t1 .req x4 >++t2 .req x5 >++t3 .req x6 >++t4 .req x7 >++t5 .req x8 >++t6 .req x9 >++t7 .req x10 >++ >++ .align 6 >++_Copy_disjoint_words: >++ // Ensure 2 word aligned >++ tbz s, #3, fwd_copy_aligned >++ ldr t0, [s], #8 >++ str t0, [d], #8 >++ sub count, count, #1 >++ >++fwd_copy_aligned: >++ // Bias s & d so we only pre index on the last copy >++ sub s, s, #16 >++ sub d, d, #16 >++ >++ ldp t0, t1, [s, #16] >++ ldp t2, t3, [s, #32] >++ ldp t4, t5, [s, #48] >++ ldp t6, t7, [s, #64]! >++ >++ subs count, count, #16 >++ blo fwd_copy_drain >++ >++fwd_copy_again: >++ prfm pldl1keep, [s, #256] >++ stp t0, t1, [d, #16] >++ ldp t0, t1, [s, #16] >++ stp t2, t3, [d, #32] >++ ldp t2, t3, [s, #32] >++ stp t4, t5, [d, #48] >++ ldp t4, t5, [s, #48] >++ stp t6, t7, [d, #64]! >++ ldp t6, t7, [s, #64]! >++ subs count, count, #8 >++ bhs fwd_copy_again >++ >++fwd_copy_drain: >++ stp t0, t1, [d, #16] >++ stp t2, t3, [d, #32] >++ stp t4, t5, [d, #48] >++ stp t6, t7, [d, #64]! >++ >++ // count is now -8..-1 for 0..7 words to copy >++ adr t0, 0f >++ add t0, t0, count, lsl #5 >++ br t0 >++ >++ .align 5 >++ ret // -8 == 0 words >++ .align 5 >++ ldr t0, [s, #16] // -7 == 1 word >++ str t0, [d, #16] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #16] // -6 = 2 words >++ stp t0, t1, [d, #16] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #16] // -5 = 3 words >++ ldr t2, [s, #32] >++ stp t0, t1, [d, #16] >++ str t2, [d, #32] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #16] // -4 = 4 words >++ ldp t2, t3, [s, #32] >++ stp t0, t1, [d, #16] >++ stp t2, t3, [d, #32] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #16] // -3 = 5 words >++ ldp t2, t3, [s, #32] >++ ldr t4, [s, #48] >++ stp t0, t1, [d, #16] >++ stp t2, t3, [d, #32] >++ str t4, [d, #48] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #16] // -2 = 6 words >++ ldp t2, t3, [s, #32] >++ ldp t4, t5, [s, #48] >++ stp t0, t1, [d, #16] >++ stp t2, t3, [d, #32] >++ stp t4, t5, [d, #48] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #16] // -1 = 7 words >++ ldp t2, t3, [s, #32] >++ ldp t4, t5, [s, #48] >++ ldr t6, [s, #64] >++ stp t0, t1, [d, #16] >++ stp t2, t3, [d, #32] >++ stp t4, t5, [d, #48] >++ str t6, [d, #64] >++ // Is always aligned here, code for 7 words is one instruction >++ // too large so it just falls through. >++ .align 5 >++0: >++ ret >++ >++ .align 6 >++_Copy_conjoint_words: >++ sub t0, d, s >++ cmp t0, count, lsl #3 >++ bhs _Copy_disjoint_words >++ >++ add s, s, count, lsl #3 >++ add d, d, count, lsl #3 >++ >++ // Ensure 2 word aligned >++ tbz s, #3, bwd_copy_aligned >++ ldr t0, [s, #-8]! >++ str t0, [d, #-8]! >++ sub count, count, #1 >++ >++bwd_copy_aligned: >++ ldp t0, t1, [s, #-16] >++ ldp t2, t3, [s, #-32] >++ ldp t4, t5, [s, #-48] >++ ldp t6, t7, [s, #-64]! >++ >++ subs count, count, #16 >++ blo bwd_copy_drain >++ >++bwd_copy_again: >++ prfm pldl1keep, [s, #-256] >++ stp t0, t1, [d, #-16] >++ ldp t0, t1, [s, #-16] >++ stp t2, t3, [d, #-32] >++ ldp t2, t3, [s, #-32] >++ stp t4, t5, [d, #-48] >++ ldp t4, t5, [s, #-48] >++ stp t6, t7, [d, #-64]! >++ ldp t6, t7, [s, #-64]! >++ subs count, count, #8 >++ bhs bwd_copy_again >++ >++bwd_copy_drain: >++ stp t0, t1, [d, #-16] >++ stp t2, t3, [d, #-32] >++ stp t4, t5, [d, #-48] >++ stp t6, t7, [d, #-64]! >++ >++ // count is now -8..-1 for 0..7 words to copy >++ adr t0, 0f >++ add t0, t0, count, lsl #5 >++ br t0 >++ >++ .align 5 >++ ret // -8 == 0 words >++ .align 5 >++ ldr t0, [s, #-8] // -7 == 1 word >++ str t0, [d, #-8] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #-16] // -6 = 2 words >++ stp t0, t1, [d, #-16] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #-16] // -5 = 3 words >++ ldr t2, [s, #-24] >++ stp t0, t1, [d, #-16] >++ str t2, [d, #-24] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #-16] // -4 = 4 words >++ ldp t2, t3, [s, #-32] >++ stp t0, t1, [d, #-16] >++ stp t2, t3, [d, #-32] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #-16] // -3 = 5 words >++ ldp t2, t3, [s, #-32] >++ ldr t4, [s, #-40] >++ stp t0, t1, [d, #-16] >++ stp t2, t3, [d, #-32] >++ str t4, [d, #-40] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #-16] // -2 = 6 words >++ ldp t2, t3, [s, #-32] >++ ldp t4, t5, [s, #-48] >++ stp t0, t1, [d, #-16] >++ stp t2, t3, [d, #-32] >++ stp t4, t5, [d, #-48] >++ ret >++ .align 5 >++ ldp t0, t1, [s, #-16] // -1 = 7 words >++ ldp t2, t3, [s, #-32] >++ ldp t4, t5, [s, #-48] >++ ldr t6, [s, #-56] >++ stp t0, t1, [d, #-16] >++ stp t2, t3, [d, #-32] >++ stp t4, t5, [d, #-48] >++ str t6, [d, #-56] >++ // Is always aligned here, code for 7 words is one instruction >++ // too large so it just falls through. >++ .align 5 >++0: >++ ret >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp >+new file mode 100644 >+index 0000000000..360be743dd >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp >+@@ -0,0 +1,45 @@ >++/* >++ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#ifndef OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP >++#define OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP >++ >++// Sets the default values for platform dependent flags used by the runtime system. >++// (see globals.hpp) >++ >++define_pd_global(bool, DontYieldALot, false); >++define_pd_global(intx, ThreadStackSize, 2048); // 0 => use system default >++define_pd_global(intx, VMThreadStackSize, 2048); >++ >++define_pd_global(intx, CompilerThreadStackSize, 2048); >++ >++define_pd_global(uintx,JVMInvokeMethodSlack, 8192); >++ >++// Used on 64 bit platforms for UseCompressedOops base address >++define_pd_global(uintx,HeapBaseMinAddress, 2*G); >++ >++extern __thread Thread *aarch64_currentThread; >++ >++#endif // OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp >+new file mode 100644 >+index 0000000000..b733db1957 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp >+@@ -0,0 +1,73 @@ >++/* >++ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#ifndef OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP >++#define OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP >++ >++// Included in orderAccess.hpp header file. >++ >++#include "vm_version_aarch64.hpp" >++ >++// Implementation of class OrderAccess. >++ >++inline void OrderAccess::loadload() { acquire(); } >++inline void OrderAccess::storestore() { release(); } >++inline void OrderAccess::loadstore() { acquire(); } >++inline void OrderAccess::storeload() { fence(); } >++ >++inline void OrderAccess::acquire() { >++ READ_MEM_BARRIER; >++} >++ >++inline void OrderAccess::release() { >++ WRITE_MEM_BARRIER; >++} >++ >++inline void OrderAccess::fence() { >++ FULL_MEM_BARRIER; >++} >++ >++template<size_t byte_size> >++struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE> >++{ >++ template <typename T> >++ T operator()(const volatile T* p) const { T data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } >++}; >++ >++template<size_t byte_size> >++struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X> >++{ >++ template <typename T> >++ void operator()(T v, volatile T* p) const { __atomic_store(p, &v, __ATOMIC_RELEASE); } >++}; >++ >++template<size_t byte_size> >++struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X_FENCE> >++{ >++ template <typename T> >++ void operator()(T v, volatile T* p) const { release_store(p, v); fence(); } >++}; >++ >++#endif // OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp >+new file mode 100644 >+index 0000000000..3c7b15086e >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp >+@@ -0,0 +1,733 @@ >++/* >++ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++// no precompiled headers >++#include "jvm.h" >++#include "asm/macroAssembler.hpp" >++#include "classfile/classLoader.hpp" >++#include "classfile/systemDictionary.hpp" >++#include "classfile/vmSymbols.hpp" >++#include "code/codeCache.hpp" >++#include "code/icBuffer.hpp" >++#include "code/vtableStubs.hpp" >++#include "code/nativeInst.hpp" >++#include "interpreter/interpreter.hpp" >++#include "memory/allocation.inline.hpp" >++#include "os_share_linux.hpp" >++#include "prims/jniFastGetField.hpp" >++#include "prims/jvm_misc.hpp" >++#include "runtime/arguments.hpp" >++#include "runtime/extendedPC.hpp" >++#include "runtime/frame.inline.hpp" >++#include "runtime/interfaceSupport.inline.hpp" >++#include "runtime/java.hpp" >++#include "runtime/javaCalls.hpp" >++#include "runtime/mutexLocker.hpp" >++#include "runtime/osThread.hpp" >++#include "runtime/sharedRuntime.hpp" >++#include "runtime/stubRoutines.hpp" >++#include "runtime/thread.inline.hpp" >++#include "runtime/timer.hpp" >++#include "utilities/debug.hpp" >++#include "utilities/events.hpp" >++#include "utilities/vmError.hpp" >++#ifdef BUILTIN_SIM >++#include "../../../../../../simulator/simulator.hpp" >++#endif >++ >++// put OS-includes here >++# include <sys/types.h> >++# include <sys/mman.h> >++# include <pthread.h> >++# include <signal.h> >++# include <errno.h> >++# include <dlfcn.h> >++# include <stdlib.h> >++# include <stdio.h> >++# include <unistd.h> >++# include <sys/resource.h> >++# include <pthread.h> >++# include <sys/stat.h> >++# include <sys/time.h> >++# include <sys/utsname.h> >++# include <sys/socket.h> >++# include <sys/wait.h> >++# include <pwd.h> >++# include <poll.h> >++# include <ucontext.h> >++# include <fpu_control.h> >++ >++#ifdef BUILTIN_SIM >++#define REG_SP REG_RSP >++#define REG_PC REG_RIP >++#define REG_FP REG_RBP >++#define SPELL_REG_SP "rsp" >++#define SPELL_REG_FP "rbp" >++#else >++#define REG_FP 29 >++#define REG_LR 30 >++ >++#define SPELL_REG_SP "sp" >++#define SPELL_REG_FP "x29" >++#endif >++ >++address os::current_stack_pointer() { >++ register void *esp __asm__ (SPELL_REG_SP); >++ return (address) esp; >++} >++ >++char* os::non_memory_address_word() { >++ // Must never look like an address returned by reserve_memory, >++ // even in its subfields (as defined by the CPU immediate fields, >++ // if the CPU splits constants across multiple instructions). >++ >++ return (char*) 0xffffffffffff; >++} >++ >++address os::Linux::ucontext_get_pc(const ucontext_t * uc) { >++#ifdef BUILTIN_SIM >++ return (address)uc->uc_mcontext.gregs[REG_PC]; >++#else >++ return (address)uc->uc_mcontext.pc; >++#endif >++} >++ >++void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) { >++#ifdef BUILTIN_SIM >++ uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc; >++#else >++ uc->uc_mcontext.pc = (intptr_t)pc; >++#endif >++} >++ >++intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) { >++#ifdef BUILTIN_SIM >++ return (intptr_t*)uc->uc_mcontext.gregs[REG_SP]; >++#else >++ return (intptr_t*)uc->uc_mcontext.sp; >++#endif >++} >++ >++intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { >++#ifdef BUILTIN_SIM >++ return (intptr_t*)uc->uc_mcontext.gregs[REG_FP]; >++#else >++ return (intptr_t*)uc->uc_mcontext.regs[REG_FP]; >++#endif >++} >++ >++// For Forte Analyzer AsyncGetCallTrace profiling support - thread >++// is currently interrupted by SIGPROF. >++// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal >++// frames. Currently we don't do that on Linux, so it's the same as >++// os::fetch_frame_from_context(). >++ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread, >++ const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) { >++ >++ assert(thread != NULL, "just checking"); >++ assert(ret_sp != NULL, "just checking"); >++ assert(ret_fp != NULL, "just checking"); >++ >++ return os::fetch_frame_from_context(uc, ret_sp, ret_fp); >++} >++ >++ExtendedPC os::fetch_frame_from_context(const void* ucVoid, >++ intptr_t** ret_sp, intptr_t** ret_fp) { >++ >++ ExtendedPC epc; >++ const ucontext_t* uc = (const ucontext_t*)ucVoid; >++ >++ if (uc != NULL) { >++ epc = ExtendedPC(os::Linux::ucontext_get_pc(uc)); >++ if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc); >++ if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc); >++ } else { >++ // construct empty ExtendedPC for return value checking >++ epc = ExtendedPC(NULL); >++ if (ret_sp) *ret_sp = (intptr_t *)NULL; >++ if (ret_fp) *ret_fp = (intptr_t *)NULL; >++ } >++ >++ return epc; >++} >++ >++frame os::fetch_frame_from_context(const void* ucVoid) { >++ intptr_t* sp; >++ intptr_t* fp; >++ ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp); >++ return frame(sp, fp, epc.pc()); >++} >++ >++bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) { >++ address pc = (address) os::Linux::ucontext_get_pc(uc); >++ if (Interpreter::contains(pc)) { >++ // interpreter performs stack banging after the fixed frame header has >++ // been generated while the compilers perform it before. To maintain >++ // semantic consistency between interpreted and compiled frames, the >++ // method returns the Java sender of the current frame. >++ *fr = os::fetch_frame_from_context(uc); >++ if (!fr->is_first_java_frame()) { >++ assert(fr->safe_for_sender(thread), "Safety check"); >++ *fr = fr->java_sender(); >++ } >++ } else { >++ // more complex code with compiled code >++ assert(!Interpreter::contains(pc), "Interpreted methods should have been handled above"); >++ CodeBlob* cb = CodeCache::find_blob(pc); >++ if (cb == NULL || !cb->is_nmethod() || cb->is_frame_complete_at(pc)) { >++ // Not sure where the pc points to, fallback to default >++ // stack overflow handling >++ return false; >++ } else { >++ // In compiled code, the stack banging is performed before LR >++ // has been saved in the frame. LR is live, and SP and FP >++ // belong to the caller. >++ intptr_t* fp = os::Linux::ucontext_get_fp(uc); >++ intptr_t* sp = os::Linux::ucontext_get_sp(uc); >++ address pc = (address)(uc->uc_mcontext.regs[REG_LR] >++ - NativeInstruction::instruction_size); >++ *fr = frame(sp, fp, pc); >++ if (!fr->is_java_frame()) { >++ assert(fr->safe_for_sender(thread), "Safety check"); >++ assert(!fr->is_first_frame(), "Safety check"); >++ *fr = fr->java_sender(); >++ } >++ } >++ } >++ assert(fr->is_java_frame(), "Safety check"); >++ return true; >++} >++ >++// By default, gcc always saves frame pointer rfp on this stack. This >++// may get turned off by -fomit-frame-pointer. >++frame os::get_sender_for_C_frame(frame* fr) { >++#ifdef BUILTIN_SIM >++ return frame(fr->sender_sp(), fr->link(), fr->sender_pc()); >++#else >++ return frame(fr->link(), fr->link(), fr->sender_pc()); >++#endif >++} >++ >++intptr_t* _get_previous_fp() { >++ register intptr_t **fp __asm__ (SPELL_REG_FP); >++ >++ // fp is for this frame (_get_previous_fp). We want the fp for the >++ // caller of os::current_frame*(), so go up two frames. However, for >++ // optimized builds, _get_previous_fp() will be inlined, so only go >++ // up 1 frame in that case. >++ #ifdef _NMT_NOINLINE_ >++ return **(intptr_t***)fp; >++ #else >++ return *fp; >++ #endif >++} >++ >++ >++frame os::current_frame() { >++ intptr_t* fp = _get_previous_fp(); >++ frame myframe((intptr_t*)os::current_stack_pointer(), >++ (intptr_t*)fp, >++ CAST_FROM_FN_PTR(address, os::current_frame)); >++ if (os::is_first_C_frame(&myframe)) { >++ // stack is not walkable >++ return frame(); >++ } else { >++ return os::get_sender_for_C_frame(&myframe); >++ } >++} >++ >++// Utility functions >++ >++// From IA32 System Programming Guide >++enum { >++ trap_page_fault = 0xE >++}; >++ >++#ifdef BUILTIN_SIM >++extern "C" void Fetch32PFI () ; >++extern "C" void Fetch32Resume () ; >++extern "C" void FetchNPFI () ; >++extern "C" void FetchNResume () ; >++#endif >++ >++extern "C" JNIEXPORT int >++JVM_handle_linux_signal(int sig, >++ siginfo_t* info, >++ void* ucVoid, >++ int abort_if_unrecognized) { >++ ucontext_t* uc = (ucontext_t*) ucVoid; >++ >++ Thread* t = Thread::current_or_null_safe(); >++ >++ // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away >++ // (no destructors can be run) >++ os::ThreadCrashProtection::check_crash_protection(sig, t); >++ >++ SignalHandlerMark shm(t); >++ >++ // Note: it's not uncommon that JNI code uses signal/sigset to install >++ // then restore certain signal handler (e.g. to temporarily block SIGPIPE, >++ // or have a SIGILL handler when detecting CPU type). When that happens, >++ // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To >++ // avoid unnecessary crash when libjsig is not preloaded, try handle signals >++ // that do not require siginfo/ucontext first. >++ >++ if (sig == SIGPIPE || sig == SIGXFSZ) { >++ // allow chained handler to go first >++ if (os::Linux::chained_handler(sig, info, ucVoid)) { >++ return true; >++ } else { >++ // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219 >++ return true; >++ } >++ } >++ >++#ifdef CAN_SHOW_REGISTERS_ON_ASSERT >++ if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) { >++ handle_assert_poison_fault(ucVoid, info->si_addr); >++ return 1; >++ } >++#endif >++ >++ JavaThread* thread = NULL; >++ VMThread* vmthread = NULL; >++ if (os::Linux::signal_handlers_are_installed) { >++ if (t != NULL ){ >++ if(t->is_Java_thread()) { >++ thread = (JavaThread*)t; >++ } >++ else if(t->is_VM_thread()){ >++ vmthread = (VMThread *)t; >++ } >++ } >++ } >++/* >++ NOTE: does not seem to work on linux. >++ if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) { >++ // can't decode this kind of signal >++ info = NULL; >++ } else { >++ assert(sig == info->si_signo, "bad siginfo"); >++ } >++*/ >++ // decide if this trap can be handled by a stub >++ address stub = NULL; >++ >++ address pc = NULL; >++ >++ //%note os_trap_1 >++ if (info != NULL && uc != NULL && thread != NULL) { >++ pc = (address) os::Linux::ucontext_get_pc(uc); >++ >++#ifdef BUILTIN_SIM >++ if (pc == (address) Fetch32PFI) { >++ uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ; >++ return 1 ; >++ } >++ if (pc == (address) FetchNPFI) { >++ uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ; >++ return 1 ; >++ } >++#else >++ if (StubRoutines::is_safefetch_fault(pc)) { >++ os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); >++ return 1; >++ } >++#endif >++ >++ address addr = (address) info->si_addr; >++ >++ // Make sure the high order byte is sign extended, as it may be masked away by the hardware. >++ if ((uintptr_t(addr) & (uintptr_t(1) << 55)) != 0) { >++ addr = address(uintptr_t(addr) | (uintptr_t(0xFF) << 56)); >++ } >++ >++ // Handle ALL stack overflow variations here >++ if (sig == SIGSEGV) { >++ // check if fault address is within thread stack >++ if (thread->on_local_stack(addr)) { >++ // stack overflow >++ if (thread->in_stack_yellow_reserved_zone(addr)) { >++ if (thread->thread_state() == _thread_in_Java) { >++ if (thread->in_stack_reserved_zone(addr)) { >++ frame fr; >++ if (os::Linux::get_frame_at_stack_banging_point(thread, uc, &fr)) { >++ assert(fr.is_java_frame(), "Must be a Java frame"); >++ frame activation = >++ SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr); >++ if (activation.sp() != NULL) { >++ thread->disable_stack_reserved_zone(); >++ if (activation.is_interpreted_frame()) { >++ thread->set_reserved_stack_activation((address)( >++ activation.fp() + frame::interpreter_frame_initial_sp_offset)); >++ } else { >++ thread->set_reserved_stack_activation((address)activation.unextended_sp()); >++ } >++ return 1; >++ } >++ } >++ } >++ // Throw a stack overflow exception. Guard pages will be reenabled >++ // while unwinding the stack. >++ thread->disable_stack_yellow_reserved_zone(); >++ stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); >++ } else { >++ // Thread was in the vm or native code. Return and try to finish. >++ thread->disable_stack_yellow_reserved_zone(); >++ return 1; >++ } >++ } else if (thread->in_stack_red_zone(addr)) { >++ // Fatal red zone violation. Disable the guard pages and fall through >++ // to handle_unexpected_exception way down below. >++ thread->disable_stack_red_zone(); >++ tty->print_raw_cr("An irrecoverable stack overflow has occurred."); >++ >++ // This is a likely cause, but hard to verify. Let's just print >++ // it as a hint. >++ tty->print_raw_cr("Please check if any of your loaded .so files has " >++ "enabled executable stack (see man page execstack(8))"); >++ } else { >++ // Accessing stack address below sp may cause SEGV if current >++ // thread has MAP_GROWSDOWN stack. This should only happen when >++ // current thread was created by user code with MAP_GROWSDOWN flag >++ // and then attached to VM. See notes in os_linux.cpp. >++ if (thread->osthread()->expanding_stack() == 0) { >++ thread->osthread()->set_expanding_stack(); >++ if (os::Linux::manually_expand_stack(thread, addr)) { >++ thread->osthread()->clear_expanding_stack(); >++ return 1; >++ } >++ thread->osthread()->clear_expanding_stack(); >++ } else { >++ fatal("recursive segv. expanding stack."); >++ } >++ } >++ } >++ } >++ >++ if (thread->thread_state() == _thread_in_Java) { >++ // Java thread running in Java code => find exception handler if any >++ // a fault inside compiled code, the interpreter, or a stub >++ >++ // Handle signal from NativeJump::patch_verified_entry(). >++ if ((sig == SIGILL || sig == SIGTRAP) >++ && nativeInstruction_at(pc)->is_sigill_zombie_not_entrant()) { >++ if (TraceTraps) { >++ tty->print_cr("trap: zombie_not_entrant (%s)", (sig == SIGTRAP) ? "SIGTRAP" : "SIGILL"); >++ } >++ stub = SharedRuntime::get_handle_wrong_method_stub(); >++ } else if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { >++ stub = SharedRuntime::get_poll_stub(pc); >++ } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) { >++ // BugId 4454115: A read from a MappedByteBuffer can fault >++ // here if the underlying file has been truncated. >++ // Do not crash the VM in such a case. >++ CodeBlob* cb = CodeCache::find_blob_unsafe(pc); >++ CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL; >++ if (nm != NULL && nm->has_unsafe_access()) { >++ address next_pc = pc + NativeCall::instruction_size; >++ stub = SharedRuntime::handle_unsafe_access(thread, next_pc); >++ } >++ } >++ else >++ >++ if (sig == SIGFPE && >++ (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) { >++ stub = >++ SharedRuntime:: >++ continuation_for_implicit_exception(thread, >++ pc, >++ SharedRuntime:: >++ IMPLICIT_DIVIDE_BY_ZERO); >++ } else if (sig == SIGSEGV && >++ !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) { >++ // Determination of interpreter/vtable stub/compiled code null exception >++ stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); >++ } >++ } else if (thread->thread_state() == _thread_in_vm && >++ sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ >++ thread->doing_unsafe_access()) { >++ address next_pc = pc + NativeCall::instruction_size; >++ stub = SharedRuntime::handle_unsafe_access(thread, next_pc); >++ } >++ >++ // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in >++ // and the heap gets shrunk before the field access. >++ if ((sig == SIGSEGV) || (sig == SIGBUS)) { >++ address addr = JNI_FastGetField::find_slowcase_pc(pc); >++ if (addr != (address)-1) { >++ stub = addr; >++ } >++ } >++ } >++ >++ if (stub != NULL) { >++ // save all thread context in case we need to restore it >++ if (thread != NULL) thread->set_saved_exception_pc(pc); >++ >++ os::Linux::ucontext_set_pc(uc, stub); >++ return true; >++ } >++ >++ // signal-chaining >++ if (os::Linux::chained_handler(sig, info, ucVoid)) { >++ return true; >++ } >++ >++ if (!abort_if_unrecognized) { >++ // caller wants another chance, so give it to him >++ return false; >++ } >++ >++ if (pc == NULL && uc != NULL) { >++ pc = os::Linux::ucontext_get_pc(uc); >++ } >++ >++ // unmask current signal >++ sigset_t newset; >++ sigemptyset(&newset); >++ sigaddset(&newset, sig); >++ sigprocmask(SIG_UNBLOCK, &newset, NULL); >++ >++ VMError::report_and_die(t, sig, pc, info, ucVoid); >++ >++ ShouldNotReachHere(); >++ return true; // Mute compiler >++} >++ >++void os::Linux::init_thread_fpu_state(void) { >++} >++ >++int os::Linux::get_fpu_control_word(void) { >++ return 0; >++} >++ >++void os::Linux::set_fpu_control_word(int fpu_control) { >++} >++ >++// Check that the linux kernel version is 2.4 or higher since earlier >++// versions do not support SSE without patches. >++bool os::supports_sse() { >++ return true; >++} >++ >++bool os::is_allocatable(size_t bytes) { >++ return true; >++} >++ >++//////////////////////////////////////////////////////////////////////////////// >++// thread stack >++ >++// Minimum usable stack sizes required to get to user code. Space for >++// HotSpot guard pages is added later. >++size_t os::Posix::_compiler_thread_min_stack_allowed = 72 * K; >++size_t os::Posix::_java_thread_min_stack_allowed = 72 * K; >++size_t os::Posix::_vm_internal_thread_min_stack_allowed = 72 * K; >++ >++// return default stack size for thr_type >++size_t os::Posix::default_stack_size(os::ThreadType thr_type) { >++ // default stack size (compiler thread needs larger stack) >++ size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M); >++ return s; >++} >++ >++///////////////////////////////////////////////////////////////////////////// >++// helper functions for fatal error handler >++ >++void os::print_context(outputStream *st, const void *context) { >++ if (context == NULL) return; >++ >++ const ucontext_t *uc = (const ucontext_t*)context; >++ st->print_cr("Registers:"); >++#ifdef BUILTIN_SIM >++ st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]); >++ st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]); >++ st->print(", RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]); >++ st->print(", RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]); >++ st->cr(); >++ st->print( "RSP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSP]); >++ st->print(", RBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBP]); >++ st->print(", RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]); >++ st->print(", RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]); >++ st->cr(); >++ st->print( "R8 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]); >++ st->print(", R9 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]); >++ st->print(", R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]); >++ st->print(", R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]); >++ st->cr(); >++ st->print( "R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]); >++ st->print(", R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]); >++ st->print(", R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]); >++ st->print(", R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]); >++ st->cr(); >++ st->print( "RIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RIP]); >++ st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]); >++ st->print(", CSGSFS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_CSGSFS]); >++ st->print(", ERR=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ERR]); >++ st->cr(); >++ st->print(" TRAPNO=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_TRAPNO]); >++ st->cr(); >++#else >++ for (int r = 0; r < 31; r++) { >++ st->print("R%-2d=", r); >++ print_location(st, uc->uc_mcontext.regs[r]); >++ } >++#endif >++ st->cr(); >++ >++ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); >++ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp)); >++ print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t)); >++ st->cr(); >++ >++ // Note: it may be unsafe to inspect memory near pc. For example, pc may >++ // point to garbage if entry point in an nmethod is corrupted. Leave >++ // this at the end, and hope for the best. >++ address pc = os::Linux::ucontext_get_pc(uc); >++ st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc)); >++ print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); >++} >++ >++void os::print_register_info(outputStream *st, const void *context) { >++ if (context == NULL) return; >++ >++ const ucontext_t *uc = (const ucontext_t*)context; >++ >++ st->print_cr("Register to memory mapping:"); >++ st->cr(); >++ >++ // this is horrendously verbose but the layout of the registers in the >++ // context does not match how we defined our abstract Register set, so >++ // we can't just iterate through the gregs area >++ >++ // this is only for the "general purpose" registers >++ >++#ifdef BUILTIN_SIM >++ st->print("RAX="); print_location(st, uc->uc_mcontext.gregs[REG_RAX]); >++ st->print("RBX="); print_location(st, uc->uc_mcontext.gregs[REG_RBX]); >++ st->print("RCX="); print_location(st, uc->uc_mcontext.gregs[REG_RCX]); >++ st->print("RDX="); print_location(st, uc->uc_mcontext.gregs[REG_RDX]); >++ st->print("RSP="); print_location(st, uc->uc_mcontext.gregs[REG_RSP]); >++ st->print("RBP="); print_location(st, uc->uc_mcontext.gregs[REG_RBP]); >++ st->print("RSI="); print_location(st, uc->uc_mcontext.gregs[REG_RSI]); >++ st->print("RDI="); print_location(st, uc->uc_mcontext.gregs[REG_RDI]); >++ st->print("R8 ="); print_location(st, uc->uc_mcontext.gregs[REG_R8]); >++ st->print("R9 ="); print_location(st, uc->uc_mcontext.gregs[REG_R9]); >++ st->print("R10="); print_location(st, uc->uc_mcontext.gregs[REG_R10]); >++ st->print("R11="); print_location(st, uc->uc_mcontext.gregs[REG_R11]); >++ st->print("R12="); print_location(st, uc->uc_mcontext.gregs[REG_R12]); >++ st->print("R13="); print_location(st, uc->uc_mcontext.gregs[REG_R13]); >++ st->print("R14="); print_location(st, uc->uc_mcontext.gregs[REG_R14]); >++ st->print("R15="); print_location(st, uc->uc_mcontext.gregs[REG_R15]); >++#else >++ for (int r = 0; r < 31; r++) >++ st->print_cr( "R%d=" INTPTR_FORMAT, r, (uintptr_t)uc->uc_mcontext.regs[r]); >++#endif >++ st->cr(); >++} >++ >++void os::setup_fpu() { >++} >++ >++#ifndef PRODUCT >++void os::verify_stack_alignment() { >++ assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment"); >++} >++#endif >++ >++int os::extra_bang_size_in_bytes() { >++ // AArch64 does not require the additional stack bang. >++ return 0; >++} >++ >++extern "C" { >++ int SpinPause() { >++ return 0; >++ } >++ >++ void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { >++ if (from > to) { >++ jshort *end = from + count; >++ while (from < end) >++ *(to++) = *(from++); >++ } >++ else if (from < to) { >++ jshort *end = from; >++ from += count - 1; >++ to += count - 1; >++ while (from >= end) >++ *(to--) = *(from--); >++ } >++ } >++ void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) { >++ if (from > to) { >++ jint *end = from + count; >++ while (from < end) >++ *(to++) = *(from++); >++ } >++ else if (from < to) { >++ jint *end = from; >++ from += count - 1; >++ to += count - 1; >++ while (from >= end) >++ *(to--) = *(from--); >++ } >++ } >++ void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { >++ if (from > to) { >++ jlong *end = from + count; >++ while (from < end) >++ os::atomic_copy64(from++, to++); >++ } >++ else if (from < to) { >++ jlong *end = from; >++ from += count - 1; >++ to += count - 1; >++ while (from >= end) >++ os::atomic_copy64(from--, to--); >++ } >++ } >++ >++ void _Copy_arrayof_conjoint_bytes(HeapWord* from, >++ HeapWord* to, >++ size_t count) { >++ memmove(to, from, count); >++ } >++ void _Copy_arrayof_conjoint_jshorts(HeapWord* from, >++ HeapWord* to, >++ size_t count) { >++ memmove(to, from, count * 2); >++ } >++ void _Copy_arrayof_conjoint_jints(HeapWord* from, >++ HeapWord* to, >++ size_t count) { >++ memmove(to, from, count * 4); >++ } >++ void _Copy_arrayof_conjoint_jlongs(HeapWord* from, >++ HeapWord* to, >++ size_t count) { >++ memmove(to, from, count * 8); >++ } >++}; >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp >+new file mode 100644 >+index 0000000000..d2d02efc54 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp >+@@ -0,0 +1,45 @@ >++/* >++ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#ifndef OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP >++#define OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP >++ >++ static void setup_fpu(); >++ static bool supports_sse(); >++ >++ static jlong rdtsc(); >++ >++ static bool is_allocatable(size_t bytes); >++ >++ // Used to register dynamic code cache area with the OS >++ // Note: Currently only used in 64 bit Windows implementations >++ static bool register_code_area(char *low, char *high) { return true; } >++ >++ // Atomically copy 64 bits of data >++ static void atomic_copy64(const volatile void *src, volatile void *dst) { >++ *(jlong *) dst = *(const jlong *) src; >++ } >++ >++#endif // OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp >+new file mode 100644 >+index 0000000000..2402d13540 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp >+@@ -0,0 +1,40 @@ >++/* >++ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#ifndef OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP >++#define OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP >++ >++#include "runtime/os.hpp" >++ >++// See http://www.technovelty.org/code/c/reading-rdtsc.htl for details >++inline jlong os::rdtsc() { >++ uint64_t res; >++ uint32_t ts1, ts2; >++ __asm__ __volatile__ ("rdtsc" : "=a" (ts1), "=d" (ts2)); >++ res = ((uint64_t)ts1 | (uint64_t)ts2 << 32); >++ return (jlong)res; >++} >++ >++#endif // OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp >+new file mode 100644 >+index 0000000000..687eb50bab >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp >+@@ -0,0 +1,46 @@ >++/* >++ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#ifndef OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP >++#define OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP >++ >++#include "runtime/prefetch.hpp" >++ >++ >++inline void Prefetch::read (void *loc, intx interval) { >++#ifndef BUILTIN_SIM >++ if (interval >= 0) >++ asm("prfm PLDL1KEEP, [%0, %1]" : : "r"(loc), "r"(interval)); >++#endif >++} >++ >++inline void Prefetch::write(void *loc, intx interval) { >++#ifndef BUILTIN_SIM >++ if (interval >= 0) >++ asm("prfm PSTL1KEEP, [%0, %1]" : : "r"(loc), "r"(interval)); >++#endif >++} >++ >++#endif // OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/threadLS_bsd_aarch64.s b/src/hotspot/os_cpu/bsd_aarch64/threadLS_bsd_aarch64.s >+new file mode 100644 >+index 0000000000..f541844b9d >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/threadLS_bsd_aarch64.s >+@@ -0,0 +1,44 @@ >++// Copyright (c) 2015, Red Hat Inc. All rights reserved. >++// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++// >++// This code is free software; you can redistribute it and/or modify it >++// under the terms of the GNU General Public License version 2 only, as >++// published by the Free Software Foundation. >++// >++// This code is distributed in the hope that it will be useful, but WITHOUT >++// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++// version 2 for more details (a copy is included in the LICENSE file that >++// accompanied this code). >++// >++// You should have received a copy of the GNU General Public License version >++// 2 along with this work; if not, write to the Free Software Foundation, >++// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++// >++// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++// or visit www.oracle.com if you need additional information or have any >++// questions. >++ >++ // JavaThread::aarch64_get_thread_helper() >++ // >++ // Return the current thread pointer in x0. >++ // Clobber x1, flags. >++ // All other registers are preserved, >++ >++ .global _ZN10JavaThread25aarch64_get_thread_helperEv >++ .type _ZN10JavaThread25aarch64_get_thread_helperEv, %function >++ >++_ZN10JavaThread25aarch64_get_thread_helperEv: >++ stp x29, x30, [sp, -16]! >++ adrp x0, :tlsdesc:_ZN6Thread12_thr_currentE >++ ldr x1, [x0, #:tlsdesc_lo12:_ZN6Thread12_thr_currentE] >++ add x0, x0, :tlsdesc_lo12:_ZN6Thread12_thr_currentE >++ .tlsdesccall _ZN6Thread12_thr_currentE >++ blr x1 >++ mrs x1, tpidr_el0 >++ add x0, x1, x0 >++ ldr x0, [x0] >++ ldp x29, x30, [sp], 16 >++ ret >++ >++ .size _ZN10JavaThread25aarch64_get_thread_helperEv, .-_ZN10JavaThread25aarch64_get_thread_helperEv >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp >+new file mode 100644 >+index 0000000000..9084daeaa2 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp >+@@ -0,0 +1,104 @@ >++/* >++ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#include "precompiled.hpp" >++#include "memory/metaspaceShared.hpp" >++#include "runtime/frame.inline.hpp" >++#include "runtime/thread.inline.hpp" >++ >++frame JavaThread::pd_last_frame() { >++ assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); >++ return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); >++} >++ >++// For Forte Analyzer AsyncGetCallTrace profiling support - thread is >++// currently interrupted by SIGPROF >++bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr, >++ void* ucontext, bool isInJava) { >++ >++ assert(Thread::current() == this, "caller must be current thread"); >++ return pd_get_top_frame(fr_addr, ucontext, isInJava); >++} >++ >++bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) { >++ return pd_get_top_frame(fr_addr, ucontext, isInJava); >++} >++ >++bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) { >++ assert(this->is_Java_thread(), "must be JavaThread"); >++ JavaThread* jt = (JavaThread *)this; >++ >++ // If we have a last_Java_frame, then we should use it even if >++ // isInJava == true. It should be more reliable than ucontext info. >++ if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { >++ *fr_addr = jt->pd_last_frame(); >++ return true; >++ } >++ >++ // At this point, we don't have a last_Java_frame, so >++ // we try to glean some information out of the ucontext >++ // if we were running Java code when SIGPROF came in. >++ if (isInJava) { >++ ucontext_t* uc = (ucontext_t*) ucontext; >++ >++ intptr_t* ret_fp; >++ intptr_t* ret_sp; >++ ExtendedPC addr = os::Linux::fetch_frame_from_ucontext(this, uc, >++ &ret_sp, &ret_fp); >++ if (addr.pc() == NULL || ret_sp == NULL ) { >++ // ucontext wasn't useful >++ return false; >++ } >++ >++ if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) { >++ // In the middle of a trampoline call. Bail out for safety. >++ // This happens rarely so shouldn't affect profiling. >++ return false; >++ } >++ >++ frame ret_frame(ret_sp, ret_fp, addr.pc()); >++ if (!ret_frame.safe_for_sender(jt)) { >++#ifdef COMPILER2 >++ frame ret_frame2(ret_sp, NULL, addr.pc()); >++ if (!ret_frame2.safe_for_sender(jt)) { >++ // nothing else to try if the frame isn't good >++ return false; >++ } >++ ret_frame = ret_frame2; >++#else >++ // nothing else to try if the frame isn't good >++ return false; >++#endif /* COMPILER2 */ >++ } >++ *fr_addr = ret_frame; >++ return true; >++ } >++ >++ // nothing else to try >++ return false; >++} >++ >++void JavaThread::cache_global_variables() { } >++ >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp >+new file mode 100644 >+index 0000000000..a2261b1906 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp >+@@ -0,0 +1,80 @@ >++/* >++ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#ifndef OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP >++#define OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP >++ >++ private: >++#ifdef ASSERT >++ // spill stack holds N callee-save registers at each Java call and >++ // grows downwards towards limit >++ // we need limit to check we have space for a spill and base so we >++ // can identify all live spill frames at GC (eventually) >++ address _spill_stack; >++ address _spill_stack_base; >++ address _spill_stack_limit; >++#endif // ASSERT >++ >++ void pd_initialize() { >++ _anchor.clear(); >++ } >++ >++ frame pd_last_frame(); >++ >++ public: >++ // Mutators are highly dangerous.... >++ intptr_t* last_Java_fp() { return _anchor.last_Java_fp(); } >++ void set_last_Java_fp(intptr_t* fp) { _anchor.set_last_Java_fp(fp); } >++ >++ void set_base_of_stack_pointer(intptr_t* base_sp) { >++ } >++ >++ static ByteSize last_Java_fp_offset() { >++ return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_fp_offset(); >++ } >++ >++ intptr_t* base_of_stack_pointer() { >++ return NULL; >++ } >++ void record_base_of_stack_pointer() { >++ } >++ >++ bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, >++ bool isInJava); >++ >++ bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava); >++private: >++ bool pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava); >++public: >++ >++ static Thread *aarch64_get_thread_helper(); >++ >++ // These routines are only used on cpu architectures that >++ // have separate register stacks (Itanium). >++ static bool register_stack_overflow() { return false; } >++ static void enable_register_stack_guard() {} >++ static void disable_register_stack_guard() {} >++ >++#endif // OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp >+new file mode 100644 >+index 0000000000..fa5885ca62 >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp >+@@ -0,0 +1,55 @@ >++/* >++ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#ifndef OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP >++#define OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP >++ >++// These are the OS and CPU-specific fields, types and integer >++// constants required by the Serviceability Agent. This file is >++// referenced by vmStructs.cpp. >++ >++#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ >++ \ >++ /******************************/ \ >++ /* Threads (NOTE: incomplete) */ \ >++ /******************************/ \ >++ nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ >++ nonstatic_field(OSThread, _pthread_id, pthread_t) >++ >++ >++#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \ >++ \ >++ /**********************/ \ >++ /* Posix Thread IDs */ \ >++ /**********************/ \ >++ \ >++ declare_integer_type(OSThread::thread_id_t) \ >++ declare_unsigned_integer_type(pthread_t) >++ >++#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) >++ >++#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) >++ >++#endif // OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp >+new file mode 100644 >+index 0000000000..51089d12ef >+--- /dev/null >++++ src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp >+@@ -0,0 +1,29 @@ >++/* >++ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2014, Red Hat Inc. All rights reserved. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++#include "precompiled.hpp" >++#include "runtime/os.hpp" >++#include "vm_version_aarch64.hpp" >++ >+diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java >+new file mode 100644 >+index 0000000000..28e36759a5 >+--- /dev/null >++++ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java >+@@ -0,0 +1,86 @@ >++/* >++ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2015, Red Hat Inc. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++package sun.jvm.hotspot.debugger.linux.aarch64; >++ >++import sun.jvm.hotspot.debugger.*; >++import sun.jvm.hotspot.debugger.aarch64.*; >++import sun.jvm.hotspot.debugger.linux.*; >++import sun.jvm.hotspot.debugger.cdbg.*; >++import sun.jvm.hotspot.debugger.cdbg.basic.*; >++ >++final public class LinuxAARCH64CFrame extends BasicCFrame { >++ public LinuxAARCH64CFrame(LinuxDebugger dbg, Address fp, Address pc) { >++ super(dbg.getCDebugger()); >++ this.fp = fp; >++ this.pc = pc; >++ this.dbg = dbg; >++ } >++ >++ // override base class impl to avoid ELF parsing >++ public ClosestSymbol closestSymbolToPC() { >++ // try native lookup in debugger. >++ return dbg.lookup(dbg.getAddressValue(pc())); >++ } >++ >++ public Address pc() { >++ return pc; >++ } >++ >++ public Address localVariableBase() { >++ return fp; >++ } >++ >++ public CFrame sender(ThreadProxy thread) { >++ AARCH64ThreadContext context = (AARCH64ThreadContext) thread.getContext(); >++ Address rsp = context.getRegisterAsAddress(AARCH64ThreadContext.SP); >++ >++ if ((fp == null) || fp.lessThan(rsp)) { >++ return null; >++ } >++ >++ // Check alignment of fp >++ if (dbg.getAddressValue(fp) % (2 * ADDRESS_SIZE) != 0) { >++ return null; >++ } >++ >++ Address nextFP = fp.getAddressAt(0 * ADDRESS_SIZE); >++ if (nextFP == null || nextFP.lessThanOrEqual(fp)) { >++ return null; >++ } >++ Address nextPC = fp.getAddressAt(1 * ADDRESS_SIZE); >++ if (nextPC == null) { >++ return null; >++ } >++ return new LinuxAARCH64CFrame(dbg, nextFP, nextPC); >++ } >++ >++ // package/class internals only >++ private static final int ADDRESS_SIZE = 8; >++ private Address pc; >++ private Address sp; >++ private Address fp; >++ private LinuxDebugger dbg; >++} >+diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java >+new file mode 100644 >+index 0000000000..7700316867 >+--- /dev/null >++++ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java >+@@ -0,0 +1,47 @@ >++/* >++ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. >++ * Copyright (c) 2015, Red Hat Inc. >++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. >++ * >++ * This code is free software; you can redistribute it and/or modify it >++ * under the terms of the GNU General Public License version 2 only, as >++ * published by the Free Software Foundation. >++ * >++ * This code is distributed in the hope that it will be useful, but WITHOUT >++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >++ * version 2 for more details (a copy is included in the LICENSE file that >++ * accompanied this code). >++ * >++ * You should have received a copy of the GNU General Public License version >++ * 2 along with this work; if not, write to the Free Software Foundation, >++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >++ * >++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA >++ * or visit www.oracle.com if you need additional information or have any >++ * questions. >++ * >++ */ >++ >++package sun.jvm.hotspot.debugger.linux.aarch64; >++ >++import sun.jvm.hotspot.debugger.*; >++import sun.jvm.hotspot.debugger.aarch64.*; >++import sun.jvm.hotspot.debugger.linux.*; >++ >++public class LinuxAARCH64ThreadContext extends AARCH64ThreadContext { >++ private LinuxDebugger debugger; >++ >++ public LinuxAARCH64ThreadContext(LinuxDebugger debugger) { >++ super(); >++ this.debugger = debugger; >++ } >++ >++ public void setRegisterAsAddress(int index, Address value) { >++ setRegister(index, debugger.getAddressValue(value)); >++ } >++ >++ public Address getRegisterAsAddress(int index) { >++ return debugger.newAddress(getRegister(index)); >++ } >++} >+ >+From a802e4bfd9de13e7373890328fd7ad6725cbcde2 Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:11:26 +0200 >+Subject: [PATCH 02/17] Mechanically convert linux -> bsd >+ >+for file in $(ls src/hotspot/os_cpu/bsd_aarch64/*) \ >+ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java \ >+ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java >+do >+ sed -i '' 's/linux/bsd/g' ${file} >+ sed -i '' 's/Linux/Bsd/g' ${file} >+ sed -i '' 's/LINUX/BSD/g' ${file} >+done >+--- >+ .../os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp | 6 +- >+ src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad | 2 +- >+ .../bsd_aarch64/bytes_bsd_aarch64.inline.hpp | 6 +- >+ .../bsd_aarch64/copy_bsd_aarch64.inline.hpp | 6 +- >+ .../bsd_aarch64/globals_bsd_aarch64.hpp | 6 +- >+ .../bsd_aarch64/orderAccess_bsd_aarch64.hpp | 6 +- >+ .../os_cpu/bsd_aarch64/os_bsd_aarch64.cpp | 66 +++++++++---------- >+ .../os_cpu/bsd_aarch64/os_bsd_aarch64.hpp | 6 +- >+ .../bsd_aarch64/os_bsd_aarch64.inline.hpp | 6 +- >+ .../prefetch_bsd_aarch64.inline.hpp | 6 +- >+ .../os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp | 2 +- >+ .../os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp | 6 +- >+ .../bsd_aarch64/vmStructs_bsd_aarch64.hpp | 6 +- >+ .../bsd/aarch64/BsdAARCH64CFrame.java | 12 ++-- >+ .../bsd/aarch64/BsdAARCH64ThreadContext.java | 10 +-- >+ 15 files changed, 76 insertions(+), 76 deletions(-) >+ >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp >+index e1f59bb43e..2c8dd82eac 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp >+@@ -23,8 +23,8 @@ >+ * >+ */ >+ >+-#ifndef OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP >+-#define OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP >++#ifndef OS_CPU_BSD_AARCH64_VM_ATOMIC_BSD_AARCH64_HPP >++#define OS_CPU_BSD_AARCH64_VM_ATOMIC_BSD_AARCH64_HPP >+ >+ #include "vm_version_aarch64.hpp" >+ >+@@ -72,4 +72,4 @@ inline T Atomic::PlatformCmpxchg<byte_size>::operator()(T exchange_value, >+ } >+ } >+ >+-#endif // OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP >++#endif // OS_CPU_BSD_AARCH64_VM_ATOMIC_BSD_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad b/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad >+index c3b8cd2c45..01b5ca0bc0 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad >++++ src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad >+@@ -23,7 +23,7 @@ >+ // >+ // >+ >+-// AArch64 Linux Architecture Description File >++// AArch64 Bsd Architecture Description File >+ >+ //----------OS-DEPENDENT ENCODING BLOCK---------------------------------------- >+ // This block specifies the encoding classes used by the compiler to >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp >+index e283f86d10..1ed80c3024 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp >+@@ -23,8 +23,8 @@ >+ * >+ */ >+ >+-#ifndef OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP >+-#define OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP >++#ifndef OS_CPU_BSD_AARCH64_VM_BYTES_BSD_AARCH64_INLINE_HPP >++#define OS_CPU_BSD_AARCH64_VM_BYTES_BSD_AARCH64_INLINE_HPP >+ >+ #include <byteswap.h> >+ >+@@ -42,4 +42,4 @@ inline u8 Bytes::swap_u8(u8 x) { >+ return bswap_64(x); >+ } >+ >+-#endif // OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP >++#endif // OS_CPU_BSD_AARCH64_VM_BYTES_BSD_AARCH64_INLINE_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp >+index 794ab349b0..775997a4bf 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp >+@@ -23,8 +23,8 @@ >+ * >+ */ >+ >+-#ifndef OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP >+-#define OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP >++#ifndef OS_CPU_BSD_AARCH64_VM_COPY_BSD_AARCH64_INLINE_HPP >++#define OS_CPU_BSD_AARCH64_VM_COPY_BSD_AARCH64_INLINE_HPP >+ >+ #define COPY_SMALL(from, to, count) \ >+ { \ >+@@ -185,4 +185,4 @@ static void pd_arrayof_conjoint_oops(const HeapWord* from, HeapWord* to, size_t >+ _Copy_arrayof_conjoint_jlongs(from, to, count); >+ } >+ >+-#endif // OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP >++#endif // OS_CPU_BSD_AARCH64_VM_COPY_BSD_AARCH64_INLINE_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp >+index 360be743dd..7fec3eb604 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp >+@@ -23,8 +23,8 @@ >+ * >+ */ >+ >+-#ifndef OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP >+-#define OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP >++#ifndef OS_CPU_BSD_AARCH64_VM_GLOBALS_BSD_AARCH64_HPP >++#define OS_CPU_BSD_AARCH64_VM_GLOBALS_BSD_AARCH64_HPP >+ >+ // Sets the default values for platform dependent flags used by the runtime system. >+ // (see globals.hpp) >+@@ -42,4 +42,4 @@ define_pd_global(uintx,HeapBaseMinAddress, 2*G); >+ >+ extern __thread Thread *aarch64_currentThread; >+ >+-#endif // OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP >++#endif // OS_CPU_BSD_AARCH64_VM_GLOBALS_BSD_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp >+index b733db1957..120ed22728 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp >+@@ -23,8 +23,8 @@ >+ * >+ */ >+ >+-#ifndef OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP >+-#define OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP >++#ifndef OS_CPU_BSD_AARCH64_VM_ORDERACCESS_BSD_AARCH64_HPP >++#define OS_CPU_BSD_AARCH64_VM_ORDERACCESS_BSD_AARCH64_HPP >+ >+ // Included in orderAccess.hpp header file. >+ >+@@ -70,4 +70,4 @@ struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X_FENCE> >+ void operator()(T v, volatile T* p) const { release_store(p, v); fence(); } >+ }; >+ >+-#endif // OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP >++#endif // OS_CPU_BSD_AARCH64_VM_ORDERACCESS_BSD_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp >+index 3c7b15086e..82bf1e84b2 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp >++++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp >+@@ -35,7 +35,7 @@ >+ #include "code/nativeInst.hpp" >+ #include "interpreter/interpreter.hpp" >+ #include "memory/allocation.inline.hpp" >+-#include "os_share_linux.hpp" >++#include "os_share_bsd.hpp" >+ #include "prims/jniFastGetField.hpp" >+ #include "prims/jvm_misc.hpp" >+ #include "runtime/arguments.hpp" >+@@ -106,7 +106,7 @@ char* os::non_memory_address_word() { >+ return (char*) 0xffffffffffff; >+ } >+ >+-address os::Linux::ucontext_get_pc(const ucontext_t * uc) { >++address os::Bsd::ucontext_get_pc(const ucontext_t * uc) { >+ #ifdef BUILTIN_SIM >+ return (address)uc->uc_mcontext.gregs[REG_PC]; >+ #else >+@@ -114,7 +114,7 @@ address os::Linux::ucontext_get_pc(const ucontext_t * uc) { >+ #endif >+ } >+ >+-void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) { >++void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) { >+ #ifdef BUILTIN_SIM >+ uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc; >+ #else >+@@ -122,7 +122,7 @@ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) { >+ #endif >+ } >+ >+-intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) { >++intptr_t* os::Bsd::ucontext_get_sp(const ucontext_t * uc) { >+ #ifdef BUILTIN_SIM >+ return (intptr_t*)uc->uc_mcontext.gregs[REG_SP]; >+ #else >+@@ -130,7 +130,7 @@ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) { >+ #endif >+ } >+ >+-intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { >++intptr_t* os::Bsd::ucontext_get_fp(const ucontext_t * uc) { >+ #ifdef BUILTIN_SIM >+ return (intptr_t*)uc->uc_mcontext.gregs[REG_FP]; >+ #else >+@@ -141,9 +141,9 @@ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { >+ // For Forte Analyzer AsyncGetCallTrace profiling support - thread >+ // is currently interrupted by SIGPROF. >+ // os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal >+-// frames. Currently we don't do that on Linux, so it's the same as >++// frames. Currently we don't do that on Bsd, so it's the same as >+ // os::fetch_frame_from_context(). >+-ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread, >++ExtendedPC os::Bsd::fetch_frame_from_ucontext(Thread* thread, >+ const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) { >+ >+ assert(thread != NULL, "just checking"); >+@@ -160,9 +160,9 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid, >+ const ucontext_t* uc = (const ucontext_t*)ucVoid; >+ >+ if (uc != NULL) { >+- epc = ExtendedPC(os::Linux::ucontext_get_pc(uc)); >+- if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc); >+- if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc); >++ epc = ExtendedPC(os::Bsd::ucontext_get_pc(uc)); >++ if (ret_sp) *ret_sp = os::Bsd::ucontext_get_sp(uc); >++ if (ret_fp) *ret_fp = os::Bsd::ucontext_get_fp(uc); >+ } else { >+ // construct empty ExtendedPC for return value checking >+ epc = ExtendedPC(NULL); >+@@ -180,8 +180,8 @@ frame os::fetch_frame_from_context(const void* ucVoid) { >+ return frame(sp, fp, epc.pc()); >+ } >+ >+-bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) { >+- address pc = (address) os::Linux::ucontext_get_pc(uc); >++bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) { >++ address pc = (address) os::Bsd::ucontext_get_pc(uc); >+ if (Interpreter::contains(pc)) { >+ // interpreter performs stack banging after the fixed frame header has >+ // been generated while the compilers perform it before. To maintain >+@@ -204,8 +204,8 @@ bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* >+ // In compiled code, the stack banging is performed before LR >+ // has been saved in the frame. LR is live, and SP and FP >+ // belong to the caller. >+- intptr_t* fp = os::Linux::ucontext_get_fp(uc); >+- intptr_t* sp = os::Linux::ucontext_get_sp(uc); >++ intptr_t* fp = os::Bsd::ucontext_get_fp(uc); >++ intptr_t* sp = os::Bsd::ucontext_get_sp(uc); >+ address pc = (address)(uc->uc_mcontext.regs[REG_LR] >+ - NativeInstruction::instruction_size); >+ *fr = frame(sp, fp, pc); >+@@ -273,7 +273,7 @@ extern "C" void FetchNResume () ; >+ #endif >+ >+ extern "C" JNIEXPORT int >+-JVM_handle_linux_signal(int sig, >++JVM_handle_bsd_signal(int sig, >+ siginfo_t* info, >+ void* ucVoid, >+ int abort_if_unrecognized) { >+@@ -290,13 +290,13 @@ JVM_handle_linux_signal(int sig, >+ // Note: it's not uncommon that JNI code uses signal/sigset to install >+ // then restore certain signal handler (e.g. to temporarily block SIGPIPE, >+ // or have a SIGILL handler when detecting CPU type). When that happens, >+- // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To >++ // JVM_handle_bsd_signal() might be invoked with junk info/ucVoid. To >+ // avoid unnecessary crash when libjsig is not preloaded, try handle signals >+ // that do not require siginfo/ucontext first. >+ >+ if (sig == SIGPIPE || sig == SIGXFSZ) { >+ // allow chained handler to go first >+- if (os::Linux::chained_handler(sig, info, ucVoid)) { >++ if (os::Bsd::chained_handler(sig, info, ucVoid)) { >+ return true; >+ } else { >+ // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219 >+@@ -313,7 +313,7 @@ JVM_handle_linux_signal(int sig, >+ >+ JavaThread* thread = NULL; >+ VMThread* vmthread = NULL; >+- if (os::Linux::signal_handlers_are_installed) { >++ if (os::Bsd::signal_handlers_are_installed) { >+ if (t != NULL ){ >+ if(t->is_Java_thread()) { >+ thread = (JavaThread*)t; >+@@ -324,7 +324,7 @@ JVM_handle_linux_signal(int sig, >+ } >+ } >+ /* >+- NOTE: does not seem to work on linux. >++ NOTE: does not seem to work on bsd. >+ if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) { >+ // can't decode this kind of signal >+ info = NULL; >+@@ -339,7 +339,7 @@ JVM_handle_linux_signal(int sig, >+ >+ //%note os_trap_1 >+ if (info != NULL && uc != NULL && thread != NULL) { >+- pc = (address) os::Linux::ucontext_get_pc(uc); >++ pc = (address) os::Bsd::ucontext_get_pc(uc); >+ >+ #ifdef BUILTIN_SIM >+ if (pc == (address) Fetch32PFI) { >+@@ -352,7 +352,7 @@ JVM_handle_linux_signal(int sig, >+ } >+ #else >+ if (StubRoutines::is_safefetch_fault(pc)) { >+- os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); >++ os::Bsd::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); >+ return 1; >+ } >+ #endif >+@@ -373,7 +373,7 @@ JVM_handle_linux_signal(int sig, >+ if (thread->thread_state() == _thread_in_Java) { >+ if (thread->in_stack_reserved_zone(addr)) { >+ frame fr; >+- if (os::Linux::get_frame_at_stack_banging_point(thread, uc, &fr)) { >++ if (os::Bsd::get_frame_at_stack_banging_point(thread, uc, &fr)) { >+ assert(fr.is_java_frame(), "Must be a Java frame"); >+ frame activation = >+ SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr); >+@@ -412,10 +412,10 @@ JVM_handle_linux_signal(int sig, >+ // Accessing stack address below sp may cause SEGV if current >+ // thread has MAP_GROWSDOWN stack. This should only happen when >+ // current thread was created by user code with MAP_GROWSDOWN flag >+- // and then attached to VM. See notes in os_linux.cpp. >++ // and then attached to VM. See notes in os_bsd.cpp. >+ if (thread->osthread()->expanding_stack() == 0) { >+ thread->osthread()->set_expanding_stack(); >+- if (os::Linux::manually_expand_stack(thread, addr)) { >++ if (os::Bsd::manually_expand_stack(thread, addr)) { >+ thread->osthread()->clear_expanding_stack(); >+ return 1; >+ } >+@@ -487,12 +487,12 @@ JVM_handle_linux_signal(int sig, >+ // save all thread context in case we need to restore it >+ if (thread != NULL) thread->set_saved_exception_pc(pc); >+ >+- os::Linux::ucontext_set_pc(uc, stub); >++ os::Bsd::ucontext_set_pc(uc, stub); >+ return true; >+ } >+ >+ // signal-chaining >+- if (os::Linux::chained_handler(sig, info, ucVoid)) { >++ if (os::Bsd::chained_handler(sig, info, ucVoid)) { >+ return true; >+ } >+ >+@@ -502,7 +502,7 @@ JVM_handle_linux_signal(int sig, >+ } >+ >+ if (pc == NULL && uc != NULL) { >+- pc = os::Linux::ucontext_get_pc(uc); >++ pc = os::Bsd::ucontext_get_pc(uc); >+ } >+ >+ // unmask current signal >+@@ -517,17 +517,17 @@ JVM_handle_linux_signal(int sig, >+ return true; // Mute compiler >+ } >+ >+-void os::Linux::init_thread_fpu_state(void) { >++void os::Bsd::init_thread_fpu_state(void) { >+ } >+ >+-int os::Linux::get_fpu_control_word(void) { >++int os::Bsd::get_fpu_control_word(void) { >+ return 0; >+ } >+ >+-void os::Linux::set_fpu_control_word(int fpu_control) { >++void os::Bsd::set_fpu_control_word(int fpu_control) { >+ } >+ >+-// Check that the linux kernel version is 2.4 or higher since earlier >++// Check that the bsd kernel version is 2.4 or higher since earlier >+ // versions do not support SSE without patches. >+ bool os::supports_sse() { >+ return true; >+@@ -597,7 +597,7 @@ void os::print_context(outputStream *st, const void *context) { >+ #endif >+ st->cr(); >+ >+- intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); >++ intptr_t *sp = (intptr_t *)os::Bsd::ucontext_get_sp(uc); >+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp)); >+ print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t)); >+ st->cr(); >+@@ -605,7 +605,7 @@ void os::print_context(outputStream *st, const void *context) { >+ // Note: it may be unsafe to inspect memory near pc. For example, pc may >+ // point to garbage if entry point in an nmethod is corrupted. Leave >+ // this at the end, and hope for the best. >+- address pc = os::Linux::ucontext_get_pc(uc); >++ address pc = os::Bsd::ucontext_get_pc(uc); >+ st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc)); >+ print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); >+ } >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp >+index d2d02efc54..5412827eab 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp >+@@ -23,8 +23,8 @@ >+ * >+ */ >+ >+-#ifndef OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP >+-#define OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP >++#ifndef OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_HPP >++#define OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_HPP >+ >+ static void setup_fpu(); >+ static bool supports_sse(); >+@@ -42,4 +42,4 @@ >+ *(jlong *) dst = *(const jlong *) src; >+ } >+ >+-#endif // OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP >++#endif // OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp >+index 2402d13540..c2df460da6 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp >+@@ -23,8 +23,8 @@ >+ * >+ */ >+ >+-#ifndef OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP >+-#define OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP >++#ifndef OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_INLINE_HPP >++#define OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_INLINE_HPP >+ >+ #include "runtime/os.hpp" >+ >+@@ -37,4 +37,4 @@ inline jlong os::rdtsc() { >+ return (jlong)res; >+ } >+ >+-#endif // OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP >++#endif // OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_INLINE_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp >+index 687eb50bab..ad916d647e 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp >+@@ -23,8 +23,8 @@ >+ * >+ */ >+ >+-#ifndef OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP >+-#define OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP >++#ifndef OS_CPU_BSD_AARCH64_VM_PREFETCH_BSD_AARCH64_INLINE_HPP >++#define OS_CPU_BSD_AARCH64_VM_PREFETCH_BSD_AARCH64_INLINE_HPP >+ >+ #include "runtime/prefetch.hpp" >+ >+@@ -43,4 +43,4 @@ inline void Prefetch::write(void *loc, intx interval) { >+ #endif >+ } >+ >+-#endif // OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP >++#endif // OS_CPU_BSD_AARCH64_VM_PREFETCH_BSD_AARCH64_INLINE_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp >+index 9084daeaa2..dc423ebb25 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp >++++ src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp >+@@ -65,7 +65,7 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) >+ >+ intptr_t* ret_fp; >+ intptr_t* ret_sp; >+- ExtendedPC addr = os::Linux::fetch_frame_from_ucontext(this, uc, >++ ExtendedPC addr = os::Bsd::fetch_frame_from_ucontext(this, uc, >+ &ret_sp, &ret_fp); >+ if (addr.pc() == NULL || ret_sp == NULL ) { >+ // ucontext wasn't useful >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp >+index a2261b1906..400f32da2e 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp >+@@ -23,8 +23,8 @@ >+ * >+ */ >+ >+-#ifndef OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP >+-#define OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP >++#ifndef OS_CPU_BSD_AARCH64_VM_THREAD_BSD_AARCH64_HPP >++#define OS_CPU_BSD_AARCH64_VM_THREAD_BSD_AARCH64_HPP >+ >+ private: >+ #ifdef ASSERT >+@@ -77,4 +77,4 @@ >+ static void enable_register_stack_guard() {} >+ static void disable_register_stack_guard() {} >+ >+-#endif // OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP >++#endif // OS_CPU_BSD_AARCH64_VM_THREAD_BSD_AARCH64_HPP >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp >+index fa5885ca62..1296661135 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp >+@@ -23,8 +23,8 @@ >+ * >+ */ >+ >+-#ifndef OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP >+-#define OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP >++#ifndef OS_CPU_BSD_AARCH64_VM_VMSTRUCTS_BSD_AARCH64_HPP >++#define OS_CPU_BSD_AARCH64_VM_VMSTRUCTS_BSD_AARCH64_HPP >+ >+ // These are the OS and CPU-specific fields, types and integer >+ // constants required by the Serviceability Agent. This file is >+@@ -52,4 +52,4 @@ >+ >+ #define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) >+ >+-#endif // OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP >++#endif // OS_CPU_BSD_AARCH64_VM_VMSTRUCTS_BSD_AARCH64_HPP >+diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java >+index 28e36759a5..1f1df50726 100644 >+--- /src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java >++++ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java >+@@ -23,16 +23,16 @@ >+ * >+ */ >+ >+-package sun.jvm.hotspot.debugger.linux.aarch64; >++package sun.jvm.hotspot.debugger.bsd.aarch64; >+ >+ import sun.jvm.hotspot.debugger.*; >+ import sun.jvm.hotspot.debugger.aarch64.*; >+-import sun.jvm.hotspot.debugger.linux.*; >++import sun.jvm.hotspot.debugger.bsd.*; >+ import sun.jvm.hotspot.debugger.cdbg.*; >+ import sun.jvm.hotspot.debugger.cdbg.basic.*; >+ >+-final public class LinuxAARCH64CFrame extends BasicCFrame { >+- public LinuxAARCH64CFrame(LinuxDebugger dbg, Address fp, Address pc) { >++final public class BsdAARCH64CFrame extends BasicCFrame { >++ public BsdAARCH64CFrame(BsdDebugger dbg, Address fp, Address pc) { >+ super(dbg.getCDebugger()); >+ this.fp = fp; >+ this.pc = pc; >+@@ -74,7 +74,7 @@ public CFrame sender(ThreadProxy thread) { >+ if (nextPC == null) { >+ return null; >+ } >+- return new LinuxAARCH64CFrame(dbg, nextFP, nextPC); >++ return new BsdAARCH64CFrame(dbg, nextFP, nextPC); >+ } >+ >+ // package/class internals only >+@@ -82,5 +82,5 @@ public CFrame sender(ThreadProxy thread) { >+ private Address pc; >+ private Address sp; >+ private Address fp; >+- private LinuxDebugger dbg; >++ private BsdDebugger dbg; >+ } >+diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java >+index 7700316867..49d09bcfe0 100644 >+--- /src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java >++++ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java >+@@ -23,16 +23,16 @@ >+ * >+ */ >+ >+-package sun.jvm.hotspot.debugger.linux.aarch64; >++package sun.jvm.hotspot.debugger.bsd.aarch64; >+ >+ import sun.jvm.hotspot.debugger.*; >+ import sun.jvm.hotspot.debugger.aarch64.*; >+-import sun.jvm.hotspot.debugger.linux.*; >++import sun.jvm.hotspot.debugger.bsd.*; >+ >+-public class LinuxAARCH64ThreadContext extends AARCH64ThreadContext { >+- private LinuxDebugger debugger; >++public class BsdAARCH64ThreadContext extends AARCH64ThreadContext { >++ private BsdDebugger debugger; >+ >+- public LinuxAARCH64ThreadContext(LinuxDebugger debugger) { >++ public BsdAARCH64ThreadContext(BsdDebugger debugger) { >+ super(); >+ this.debugger = debugger; >+ } >+ >+From a4eea8c1921e982c70e36c95198937e305fd0c2f Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:12:10 +0200 >+Subject: [PATCH 03/17] Fix byteswap on FreeBSD >+ >+--- >+ src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp | 4 +++- >+ 1 file changed, 3 insertions(+), 1 deletion(-) >+ >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp >+index 1ed80c3024..4094b4fa84 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp >++++ src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp >+@@ -26,7 +26,9 @@ >+ #ifndef OS_CPU_BSD_AARCH64_VM_BYTES_BSD_AARCH64_INLINE_HPP >+ #define OS_CPU_BSD_AARCH64_VM_BYTES_BSD_AARCH64_INLINE_HPP >+ >+-#include <byteswap.h> >++#define bswap_16(x) __bswap16(x) >++#define bswap_32(x) __bswap32(x) >++#define bswap_64(x) __bswap64(x) >+ >+ // Efficient swapping of data bytes from Java byte >+ // ordering to native byte ordering and vice versa. >+ >+From 9923d1edee733bde5c1d061fe962b05e90851326 Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:12:38 +0200 >+Subject: [PATCH 04/17] Fix prfm assembly clang chokes on this syntax, gcc8 >+ translates prfm to prfum >+ >+<inline asm>:1:26: error: index must be a multiple of 8 in range [0, 32760]. >+ prfm pldl1keep, [x0, #-256] >+--- >+ src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s | 2 +- >+ 1 file changed, 1 insertion(+), 1 deletion(-) >+ >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s >+index 25e3b054f7..bf2805b1b2 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s >++++ src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s >+@@ -159,7 +159,7 @@ bwd_copy_aligned: >+ blo bwd_copy_drain >+ >+ bwd_copy_again: >+- prfm pldl1keep, [s, #-256] >++ prfum pldl1keep, [s, #-256] >+ stp t0, t1, [d, #-16] >+ ldp t0, t1, [s, #-16] >+ stp t2, t3, [d, #-32] >+ >+From 9a66524d98096a147d05d632e23600b8f5cc5616 Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:13:12 +0200 >+Subject: [PATCH 05/17] Remove bogus 'd' constant qualifiers >+ >+--- >+ src/hotspot/cpu/aarch64/aarch64.ad | 8 ++--- >+ .../aarch64/macroAssembler_aarch64_log.cpp | 4 +-- >+ .../aarch64/macroAssembler_aarch64_trig.cpp | 30 +++++++++---------- >+ 3 files changed, 21 insertions(+), 21 deletions(-) >+ >+diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad >+index ed575070c4..e7d66b87d4 100644 >+--- /src/hotspot/cpu/aarch64/aarch64.ad >++++ src/hotspot/cpu/aarch64/aarch64.ad >+@@ -13910,7 +13910,7 @@ instruct compF_reg_zero(rFlagsReg cr, vRegF src1, immF0 src2) >+ format %{ "fcmps $src1, 0.0" %} >+ >+ ins_encode %{ >+- __ fcmps(as_FloatRegister($src1$$reg), 0.0D); >++ __ fcmps(as_FloatRegister($src1$$reg), 0.0); >+ %} >+ >+ ins_pipe(pipe_class_compare); >+@@ -13939,7 +13939,7 @@ instruct compD_reg_zero(rFlagsReg cr, vRegD src1, immD0 src2) >+ format %{ "fcmpd $src1, 0.0" %} >+ >+ ins_encode %{ >+- __ fcmpd(as_FloatRegister($src1$$reg), 0.0D); >++ __ fcmpd(as_FloatRegister($src1$$reg), 0.0); >+ %} >+ >+ ins_pipe(pipe_class_compare); >+@@ -14015,7 +14015,7 @@ instruct compF3_reg_immF0(iRegINoSp dst, vRegF src1, immF0 zero, rFlagsReg cr) >+ Label done; >+ FloatRegister s1 = as_FloatRegister($src1$$reg); >+ Register d = as_Register($dst$$reg); >+- __ fcmps(s1, 0.0D); >++ __ fcmps(s1, 0.0); >+ // installs 0 if EQ else -1 >+ __ csinvw(d, zr, zr, Assembler::EQ); >+ // keeps -1 if less or unordered else installs 1 >+@@ -14042,7 +14042,7 @@ instruct compD3_reg_immD0(iRegINoSp dst, vRegD src1, immD0 zero, rFlagsReg cr) >+ Label done; >+ FloatRegister s1 = as_FloatRegister($src1$$reg); >+ Register d = as_Register($dst$$reg); >+- __ fcmpd(s1, 0.0D); >++ __ fcmpd(s1, 0.0); >+ // installs 0 if EQ else -1 >+ __ csinvw(d, zr, zr, Assembler::EQ); >+ // keeps -1 if less or unordered else installs 1 >+diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp >+index 64957e1440..5b2daf963b 100644 >+--- /src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp >++++ src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp >+@@ -286,7 +286,7 @@ void MacroAssembler::fast_log(FloatRegister vtmp0, FloatRegister vtmp1, >+ frecpe(vtmp5, vtmp5, S); // vtmp5 ~= 1/vtmp5 >+ lsr(tmp2, rscratch1, 48); >+ movz(tmp4, 0x77f0, 48); >+- fmovd(vtmp4, 1.0d); >++ fmovd(vtmp4, 1.0); >+ movz(tmp1, INF_OR_NAN_PREFIX, 48); >+ bfm(tmp4, rscratch1, 0, 51); // tmp4 = 0x77F0 << 48 | mantissa(X) >+ // vtmp1 = AS_DOUBLE_BITS(0x77F0 << 48 | mantissa(X)) == mx >+@@ -358,7 +358,7 @@ void MacroAssembler::fast_log(FloatRegister vtmp0, FloatRegister vtmp1, >+ br(GE, DONE); >+ cmp(rscratch1, tmp2); >+ br(NE, CHECKED_CORNER_CASES); >+- fmovd(v0, 0.0d); >++ fmovd(v0, 0.0); >+ } >+ bind(DONE); >+ ret(lr); >+diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp >+index 47e17985b9..a672198ce7 100644 >+--- /src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp >++++ src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp >+@@ -381,11 +381,11 @@ void MacroAssembler::generate__ieee754_rem_pio2(address npio2_hw, >+ } >+ >+ block_comment("nx calculation with unrolled while(tx[nx-1]==zeroA) nx--;"); { >+- fcmpd(v26, 0.0d); // if NE then jx == 2. else it's 1 or 0 >++ fcmpd(v26, 0.0); // if NE then jx == 2. else it's 1 or 0 >+ add(iqBase, sp, 480); // base of iq[] >+ fmuld(v3, v26, v10); >+ br(NE, NX_SET); >+- fcmpd(v7, 0.0d); // v7 == 0 => jx = 0. Else jx = 1 >++ fcmpd(v7, 0.0); // v7 == 0 => jx = 0. Else jx = 1 >+ csetw(jx, NE); >+ } >+ bind(NX_SET); >+@@ -696,7 +696,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 >+ cmpw(jv, zr); >+ addw(tmp4, jx, 4); // tmp4 = m = jx + jk = jx + 4. jx is in {0,1,2} so m is in [4,5,6] >+ cselw(jv, jv, zr, GE); >+- fmovd(v26, 0.0d); >++ fmovd(v26, 0.0); >+ addw(tmp5, jv, 1); // jv+1 >+ subsw(j, jv, jx); >+ add(qBase, sp, 320); // base of q[] >+@@ -819,8 +819,8 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 >+ movw(jz, 4); >+ fmovd(v17, i); // v17 = twon24 >+ fmovd(v30, tmp5); // 2^q0 >+- fmovd(v21, 0.125d); >+- fmovd(v20, 8.0d); >++ fmovd(v21, 0.125); >++ fmovd(v20, 8.0); >+ fmovd(v22, tmp4); // 2^-q0 >+ >+ block_comment("recompute loop"); { >+@@ -877,7 +877,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 >+ lsr(ih, tmp2, 23); // ih = iq[z-1] >> 23 >+ b(Q0_ZERO_CMP_DONE); >+ bind(Q0_ZERO_CMP_LT); >+- fmovd(v4, 0.5d); >++ fmovd(v4, 0.5); >+ fcmpd(v18, v4); >+ cselw(ih, zr, ih, LT); // if (z<0.5) ih = 0 >+ } >+@@ -924,7 +924,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 >+ br(NE, IH_HANDLED); >+ >+ block_comment("if(ih==2) {"); { >+- fmovd(v25, 1.0d); >++ fmovd(v25, 1.0); >+ fsubd(v18, v25, v18); // z = one - z; >+ cbzw(rscratch2, IH_HANDLED); >+ fsubd(v18, v18, v30); // z -= scalbnA(one,q0); >+@@ -932,7 +932,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 >+ } >+ bind(IH_HANDLED); >+ // check if recomputation is needed >+- fcmpd(v18, 0.0d); >++ fcmpd(v18, 0.0); >+ br(NE, RECOMP_CHECK_DONE_NOT_ZERO); >+ >+ block_comment("if(z==zeroB) {"); { >+@@ -994,7 +994,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 >+ } >+ bind(RECOMP_CHECK_DONE); >+ // chop off zero terms >+- fcmpd(v18, 0.0d); >++ fcmpd(v18, 0.0); >+ br(EQ, Z_IS_ZERO); >+ >+ block_comment("else block of if(z==0.0) {"); { >+@@ -1053,7 +1053,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 >+ movw(tmp2, zr); // tmp2 will keep jz - i == 0 at start >+ bind(COMP_FOR); >+ // for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; >+- fmovd(v30, 0.0d); >++ fmovd(v30, 0.0); >+ add(tmp5, qBase, i, LSL, 3); // address of q[i+k] for k==0 >+ movw(tmp3, 4); >+ movw(tmp4, zr); // used as k >+@@ -1081,7 +1081,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 >+ // remember prec == 2 >+ >+ block_comment("for (i=jz;i>=0;i--) fw += fq[i];"); { >+- fmovd(v4, 0.0d); >++ fmovd(v4, 0.0); >+ mov(i, jz); >+ bind(FW_FOR1); >+ ldrd(v1, Address(rscratch2, i, Address::lsl(3))); >+@@ -1319,7 +1319,7 @@ void MacroAssembler::generate_kernel_cos(FloatRegister x, address dcos_coef) { >+ ld1(C1, C2, C3, C4, T1D, Address(rscratch2)); // load C1..C3\4 >+ block_comment("calculate r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))))"); { >+ fmaddd(r, z, C6, C5); >+- fmovd(half, 0.5d); >++ fmovd(half, 0.5); >+ fmaddd(r, z, r, C4); >+ fmuld(y, x, y); >+ fmaddd(r, z, r, C3); >+@@ -1329,7 +1329,7 @@ void MacroAssembler::generate_kernel_cos(FloatRegister x, address dcos_coef) { >+ fmaddd(r, z, r, C1); // r = C1+z(C2+z(C4+z(C5+z*C6))) >+ } >+ // need to multiply r by z to have "final" r value >+- fmovd(one, 1.0d); >++ fmovd(one, 1.0); >+ cmp(ix, rscratch1); >+ br(GT, IX_IS_LARGE); >+ block_comment("if(ix < 0x3FD33333) return one - (0.5*z - (z*r - x*y))"); { >+@@ -1352,7 +1352,7 @@ void MacroAssembler::generate_kernel_cos(FloatRegister x, address dcos_coef) { >+ b(QX_SET); >+ bind(SET_QX_CONST); >+ block_comment("if(ix > 0x3fe90000) qx = 0.28125;"); { >+- fmovd(qx, 0.28125d); >++ fmovd(qx, 0.28125); >+ } >+ bind(QX_SET); >+ fnmsub(C6, x, r, y); // z*r - xy >+@@ -1443,7 +1443,7 @@ void MacroAssembler::generate_dsin_dcos(bool isCos, address npio2_hw, >+ block_comment("kernel_sin/kernel_cos: if(ix<0x3e400000) {<fast return>}"); { >+ bind(TINY_X); >+ if (isCos) { >+- fmovd(v0, 1.0d); >++ fmovd(v0, 1.0); >+ } >+ ret(lr); >+ } >+ >+From ba377e7ac2644beabffc494e4562d5f3fa4888a4 Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:13:35 +0200 >+Subject: [PATCH 06/17] arg is a boolean >+ >+--- >+ src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp | 2 +- >+ 1 file changed, 1 insertion(+), 1 deletion(-) >+ >+diff --git a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp >+index 19c9ea688f..b8a9d747f3 100644 >+--- /src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp >++++ src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp >+@@ -426,7 +426,7 @@ void LIRGenerator::do_ArithmeticOp_FPU(ArithmeticOp* x) { >+ tmp = new_register(T_DOUBLE); >+ } >+ >+- arithmetic_op_fpu(x->op(), reg, left.result(), right.result(), NULL); >++ arithmetic_op_fpu(x->op(), reg, left.result(), right.result(), false); >+ >+ set_result(x, round_item(reg)); >+ } >+ >+From 95dbdedc55ed1762d417e50fed1b3a08c03e8f65 Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:13:58 +0200 >+Subject: [PATCH 07/17] Remove duplicate definition >+ >+--- >+ src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp | 4 ---- >+ 1 file changed, 4 deletions(-) >+ >+diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp >+index 1143f6b3c7..3bec989e88 100644 >+--- /src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp >++++ src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp >+@@ -36,10 +36,6 @@ typedef ByteSize (*OffsetFunction)(uint); >+ >+ class InterpreterMacroAssembler: public MacroAssembler { >+ protected: >+- >+- protected: >+- using MacroAssembler::call_VM_leaf_base; >+- >+ // Interpreter specific version of call_VM_base >+ using MacroAssembler::call_VM_leaf_base; >+ >+ >+diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp >+index fbc6d41a32..72089265a1 100644 >+--- /src/hotspot/os/bsd/os_bsd.cpp >++++ src/hotspot/os/bsd/os_bsd.cpp >+@@ -243,6 +243,8 @@ static char cpu_arch[] = "sparcv9"; >+ #else >+ static char cpu_arch[] = "sparc"; >+ #endif >++#elif defined(AARCH64) >++static char cpu_arch[] = "aarch64"; >+ #else >+ #error Add appropriate cpu_arch setting >+ #endif >+ >+From 5b69bb3b031a2bbaf8fc7f448f8dfe4e3c45b701 Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:15:08 +0200 >+Subject: [PATCH 10/17] Implement hwcap on FreeBSD >+ >+--- >+ src/hotspot/cpu/aarch64/freebsd_aarch64.hpp | 119 ++++++++++++++++++ >+ .../cpu/aarch64/vm_version_aarch64.cpp | 90 +++++++++++++ >+ 2 files changed, 209 insertions(+) >+ create mode 100644 src/hotspot/cpu/aarch64/freebsd_aarch64.hpp >+ >+diff --git a/src/hotspot/cpu/aarch64/freebsd_aarch64.hpp b/src/hotspot/cpu/aarch64/freebsd_aarch64.hpp >+new file mode 100644 >+index 0000000000..cc187ab2e1 >+--- /dev/null >++++ src/hotspot/cpu/aarch64/freebsd_aarch64.hpp >+@@ -0,0 +1,119 @@ >++#ifndef CPU_AARCH64_VM_FREEBSD_AARCH64_HPP >++#define CPU_AARCH64_VM_FREEBSD_AARCH64_HPP >++ >++// for FreeBSD-11.2 >++#ifndef ID_AA64PFR0_ADV_SIMD_HP >++#define ID_AA64PFR0_ADV_SIMD_HP (0x1 << ID_AA64PFR0_ADV_SIMD_SHIFT) >++#endif >++ >++#define CPU_IMPL_ARM 0x41 >++#define CPU_IMPL_BROADCOM 0x42 >++#define CPU_IMPL_CAVIUM 0x43 >++#define CPU_IMPL_DEC 0x44 >++#define CPU_IMPL_INFINEON 0x49 >++#define CPU_IMPL_FREESCALE 0x4D >++#define CPU_IMPL_NVIDIA 0x4E >++#define CPU_IMPL_APM 0x50 >++#define CPU_IMPL_QUALCOMM 0x51 >++#define CPU_IMPL_MARVELL 0x56 >++#define CPU_IMPL_INTEL 0x69 >++ >++/* ARM Part numbers */ >++#define CPU_PART_FOUNDATION 0xD00 >++#define CPU_PART_CORTEX_A35 0xD04 >++#define CPU_PART_CORTEX_A53 0xD03 >++#define CPU_PART_CORTEX_A55 0xD05 >++#define CPU_PART_CORTEX_A57 0xD07 >++#define CPU_PART_CORTEX_A72 0xD08 >++#define CPU_PART_CORTEX_A73 0xD09 >++#define CPU_PART_CORTEX_A75 0xD0A >++ >++/* Cavium Part numbers */ >++#define CPU_PART_THUNDERX 0x0A1 >++#define CPU_PART_THUNDERX_81XX 0x0A2 >++#define CPU_PART_THUNDERX_83XX 0x0A3 >++#define CPU_PART_THUNDERX2 0x0AF >++ >++#define CPU_REV_THUNDERX_1_0 0x00 >++#define CPU_REV_THUNDERX_1_1 0x01 >++ >++#define CPU_REV_THUNDERX2_0 0x00 >++ >++#define CPU_IMPL(midr) (((midr) >> 24) & 0xff) >++#define CPU_PART(midr) (((midr) >> 4) & 0xfff) >++#define CPU_VAR(midr) (((midr) >> 20) & 0xf) >++#define CPU_REV(midr) (((midr) >> 0) & 0xf) >++ >++ >++struct cpu_desc { >++ u_int cpu_impl; >++ u_int cpu_part_num; >++ u_int cpu_variant; >++ u_int cpu_revision; >++ const char *cpu_impl_name; >++ const char *cpu_part_name; >++}; >++ >++struct cpu_parts { >++ u_int part_id; >++ const char *part_name; >++}; >++#define CPU_PART_NONE { 0, "Unknown Processor" } >++ >++struct cpu_implementers { >++ u_int impl_id; >++ const char *impl_name; >++ /* >++ * Part number is implementation defined >++ * so each vendor will have its own set of values and names. >++ */ >++ const struct cpu_parts *cpu_parts; >++}; >++#define CPU_IMPLEMENTER_NONE { 0, "Unknown Implementer", cpu_parts_none } >++ >++/* >++ * Per-implementer table of (PartNum, CPU Name) pairs. >++ */ >++/* ARM Ltd. */ >++static const struct cpu_parts cpu_parts_arm[] = { >++ { CPU_PART_FOUNDATION, "Foundation-Model" }, >++ { CPU_PART_CORTEX_A35, "Cortex-A35" }, >++ { CPU_PART_CORTEX_A53, "Cortex-A53" }, >++ { CPU_PART_CORTEX_A55, "Cortex-A55" }, >++ { CPU_PART_CORTEX_A57, "Cortex-A57" }, >++ { CPU_PART_CORTEX_A72, "Cortex-A72" }, >++ { CPU_PART_CORTEX_A73, "Cortex-A73" }, >++ { CPU_PART_CORTEX_A75, "Cortex-A75" }, >++ CPU_PART_NONE, >++}; >++/* Cavium */ >++static const struct cpu_parts cpu_parts_cavium[] = { >++ { CPU_PART_THUNDERX, "ThunderX" }, >++ { CPU_PART_THUNDERX2, "ThunderX2" }, >++ CPU_PART_NONE, >++}; >++ >++/* Unknown */ >++static const struct cpu_parts cpu_parts_none[] = { >++ CPU_PART_NONE, >++}; >++ >++/* >++ * Implementers table. >++ */ >++const struct cpu_implementers cpu_implementers[] = { >++ { CPU_IMPL_ARM, "ARM", cpu_parts_arm }, >++ { CPU_IMPL_BROADCOM, "Broadcom", cpu_parts_none }, >++ { CPU_IMPL_CAVIUM, "Cavium", cpu_parts_cavium }, >++ { CPU_IMPL_DEC, "DEC", cpu_parts_none }, >++ { CPU_IMPL_INFINEON, "IFX", cpu_parts_none }, >++ { CPU_IMPL_FREESCALE, "Freescale", cpu_parts_none }, >++ { CPU_IMPL_NVIDIA, "NVIDIA", cpu_parts_none }, >++ { CPU_IMPL_APM, "APM", cpu_parts_none }, >++ { CPU_IMPL_QUALCOMM, "Qualcomm", cpu_parts_none }, >++ { CPU_IMPL_MARVELL, "Marvell", cpu_parts_none }, >++ { CPU_IMPL_INTEL, "Intel", cpu_parts_none }, >++ CPU_IMPLEMENTER_NONE, >++}; >++ >++#endif >+diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp >+index 9962617d03..c8308b1080 100644 >+--- /src/hotspot/cpu/aarch64/vm_version_aarch64.cpp >++++ src/hotspot/cpu/aarch64/vm_version_aarch64.cpp >+@@ -35,12 +35,23 @@ >+ #include OS_HEADER_INLINE(os) >+ >+ #ifndef BUILTIN_SIM >++#if defined (__linux__) >+ #include <sys/auxv.h> >+ #include <asm/hwcap.h> >++#endif >+ #else >+ #define getauxval(hwcap) 0 >+ #endif >+ >++#if defined (__FreeBSD__) >++#include <machine/armreg.h> >++#include "freebsd_aarch64.hpp" >++#endif >++ >++#ifndef HWCAP_ASIMD >++#define HWCAP_ASIMD (1 << 1) >++#endif >++ >+ #ifndef HWCAP_AES >+ #define HWCAP_AES (1<<3) >+ #endif >+@@ -164,6 +175,7 @@ void VM_Version::get_processor_features() { >+ SoftwarePrefetchHintDistance &= ~7; >+ } >+ >++#if defined(__linux__) >+ unsigned long auxv = getauxval(AT_HWCAP); >+ >+ char buf[512]; >+@@ -191,6 +203,51 @@ void VM_Version::get_processor_features() { >+ } >+ fclose(f); >+ } >++#elif defined(__FreeBSD__) >++struct cpu_desc cpu_desc[1]; >++struct cpu_desc user_cpu_desc; >++char buf[512]; >++int cpu_lines = 0; >++ >++uint32_t midr; >++uint32_t impl_id; >++uint32_t part_id; >++uint32_t cpu = 0; >++size_t i; >++const struct cpu_parts *cpu_partsp = NULL; >++ >++midr = READ_SPECIALREG(midr_el1); >++ >++impl_id = CPU_IMPL(midr); >++for (i = 0; i < nitems(cpu_implementers); i++) { >++ if (impl_id == cpu_implementers[i].impl_id || >++ cpu_implementers[i].impl_id == 0) { >++ cpu_desc[cpu].cpu_impl = impl_id; >++ cpu_desc[cpu].cpu_impl_name = cpu_implementers[i].impl_name; >++ cpu_partsp = cpu_implementers[i].cpu_parts; >++ break; >++ } >++} >++ >++part_id = CPU_PART(midr); >++for (i = 0; &cpu_partsp[i] != NULL; i++) { >++ if (part_id == cpu_partsp[i].part_id || >++ cpu_partsp[i].part_id == 0) { >++ cpu_desc[cpu].cpu_part_num = part_id; >++ cpu_desc[cpu].cpu_part_name = cpu_partsp[i].part_name; >++ break; >++ } >++} >++ >++cpu_desc[cpu].cpu_revision = CPU_REV(midr); >++cpu_desc[cpu].cpu_variant = CPU_VAR(midr); >++ >++_cpu = cpu_desc[cpu].cpu_impl; >++_variant = cpu_desc[cpu].cpu_variant; >++_model = cpu_desc[cpu].cpu_part_num; >++_revision = cpu_desc[cpu].cpu_revision; >++ >++#endif >+ >+ // Enable vendor specific features >+ >+@@ -245,6 +302,39 @@ void VM_Version::get_processor_features() { >+ if (_cpu == CPU_ARM && cpu_lines == 1 && _model == 0xd07) _features |= CPU_A53MAC; >+ >+ sprintf(buf, "0x%02x:0x%x:0x%03x:%d", _cpu, _variant, _model, _revision); >++#if defined (__FreeBSD__) >++ unsigned long auxv = 0; >++ uint64_t id_aa64isar0, id_aa64pfr0; >++ >++ id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1); >++ id_aa64pfr0 = READ_SPECIALREG(ID_AA64PFR0_EL1); >++ >++ if (ID_AA64ISAR0_AES(id_aa64isar0) == ID_AA64ISAR0_AES_BASE) { >++ auxv = auxv | HWCAP_AES; >++ } >++ >++ if (ID_AA64ISAR0_AES(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL) { >++ auxv = auxv | HWCAP_PMULL; >++ } >++ >++ if (ID_AA64ISAR0_SHA1(id_aa64isar0) == ID_AA64ISAR0_SHA1_BASE) { >++ auxv = auxv | HWCAP_SHA1; >++ } >++ >++ if (ID_AA64ISAR0_SHA2(id_aa64isar0) == ID_AA64ISAR0_SHA2_BASE) { >++ auxv = auxv | HWCAP_SHA2; >++ } >++ >++ if (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) { >++ auxv = auxv | HWCAP_CRC32; >++ } >++ >++ if (ID_AA64PFR0_ADV_SIMD(id_aa64pfr0) == ID_AA64PFR0_ADV_SIMD_IMPL || \ >++ ID_AA64PFR0_ADV_SIMD(id_aa64pfr0) == ID_AA64PFR0_ADV_SIMD_HP ) { >++ auxv = auxv | HWCAP_ASIMD; >++ } >++#endif >++ >+ if (_model2) sprintf(buf+strlen(buf), "(0x%03x)", _model2); >+ if (auxv & HWCAP_ASIMD) strcat(buf, ", simd"); >+ if (auxv & HWCAP_CRC32) strcat(buf, ", crc"); >+ >+From ec511f86a6c7b28f235c64f36e49d7b03c681518 Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:15:26 +0200 >+Subject: [PATCH 11/17] try to fix the following error with clang (gcc8 doesn't >+ complain) >+ >+src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp:43:39: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'unsigned long' >+ return __sync_add_and_fetch(dest, add_value); >+ ^~~~~~~~~ >+src/hotspot/share/runtime/atomic.hpp:682:45: note: in instantiation of function template specialization 'Atomic::PlatformAdd<8>::add_and_fetch<unsigned long, char *>' requested here >+ return static_cast<const Derived*>(this)->add_and_fetch(add_value, dest, order); >+ ^ >+src/hotspot/share/runtime/atomic.hpp:634:12: note: in instantiation of function template specialization 'Atomic::AddAndFetch<Atomic::PlatformAdd<8> >::operator()<unsigned long, char *>' requested here >+ return PlatformAdd<sizeof(P*)>()(addend, dest, order); >+ ^ >+hotspot/share/runtime/atomic.hpp:605:10: note: in instantiation of member function 'Atomic::AddImpl<unsigned long, char *, void>::operator()' requested here >+ return AddImpl<I, D>()(add_value, dest, order); >+ ^ >+src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp:248:34: note: in instantiation of function template specialization 'Atomic::add<unsigned long, char *>' requested here >+ char* touch_addr = Atomic::add(actual_chunk_size, &_cur_addr) - actual_chunk_size; >+--- >+ src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp | 3 ++- >+ 1 file changed, 2 insertions(+), 1 deletion(-) >+ >+diff --git a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp >+index fc30400f28..fb4a2fd62f 100644 >+--- /src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp >++++ src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp >+@@ -256,7 +256,8 @@ class G1PretouchTask : public AbstractGangTask { >+ virtual void work(uint worker_id) { >+ size_t const actual_chunk_size = MAX2(chunk_size(), _page_size); >+ while (true) { >+- char* touch_addr = Atomic::add(actual_chunk_size, &_cur_addr) - actual_chunk_size; >++ volatile size_t _cur_addr_a = (size_t)_cur_addr; >++ char* touch_addr = (char *)(Atomic::add(actual_chunk_size, &_cur_addr_a) - actual_chunk_size); >+ if (touch_addr < _start_addr || touch_addr >= _end_addr) { >+ break; >+ } >+ >+From 5ae18f2854aea04c0bf1d5da87160add0ac55f5c Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:16:11 +0200 >+Subject: [PATCH 12/17] Fix undefined behavior >+ src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp:2677:17: warning: shifting >+ a negative signed value is undefined [-Wshift-negative-value] offset &= >+ -1<<12; ~~^ >+ >+--- >+ src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp | 2 +- >+ 1 file changed, 1 insertion(+), 1 deletion(-) >+ >+diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp >+index c32394a95b..7931614c6d 100644 >+--- /src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp >++++ src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp >+@@ -2674,7 +2674,7 @@ Address MacroAssembler::spill_address(int size, int offset, Register tmp) >+ if ((offset & (size-1)) && offset >= (1<<8)) { >+ add(tmp, base, offset & ((1<<12)-1)); >+ base = tmp; >+- offset &= -1<<12; >++ offset &= -(1<<12); >+ } >+ >+ if (offset >= (1<<12) * size) { >+ >+From f2acf7a95128229187bfdc21d35279eb0edd5362 Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:18:31 +0200 >+Subject: [PATCH 13/17] Fix warning: >+ src/hotspot/cpu/aarch64/assembler_aarch64.hpp:279:22: warning: & has lower >+ precedence than ==; == will be evaluated first [-Wparentheses] >+ assert_cond(bits & mask == mask); ^ ~~~~~~~~~~~~ >+ >+--- >+ src/hotspot/cpu/aarch64/assembler_aarch64.hpp | 2 +- >+ 1 file changed, 1 insertion(+), 1 deletion(-) >+ >+diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp >+index 09c7cd240f..c9f33cb732 100644 >+--- /src/hotspot/cpu/aarch64/assembler_aarch64.hpp >++++ src/hotspot/cpu/aarch64/assembler_aarch64.hpp >+@@ -276,7 +276,7 @@ class Instruction_aarch64 { >+ unsigned get(int msb = 31, int lsb = 0) { >+ int nbits = msb - lsb + 1; >+ unsigned mask = ((1U << nbits) - 1) << lsb; >+- assert_cond(bits & mask == mask); >++ assert_cond((bits & mask) == mask); >+ return (insn & mask) >> lsb; >+ } >+ >+ >+From cf325c325230b09ca20e505b37b32052dfcdb0dc Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:18:55 +0200 >+Subject: [PATCH 14/17] Fix warning: >+ src/hotspot/cpu/aarch64/assembler_aarch64.hpp:2564:34: warning: '&' within >+ '|' [-Wbitwise-op-parentheses] _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), >+ Vn); ~~^~~ ~ >+ /usr/ports/java/openjdk11/work/openjdk-jdk11u-jdk-11.0.2-9-4/src/hotspot/cpu/aarch64/assembler_aarch64.hpp:2564:34: >+ note: place parentheses around the '&' expression to silence this warning >+ _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), Vn); >+ ^ ( ) >+ >+--- >+ src/hotspot/cpu/aarch64/assembler_aarch64.hpp | 2 +- >+ 1 file changed, 1 insertion(+), 1 deletion(-) >+ >+diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp >+index c9f33cb732..c7cdc428d0 100644 >+--- /src/hotspot/cpu/aarch64/assembler_aarch64.hpp >++++ src/hotspot/cpu/aarch64/assembler_aarch64.hpp >+@@ -2560,7 +2560,7 @@ void mvnw(Register Rd, Register Rm, >+ // RBIT only allows T8B and T16B but encodes them oddly. Argh... >+ void rbit(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { >+ assert((ASSERTION), MSG); >+- _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), Vn); >++ _rbit(Vd, SIMD_Arrangement((T & 1) | 0b010), Vn); >+ } >+ #undef ASSERTION >+ >+ >+From 5835ba49d1df33231d09bff43606d6bcb29f732a Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:19:33 +0200 >+Subject: [PATCH 15/17] Fix warning: >+ src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp:1073:24: warning: '&&' >+ within '||' [-Wlogical-op-parentheses] if (is_unordered && op->cond() >+ == lir_cond_equal ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >+ src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp:1073:24: note: place >+ parentheses around the '&&' expression to silence this warning if >+ (is_unordered && op->cond() == lir_cond_equal ^ >+ ( ) >+ src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp:1074:28: warning: '&&' >+ within '||' [-Wlogical-op-parentheses] || !is_unordered && >+ op->cond() == lir_cond_notEqual) ~~ >+ ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >+ src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp:1074:28: note: place >+ parentheses around the '&&' expression to silence this warning || >+ !is_unordered && op->cond() == lir_cond_notEqual) >+ ^ ( ) >+ >+--- >+ src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp | 4 ++-- >+ 1 file changed, 2 insertions(+), 2 deletions(-) >+ >+diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp >+index 17480052d4..37f833d7c4 100644 >+--- /src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp >++++ src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp >+@@ -1070,8 +1070,8 @@ void LIR_Assembler::emit_opBranch(LIR_OpBranch* op) { >+ // Assembler::EQ does not permit unordered branches, so we add >+ // another branch here. Likewise, Assembler::NE does not permit >+ // ordered branches. >+- if (is_unordered && op->cond() == lir_cond_equal >+- || !is_unordered && op->cond() == lir_cond_notEqual) >++ if ((is_unordered && op->cond() == lir_cond_equal) >++ || (!is_unordered && op->cond() == lir_cond_notEqual)) >+ __ br(Assembler::VS, *(op->ublock()->label())); >+ switch(op->cond()) { >+ case lir_cond_equal: acond = Assembler::EQ; break; >+ >+From ede55013b1fa349a90abc13ea8748607db74a99d Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:20:07 +0200 >+Subject: [PATCH 16/17] The libjvm crashes if memnode.cpp is not compiled at O0 >+ It's only a problem with clang. >+ >+--- >+ make/hotspot/lib/JvmOverrideFiles.gmk | 7 +++++++ >+ 1 file changed, 7 insertions(+) >+ >+diff --git a/make/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk >+index d62ba67e10..e5795efcf2 100644 >+--- /make/hotspot/lib/JvmOverrideFiles.gmk >++++ make/hotspot/lib/JvmOverrideFiles.gmk >+@@ -227,6 +227,13 @@ else ifeq ($(OPENJDK_TARGET_OS), bsd) >+ loopTransform.cpp \ >+ unsafe.cpp >+ # >++ >++ ifeq ($(OPENJDK_TARGET_CPU), aarch64) >++ JVM_PRECOMPILED_HEADER_EXCLUDE += \ >++ memnode.cpp >++ # >++ BUILD_LIBJVM_memnode.cpp_CXXFLAGS := -O0 >++ endif >+ endif >+ >+ endif >+ >+From a251c1ab6a6fcb6770969270b0085779b8a95de8 Mon Sep 17 00:00:00 2001 >+From: miki <mikael.urankar@gmail.com> >+Date: Thu, 11 Apr 2019 20:20:47 +0200 >+Subject: [PATCH 17/17] Fix ucontext on FreeBSD Fix build with clang Use >+ correct type for _Copy_* >+ >+--- >+ .../os_cpu/bsd_aarch64/os_bsd_aarch64.cpp | 77 ++++++++----------- >+ 1 file changed, 32 insertions(+), 45 deletions(-) >+ >+diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp >+index 82bf1e84b2..7b973628f7 100644 >+--- /src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp >++++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp >+@@ -77,7 +77,6 @@ >+ # include <pwd.h> >+ # include <poll.h> >+ # include <ucontext.h> >+-# include <fpu_control.h> >+ >+ #ifdef BUILTIN_SIM >+ #define REG_SP REG_RSP >+@@ -94,7 +93,12 @@ >+ #endif >+ >+ address os::current_stack_pointer() { >++#if defined(__clang__) || defined(__llvm__) >++ register void *esp; >++ __asm__ ("mov %0, " SPELL_REG_SP :"=r"(esp):); >++#else >+ register void *esp __asm__ (SPELL_REG_SP); >++#endif >+ return (address) esp; >+ } >+ >+@@ -110,7 +114,7 @@ address os::Bsd::ucontext_get_pc(const ucontext_t * uc) { >+ #ifdef BUILTIN_SIM >+ return (address)uc->uc_mcontext.gregs[REG_PC]; >+ #else >+- return (address)uc->uc_mcontext.pc; >++ return (address)uc->uc_mcontext.mc_gpregs.gp_elr; >+ #endif >+ } >+ >+@@ -118,7 +122,7 @@ void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) { >+ #ifdef BUILTIN_SIM >+ uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc; >+ #else >+- uc->uc_mcontext.pc = (intptr_t)pc; >++ uc->uc_mcontext.mc_gpregs.gp_elr = (intptr_t)pc; >+ #endif >+ } >+ >+@@ -126,7 +130,7 @@ intptr_t* os::Bsd::ucontext_get_sp(const ucontext_t * uc) { >+ #ifdef BUILTIN_SIM >+ return (intptr_t*)uc->uc_mcontext.gregs[REG_SP]; >+ #else >+- return (intptr_t*)uc->uc_mcontext.sp; >++ return (intptr_t*)uc->uc_mcontext.mc_gpregs.gp_sp; >+ #endif >+ } >+ >+@@ -134,7 +138,7 @@ intptr_t* os::Bsd::ucontext_get_fp(const ucontext_t * uc) { >+ #ifdef BUILTIN_SIM >+ return (intptr_t*)uc->uc_mcontext.gregs[REG_FP]; >+ #else >+- return (intptr_t*)uc->uc_mcontext.regs[REG_FP]; >++ return (intptr_t*)uc->uc_mcontext.mc_gpregs.gp_x[REG_FP]; >+ #endif >+ } >+ >+@@ -206,7 +210,7 @@ bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* u >+ // belong to the caller. >+ intptr_t* fp = os::Bsd::ucontext_get_fp(uc); >+ intptr_t* sp = os::Bsd::ucontext_get_sp(uc); >+- address pc = (address)(uc->uc_mcontext.regs[REG_LR] >++ address pc = (address)(uc->uc_mcontext.mc_gpregs.gp_lr >+ - NativeInstruction::instruction_size); >+ *fr = frame(sp, fp, pc); >+ if (!fr->is_java_frame()) { >+@@ -231,7 +235,12 @@ frame os::get_sender_for_C_frame(frame* fr) { >+ } >+ >+ intptr_t* _get_previous_fp() { >++#if defined(__clang__) || defined(__llvm__) >++ register intptr_t **fp; >++ __asm__("mov %0, " SPELL_REG_FP :"=r"(fp)); >++#else >+ register intptr_t **fp __asm__ (SPELL_REG_FP); >++#endif >+ >+ // fp is for this frame (_get_previous_fp). We want the fp for the >+ // caller of os::current_frame*(), so go up two frames. However, for >+@@ -343,11 +352,11 @@ JVM_handle_bsd_signal(int sig, >+ >+ #ifdef BUILTIN_SIM >+ if (pc == (address) Fetch32PFI) { >+- uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ; >++ uc->uc_mcontext.mc_gpregs.gp_elr = intptr_t(Fetch32Resume) ; >+ return 1 ; >+ } >+ if (pc == (address) FetchNPFI) { >+- uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ; >++ uc->uc_mcontext.mc_gpregs.gp_elr = intptr_t (FetchNResume) ; >+ return 1 ; >+ } >+ #else >+@@ -408,21 +417,6 @@ JVM_handle_bsd_signal(int sig, >+ // it as a hint. >+ tty->print_raw_cr("Please check if any of your loaded .so files has " >+ "enabled executable stack (see man page execstack(8))"); >+- } else { >+- // Accessing stack address below sp may cause SEGV if current >+- // thread has MAP_GROWSDOWN stack. This should only happen when >+- // current thread was created by user code with MAP_GROWSDOWN flag >+- // and then attached to VM. See notes in os_bsd.cpp. >+- if (thread->osthread()->expanding_stack() == 0) { >+- thread->osthread()->set_expanding_stack(); >+- if (os::Bsd::manually_expand_stack(thread, addr)) { >+- thread->osthread()->clear_expanding_stack(); >+- return 1; >+- } >+- thread->osthread()->clear_expanding_stack(); >+- } else { >+- fatal("recursive segv. expanding stack."); >+- } >+ } >+ } >+ } >+@@ -520,13 +514,6 @@ JVM_handle_bsd_signal(int sig, >+ void os::Bsd::init_thread_fpu_state(void) { >+ } >+ >+-int os::Bsd::get_fpu_control_word(void) { >+- return 0; >+-} >+- >+-void os::Bsd::set_fpu_control_word(int fpu_control) { >+-} >+- >+ // Check that the bsd kernel version is 2.4 or higher since earlier >+ // versions do not support SSE without patches. >+ bool os::supports_sse() { >+@@ -592,7 +579,7 @@ void os::print_context(outputStream *st, const void *context) { >+ #else >+ for (int r = 0; r < 31; r++) { >+ st->print("R%-2d=", r); >+- print_location(st, uc->uc_mcontext.regs[r]); >++ print_location(st, uc->uc_mcontext.mc_gpregs.gp_x[r]); >+ } >+ #endif >+ st->cr(); >+@@ -643,7 +630,7 @@ void os::print_register_info(outputStream *st, const void *context) { >+ st->print("R15="); print_location(st, uc->uc_mcontext.gregs[REG_R15]); >+ #else >+ for (int r = 0; r < 31; r++) >+- st->print_cr( "R%d=" INTPTR_FORMAT, r, (uintptr_t)uc->uc_mcontext.regs[r]); >++ st->print_cr( "R%d=" INTPTR_FORMAT, r, (uintptr_t)uc->uc_mcontext.mc_gpregs.gp_x[r]); >+ #endif >+ st->cr(); >+ } >+@@ -667,42 +654,42 @@ extern "C" { >+ return 0; >+ } >+ >+- void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { >++ void _Copy_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) { >+ if (from > to) { >+- jshort *end = from + count; >++ const jshort *end = from + count; >+ while (from < end) >+ *(to++) = *(from++); >+ } >+ else if (from < to) { >+- jshort *end = from; >++ const jshort *end = from; >+ from += count - 1; >+ to += count - 1; >+ while (from >= end) >+ *(to--) = *(from--); >+ } >+ } >+- void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) { >++ void _Copy_conjoint_jints_atomic(const jint* from, jint* to, size_t count) { >+ if (from > to) { >+- jint *end = from + count; >++ const jint *end = from + count; >+ while (from < end) >+ *(to++) = *(from++); >+ } >+ else if (from < to) { >+- jint *end = from; >++ const jint *end = from; >+ from += count - 1; >+ to += count - 1; >+ while (from >= end) >+ *(to--) = *(from--); >+ } >+ } >+- void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { >++ void _Copy_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { >+ if (from > to) { >+- jlong *end = from + count; >++ const jlong *end = from + count; >+ while (from < end) >+ os::atomic_copy64(from++, to++); >+ } >+ else if (from < to) { >+- jlong *end = from; >++ const jlong *end = from; >+ from += count - 1; >+ to += count - 1; >+ while (from >= end) >+@@ -710,22 +697,22 @@ extern "C" { >+ } >+ } >+ >+- void _Copy_arrayof_conjoint_bytes(HeapWord* from, >++ void _Copy_arrayof_conjoint_bytes(const HeapWord* from, >+ HeapWord* to, >+ size_t count) { >+ memmove(to, from, count); >+ } >+- void _Copy_arrayof_conjoint_jshorts(HeapWord* from, >++ void _Copy_arrayof_conjoint_jshorts(const HeapWord* from, >+ HeapWord* to, >+ size_t count) { >+ memmove(to, from, count * 2); >+ } >+- void _Copy_arrayof_conjoint_jints(HeapWord* from, >++ void _Copy_arrayof_conjoint_jints(const HeapWord* from, >+ HeapWord* to, >+ size_t count) { >+ memmove(to, from, count * 4); >+ } >+- void _Copy_arrayof_conjoint_jlongs(HeapWord* from, >++ void _Copy_arrayof_conjoint_jlongs(const HeapWord* from, >+ HeapWord* to, >+ size_t count) { >+ memmove(to, from, count * 8); >+--- src/jdk.hotspot.agent/bsd/native/libsaproc/BsdDebuggerLocal.c.orig 2019-07-16 09:59:43.558151000 +0200 >++++ src/jdk.hotspot.agent/bsd/native/libsaproc/BsdDebuggerLocal.c 2019-07-16 09:59:53.542593000 +0200 >+@@ -46,6 +46,10 @@ >+ #include "sun_jvm_hotspot_debugger_sparc_SPARCThreadContext.h" >+ #endif >+ >++#ifdef aarch64 >++#include "sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext.h" >++#endif >++ >+ static jfieldID p_ps_prochandle_ID = 0; >+ static jfieldID threadList_ID = 0; >+ static jfieldID loadObjectList_ID = 0; >+@@ -311,6 +315,9 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debu >+ #ifdef ppc64 >+ #define NPRGREG sun_jvm_hotspot_debugger_ppc64_PPC64ThreadContext_NPRGREG >+ #endif >++#ifdef aarch64 >++#define NPRGREG sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext_NPRGREG >++#endif >+ >+ array = (*env)->NewLongArray(env, NPRGREG); >+ CHECK_EXCEPTION_(0); >+@@ -441,6 +448,19 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debu >+ regs[REG_INDEX(R31)] = gregs.fixreg[31]; >+ >+ #endif >++ >++#if defined(aarch64) >++ >++#define REG_INDEX(reg) sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext_##reg >++ >++ { >++ int i; >++ for (i = 0; i < 31; i++) >++ regs[i] = gregs.x[i]; >++ regs[REG_INDEX(SP)] = gregs.sp; >++ regs[REG_INDEX(PC)] = gregs.elr; >++ } >++#endif /* aarch64 */ >+ >+ >+ (*env)->ReleaseLongArrayElements(env, array, regs, JNI_COMMIT); > >Property changes on: java/openjdk11/files/patch-aarch64 >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 239246
:
205818
|
206919