From cabe337400a0bd61d73bf3ca66e16266267299c7 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 28 May 2024 11:37:36 +0000 Subject: [PATCH] 8331921: Hotspot assembler files should use common logic to setup exported functions Reviewed-by: coleenp, erikj, dholmes --- make/hotspot/lib/CompileJvm.gmk | 6 ++ src/hotspot/os/bsd/defs.S.inc | 40 +++++++++++ src/hotspot/os/posix/defs.S.inc | 31 ++++++++ .../os_cpu/bsd_aarch64/copy_bsd_aarch64.S | 17 ++--- src/hotspot/os_cpu/bsd_aarch64/defs.S.inc | 40 +++++++++++ .../bsd_aarch64/safefetch_bsd_aarch64.S | 39 ++-------- src/hotspot/os_cpu/bsd_x86/bsd_x86_32.S | 72 ++++--------------- src/hotspot/os_cpu/bsd_x86/bsd_x86_64.S | 53 +++----------- .../os_cpu/bsd_x86/safefetch_bsd_x86_64.S | 39 ++-------- .../linux_aarch64/atomic_linux_aarch64.S | 67 +++++------------ .../os_cpu/linux_aarch64/copy_linux_aarch64.S | 10 ++- .../linux_aarch64/safefetch_linux_aarch64.S | 26 ++----- .../linux_aarch64/threadLS_linux_aarch64.S | 9 ++- src/hotspot/os_cpu/linux_arm/linux_arm_32.S | 52 +++----------- .../os_cpu/linux_arm/safefetch_linux_arm.S | 16 ++--- .../os_cpu/linux_ppc/safefetch_linux_ppc.S | 26 ++----- .../linux_riscv/safefetch_linux_riscv.S | 26 ++----- .../os_cpu/linux_s390/safefetch_linux_s390.S | 26 ++----- src/hotspot/os_cpu/linux_x86/linux_x86_32.S | 56 +++------------ src/hotspot/os_cpu/linux_x86/linux_x86_64.S | 44 +++--------- .../os_cpu/linux_x86/safefetch_linux_x86_32.S | 14 ++-- .../os_cpu/linux_x86/safefetch_linux_x86_64.S | 28 ++------ 22 files changed, 257 insertions(+), 480 deletions(-) create mode 100644 src/hotspot/os/bsd/defs.S.inc create mode 100644 src/hotspot/os/posix/defs.S.inc create mode 100644 src/hotspot/os_cpu/bsd_aarch64/defs.S.inc diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk index c2ff0064025..ad374d57cee 100644 --- a/make/hotspot/lib/CompileJvm.gmk +++ b/make/hotspot/lib/CompileJvm.gmk @@ -47,6 +47,12 @@ JVM_LDFLAGS += \ JVM_ASFLAGS += $(EXTRA_ASFLAGS) +JVM_ASFLAGS += \ + -I$(TOPDIR)/src/hotspot/os_cpu/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH) \ + -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS) \ + -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE) \ + # + JVM_LIBS += \ $(JVM_LIBS_FEATURES) \ # diff --git a/src/hotspot/os/bsd/defs.S.inc b/src/hotspot/os/bsd/defs.S.inc new file mode 100644 index 00000000000..0d6950631a5 --- /dev/null +++ b/src/hotspot/os/bsd/defs.S.inc @@ -0,0 +1,40 @@ +# +# Copyright (c) 2024, Oracle and/or its affiliates. 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 __APPLE__ + # macOS prefixes symbols with _ + #define SYMBOL(s) _ ## s + + #define DECLARE_FUNC(func) \ + .globl SYMBOL(func) ; \ + .private_extern SYMBOL(func) ; \ + SYMBOL(func) +#else + #define SYMBOL(s) s + + #define DECLARE_FUNC(func) \ + .globl func ; \ + .hidden func ; \ + .type func, %function ; \ + func +#endif diff --git a/src/hotspot/os/posix/defs.S.inc b/src/hotspot/os/posix/defs.S.inc new file mode 100644 index 00000000000..ec8c4994699 --- /dev/null +++ b/src/hotspot/os/posix/defs.S.inc @@ -0,0 +1,31 @@ +# +# Copyright (c) 2024, Oracle and/or its affiliates. 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. +# + +# Used to get a reference to a symbol. (Overridden by macOS.) +#define SYMBOL(s) s + +#define DECLARE_FUNC(func) \ + .globl func ; \ + .hidden func ; \ + .type func, %function ; \ + func 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 187cd20ddbd..a2099f39c70 100644 --- a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.S +++ b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.S @@ -1,6 +1,7 @@ /* * Copyright (c) 2016, Linaro Ltd. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. + * Copyright (c) 2024, Oracle and/or its affiliates. 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 @@ -23,15 +24,7 @@ * */ -#define CFUNC(x) _##x - - .global CFUNC(_Copy_conjoint_words) - .global CFUNC(_Copy_disjoint_words) - -#ifdef __APPLE__ - .private_extern CFUNC(_Copy_conjoint_words) - .private_extern CFUNC(_Copy_disjoint_words) -#endif +#include "defs.S.inc" s .req x0 d .req x1 @@ -46,7 +39,7 @@ t6 .req x9 t7 .req x10 .align 6 -CFUNC(_Copy_disjoint_words): +DECLARE_FUNC(_Copy_disjoint_words): // Ensure 2 word aligned tbz s, #3, fwd_copy_aligned ldr t0, [s], #8 @@ -144,10 +137,10 @@ fwd_copy_drain: ret .align 6 -CFUNC(_Copy_conjoint_words): +DECLARE_FUNC(_Copy_conjoint_words): sub t0, d, s cmp t0, count, lsl #3 - bhs CFUNC(_Copy_disjoint_words) + bhs SYMBOL(_Copy_disjoint_words) add s, s, count, lsl #3 add d, d, count, lsl #3 diff --git a/src/hotspot/os_cpu/bsd_aarch64/defs.S.inc b/src/hotspot/os_cpu/bsd_aarch64/defs.S.inc new file mode 100644 index 00000000000..717568380a9 --- /dev/null +++ b/src/hotspot/os_cpu/bsd_aarch64/defs.S.inc @@ -0,0 +1,40 @@ +# +# Copyright (c) 2024, Oracle and/or its affiliates. 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 __APPLE__ + # macOS prefixes symbols with _ + #define SYMBOL(s) _ ## s + + #define DECLARE_FUNC(func) \ + .globl SYMBOL(func) %% \ + .private_extern SYMBOL(func) %% \ + SYMBOL(func) +#else + #define SYMBOL(s) s + + #define DECLARE_FUNC(func) \ + .globl func %% \ + .hidden func %% \ + .type func, %function %% \ + func +#endif diff --git a/src/hotspot/os_cpu/bsd_aarch64/safefetch_bsd_aarch64.S b/src/hotspot/os_cpu/bsd_aarch64/safefetch_bsd_aarch64.S index b9b6df9b23a..7cb2b69d955 100644 --- a/src/hotspot/os_cpu/bsd_aarch64/safefetch_bsd_aarch64.S +++ b/src/hotspot/os_cpu/bsd_aarch64/safefetch_bsd_aarch64.S @@ -23,30 +23,7 @@ * */ -#ifdef __APPLE__ -# Darwin uses _ prefixed global symbols -#define SYMBOL(s) _ ## s -#define ELF_TYPE(name, description) -#else -#define SYMBOL(s) s -#define ELF_TYPE(name, description) .type name,description -#endif - - .global SYMBOL(SafeFetchN_impl) - .global SYMBOL(_SafeFetchN_fault) - .global SYMBOL(_SafeFetchN_continuation) - .global SYMBOL(SafeFetch32_impl) - .global SYMBOL(_SafeFetch32_fault) - .global SYMBOL(_SafeFetch32_continuation) - -#ifdef __APPLE__ - .private_extern SYMBOL(SafeFetchN_impl) - .private_extern SYMBOL(_SafeFetchN_fault) - .private_extern SYMBOL(_SafeFetchN_continuation) - .private_extern SYMBOL(SafeFetch32_impl) - .private_extern SYMBOL(_SafeFetch32_fault) - .private_extern SYMBOL(_SafeFetch32_continuation) -#endif +#include "defs.S.inc" # Support for int SafeFetch32(int* address, int defaultval); # @@ -55,12 +32,11 @@ # needed to align function start to 4 byte .align 6 - ELF_TYPE(SafeFetch32_impl,@function) -SYMBOL(SafeFetch32_impl): -SYMBOL(_SafeFetch32_fault): +DECLARE_FUNC(SafeFetch32_impl): +DECLARE_FUNC(_SafeFetch32_fault): ldr w0, [x0] ret -SYMBOL(_SafeFetch32_continuation): +DECLARE_FUNC(_SafeFetch32_continuation): mov x0, x1 ret @@ -70,11 +46,10 @@ SYMBOL(_SafeFetch32_continuation): # x0 : defaultval .align 6 - ELF_TYPE(SafeFetchN_impl,@function) -SYMBOL(SafeFetchN_impl): -SYMBOL(_SafeFetchN_fault): +DECLARE_FUNC(SafeFetchN_impl): +DECLARE_FUNC(_SafeFetchN_fault): ldr x0, [x0] ret -SYMBOL(_SafeFetchN_continuation): +DECLARE_FUNC(_SafeFetchN_continuation): mov x0, x1 ret diff --git a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.S b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.S index 5cad379df3f..7d8892bcd87 100644 --- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.S +++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.S @@ -21,18 +21,7 @@ # questions. # - -#ifdef __APPLE__ -# Darwin uses _ prefixed global symbols -#define SYMBOL(s) _ ## s -#define ELF_TYPE(name, description) -#else -#define SYMBOL(s) s -#define ELF_TYPE(name, description) .type name,description -#endif - - .globl SYMBOL(fixcw) - .globl SYMBOL(SpinPause) +#include "defs.S.inc" # NOTE WELL! The _Copy functions are called directly # from server-compiler-generated code via CallLeafNoFP, @@ -40,46 +29,18 @@ # point or use it in the same manner as does the server # compiler. - .globl SYMBOL(_Copy_arrayof_conjoint_bytes) - .globl SYMBOL(_Copy_conjoint_jshorts_atomic) - .globl SYMBOL(_Copy_arrayof_conjoint_jshorts) - .globl SYMBOL(_Copy_conjoint_jints_atomic) - .globl SYMBOL(_Copy_arrayof_conjoint_jints) - .globl SYMBOL(_Copy_conjoint_jlongs_atomic) - .globl SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts) - - .globl SYMBOL(_Atomic_cmpxchg_long) - .globl SYMBOL(_Atomic_move_long) - -#ifdef __APPLE__ - .private_extern SYMBOL(fixcw) - .private_extern SYMBOL(SpinPause) - .private_extern SYMBOL(_Copy_arrayof_conjoint_bytes) - .private_extern SYMBOL(_Copy_conjoint_jshorts_atomic) - .private_extern SYMBOL(_Copy_arrayof_conjoint_jshorts) - .private_extern SYMBOL(_Copy_conjoint_jints_atomic) - .private_extern SYMBOL(_Copy_arrayof_conjoint_jints) - .private_extern SYMBOL(_Copy_conjoint_jlongs_atomic) - .private_extern SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts) - .private_extern SYMBOL(_Atomic_cmpxchg_long) - .private_extern SYMBOL(_Atomic_move_long) -#endif - .text -# Support for void os::Solaris::init_thread_fpu_state() in os_solaris_i486.cpp # Set fpu to 53 bit precision. This happens too early to use a stub. -# ported from solaris_x86_32.s .p2align 4,,15 -SYMBOL(fixcw): +DECLARE_FUNC(fixcw): pushl $0x27f fldcw 0(%esp) popl %eax ret - ELF_TYPE(SpinPause,@function) .p2align 4,,15 -SYMBOL(SpinPause): +DECLARE_FUNC(SpinPause): rep nop movl $1, %eax @@ -90,8 +51,7 @@ SYMBOL(SpinPause): # size_t count) # .p2align 4,,15 - ELF_TYPE(_Copy_arrayof_conjoint_bytes,@function) -SYMBOL(_Copy_arrayof_conjoint_bytes): +DECLARE_FUNC(_Copy_arrayof_conjoint_bytes): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -178,8 +138,7 @@ acb_CopyLeft: # void* to, # size_t count) .p2align 4,,15 - ELF_TYPE(_Copy_conjoint_jshorts_atomic,@function) -SYMBOL(_Copy_conjoint_jshorts_atomic): +DECLARE_FUNC(_Copy_conjoint_jshorts_atomic): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -265,8 +224,7 @@ cs_CopyLeft: # void* to, # size_t count) .p2align 4,,15 - ELF_TYPE(_Copy_arrayof_conjoint_jshorts,@function) -SYMBOL(_Copy_arrayof_conjoint_jshorts): +DECLARE_FUNC(_Copy_arrayof_conjoint_jshorts): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -342,10 +300,8 @@ acs_CopyLeft: # Equivalent to # arrayof_conjoint_jints .p2align 4,,15 - ELF_TYPE(_Copy_conjoint_jints_atomic,@function) - ELF_TYPE(_Copy_arrayof_conjoint_jints,@function) -SYMBOL(_Copy_conjoint_jints_atomic): -SYMBOL(_Copy_arrayof_conjoint_jints): +DECLARE_FUNC(_Copy_conjoint_jints_atomic): +DECLARE_FUNC(_Copy_arrayof_conjoint_jints): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -417,8 +373,7 @@ ci_CopyLeft: # } # } .p2align 4,,15 - ELF_TYPE(_Copy_conjoint_jlongs_atomic,@function) -SYMBOL(_Copy_conjoint_jlongs_atomic): +DECLARE_FUNC(_Copy_conjoint_jlongs_atomic): movl 4+8(%esp),%ecx # count movl 4+0(%esp),%eax # from movl 4+4(%esp),%edx # to @@ -446,8 +401,7 @@ cla_CopyLeft: # void* to, # size_t count) .p2align 4,,15 - ELF_TYPE(_mmx_Copy_arrayof_conjoint_jshorts,@function) -SYMBOL(_mmx_Copy_arrayof_conjoint_jshorts): +DECLARE_FUNC(_mmx_Copy_arrayof_conjoint_jshorts): pushl %esi movl 4+12(%esp),%ecx pushl %edi @@ -544,8 +498,7 @@ mmx_acs_CopyLeft: # int64_t exchange_value) # .p2align 4,,15 - ELF_TYPE(_Atomic_cmpxchg_long,@function) -SYMBOL(_Atomic_cmpxchg_long): +DECLARE_FUNC(_Atomic_cmpxchg_long): # 8(%esp) : return PC pushl %ebx # 4(%esp) : old %ebx pushl %edi # 0(%esp) : old %edi @@ -564,8 +517,7 @@ SYMBOL(_Atomic_cmpxchg_long): # Support for int64_t Atomic::load and Atomic::store. # void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst) .p2align 4,,15 - ELF_TYPE(_Atomic_move_long,@function) -SYMBOL(_Atomic_move_long): +DECLARE_FUNC(_Atomic_move_long): movl 4(%esp), %eax # src fildll (%eax) movl 8(%esp), %eax # dest diff --git a/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.S b/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.S index 5e2addc4e6f..d664b929559 100644 --- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.S +++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_64.S @@ -21,14 +21,7 @@ # questions. # -#ifdef __APPLE__ -# Darwin uses _ prefixed global symbols -#define SYMBOL(s) _ ## s -#define ELF_TYPE(name, description) -#else -#define SYMBOL(s) s -#define ELF_TYPE(name, description) .type name,description -#endif +#include "defs.S.inc" # NOTE WELL! The _Copy functions are called directly # from server-compiler-generated code via CallLeafNoFP, @@ -36,31 +29,10 @@ # point or use it in the same manner as does the server # compiler. - .globl SYMBOL(SpinPause) - .globl SYMBOL(_Copy_arrayof_conjoint_bytes) - .globl SYMBOL(_Copy_arrayof_conjoint_jshorts) - .globl SYMBOL(_Copy_conjoint_jshorts_atomic) - .globl SYMBOL(_Copy_arrayof_conjoint_jints) - .globl SYMBOL(_Copy_conjoint_jints_atomic) - .globl SYMBOL(_Copy_arrayof_conjoint_jlongs) - .globl SYMBOL(_Copy_conjoint_jlongs_atomic) - -#ifdef __APPLE__ - .private_extern SYMBOL(SpinPause) - .private_extern SYMBOL(_Copy_arrayof_conjoint_bytes) - .private_extern SYMBOL(_Copy_arrayof_conjoint_jshorts) - .private_extern SYMBOL(_Copy_conjoint_jshorts_atomic) - .private_extern SYMBOL(_Copy_arrayof_conjoint_jints) - .private_extern SYMBOL(_Copy_conjoint_jints_atomic) - .private_extern SYMBOL(_Copy_arrayof_conjoint_jlongs) - .private_extern SYMBOL(_Copy_conjoint_jlongs_atomic) -#endif - .text .p2align 4,,15 - ELF_TYPE(SpinPause,@function) -SYMBOL(SpinPause): +DECLARE_FUNC(SpinPause): rep nop movq $1, %rax @@ -74,8 +46,7 @@ SYMBOL(SpinPause): # rdx - count, treated as ssize_t # .p2align 4,,15 - ELF_TYPE(_Copy_arrayof_conjoint_bytes,@function) -SYMBOL(_Copy_arrayof_conjoint_bytes): +DECLARE_FUNC(_Copy_arrayof_conjoint_bytes): movq %rdx,%r8 # byte count shrq $3,%rdx # qword count cmpq %rdi,%rsi @@ -176,10 +147,8 @@ acb_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - ELF_TYPE(_Copy_arrayof_conjoint_jshorts,@function) - ELF_TYPE(_Copy_conjoint_jshorts_atomic,@function) -SYMBOL(_Copy_arrayof_conjoint_jshorts): -SYMBOL(_Copy_conjoint_jshorts_atomic): +DECLARE_FUNC(_Copy_arrayof_conjoint_jshorts): +DECLARE_FUNC(_Copy_conjoint_jshorts_atomic): movq %rdx,%r8 # word count shrq $2,%rdx # qword count cmpq %rdi,%rsi @@ -266,10 +235,8 @@ acs_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - ELF_TYPE(_Copy_arrayof_conjoint_jints,@function) - ELF_TYPE(_Copy_conjoint_jints_atomic,@function) -SYMBOL(_Copy_arrayof_conjoint_jints): -SYMBOL(_Copy_conjoint_jints_atomic): +DECLARE_FUNC(_Copy_arrayof_conjoint_jints): +DECLARE_FUNC(_Copy_conjoint_jints_atomic): movq %rdx,%r8 # dword count shrq %rdx # qword count cmpq %rdi,%rsi @@ -345,10 +312,8 @@ aci_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - ELF_TYPE(_Copy_arrayof_conjoint_jlongs,@function) - ELF_TYPE(_Copy_conjoint_jlongs_atomic,@function) -SYMBOL(_Copy_arrayof_conjoint_jlongs): -SYMBOL(_Copy_conjoint_jlongs_atomic): +DECLARE_FUNC(_Copy_arrayof_conjoint_jlongs): +DECLARE_FUNC(_Copy_conjoint_jlongs_atomic): cmpq %rdi,%rsi leaq -8(%rdi,%rdx,8),%rax # from + count*8 - 8 jbe acl_CopyRight diff --git a/src/hotspot/os_cpu/bsd_x86/safefetch_bsd_x86_64.S b/src/hotspot/os_cpu/bsd_x86/safefetch_bsd_x86_64.S index 1697f6f03b5..36815c9b1fb 100644 --- a/src/hotspot/os_cpu/bsd_x86/safefetch_bsd_x86_64.S +++ b/src/hotspot/os_cpu/bsd_x86/safefetch_bsd_x86_64.S @@ -22,30 +22,7 @@ # questions. # -#ifdef __APPLE__ -# Darwin uses _ prefixed global symbols -#define SYMBOL(s) _ ## s -#define ELF_TYPE(name, description) -#else -#define SYMBOL(s) s -#define ELF_TYPE(name, description) .type name,description -#endif - - .globl SYMBOL(SafeFetch32_impl) - .globl SYMBOL(SafeFetchN_impl) - .globl SYMBOL(_SafeFetch32_fault) - .globl SYMBOL(_SafeFetchN_fault) - .globl SYMBOL(_SafeFetch32_continuation) - .globl SYMBOL(_SafeFetchN_continuation) - -#ifdef __APPLE__ - .private_extern SYMBOL(SafeFetch32_impl) - .private_extern SYMBOL(SafeFetchN_impl) - .private_extern SYMBOL(_SafeFetch32_fault) - .private_extern SYMBOL(_SafeFetchN_fault) - .private_extern SYMBOL(_SafeFetch32_continuation) - .private_extern SYMBOL(_SafeFetchN_continuation) -#endif +#include "defs.S.inc" .text @@ -53,12 +30,11 @@ # # %rdi : address # %esi : defaultval - ELF_TYPE(SafeFetch32_impl,@function) -SYMBOL(SafeFetch32_impl:) -SYMBOL(_SafeFetch32_fault:) +DECLARE_FUNC(SafeFetch32_impl): +DECLARE_FUNC(_SafeFetch32_fault): movl (%rdi), %eax ret -SYMBOL(_SafeFetch32_continuation:) +DECLARE_FUNC(_SafeFetch32_continuation): movl %esi, %eax ret @@ -66,11 +42,10 @@ SYMBOL(_SafeFetch32_continuation:) # # %rdi : address # %rsi : defaultval - ELF_TYPE(SafeFetchN_impl,@function) -SYMBOL(SafeFetchN_impl:) -SYMBOL(_SafeFetchN_fault:) +DECLARE_FUNC(SafeFetchN_impl): +DECLARE_FUNC(_SafeFetchN_fault): movq (%rdi), %rax ret -SYMBOL(_SafeFetchN_continuation:) +DECLARE_FUNC(_SafeFetchN_continuation): movq %rsi, %rax ret diff --git a/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.S b/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.S index e67206a9d49..2724e78862d 100644 --- a/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.S +++ b/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.S @@ -1,4 +1,5 @@ // Copyright (c) 2021, Red Hat Inc. All rights reserved. +// Copyright (c) 2024, Oracle and/or its affiliates. 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 @@ -19,14 +20,12 @@ // or visit www.oracle.com if you need additional information or have any // questions. - +#include "defs.S.inc" .text - .globl aarch64_atomic_fetch_add_8_default_impl - .hidden aarch64_atomic_fetch_add_8_default_impl .align 5 -aarch64_atomic_fetch_add_8_default_impl: +DECLARE_FUNC(aarch64_atomic_fetch_add_8_default_impl): #ifdef __ARM_FEATURE_ATOMICS ldaddal x1, x2, [x0] #else @@ -40,10 +39,8 @@ aarch64_atomic_fetch_add_8_default_impl: mov x0, x2 ret - .globl aarch64_atomic_fetch_add_4_default_impl - .hidden aarch64_atomic_fetch_add_4_default_impl .align 5 -aarch64_atomic_fetch_add_4_default_impl: +DECLARE_FUNC(aarch64_atomic_fetch_add_4_default_impl): #ifdef __ARM_FEATURE_ATOMICS ldaddal w1, w2, [x0] #else @@ -57,10 +54,8 @@ aarch64_atomic_fetch_add_4_default_impl: mov w0, w2 ret - .global aarch64_atomic_fetch_add_8_relaxed_default_impl - .hidden aarch64_atomic_fetch_add_8_relaxed_default_impl .align 5 -aarch64_atomic_fetch_add_8_relaxed_default_impl: +DECLARE_FUNC(aarch64_atomic_fetch_add_8_relaxed_default_impl): #ifdef __ARM_FEATURE_ATOMICS ldadd x1, x2, [x0] #else @@ -73,10 +68,8 @@ aarch64_atomic_fetch_add_8_relaxed_default_impl: mov x0, x2 ret - .global aarch64_atomic_fetch_add_4_relaxed_default_impl - .hidden aarch64_atomic_fetch_add_4_relaxed_default_impl .align 5 -aarch64_atomic_fetch_add_4_relaxed_default_impl: +DECLARE_FUNC(aarch64_atomic_fetch_add_4_relaxed_default_impl): #ifdef __ARM_FEATURE_ATOMICS ldadd w1, w2, [x0] #else @@ -89,10 +82,8 @@ aarch64_atomic_fetch_add_4_relaxed_default_impl: mov w0, w2 ret - .globl aarch64_atomic_xchg_4_default_impl - .hidden aarch64_atomic_xchg_4_default_impl .align 5 -aarch64_atomic_xchg_4_default_impl: +DECLARE_FUNC(aarch64_atomic_xchg_4_default_impl): #ifdef __ARM_FEATURE_ATOMICS swpal w1, w2, [x0] #else @@ -105,10 +96,8 @@ aarch64_atomic_xchg_4_default_impl: mov w0, w2 ret - .globl aarch64_atomic_xchg_8_default_impl - .hidden aarch64_atomic_xchg_8_default_impl .align 5 -aarch64_atomic_xchg_8_default_impl: +DECLARE_FUNC(aarch64_atomic_xchg_8_default_impl): #ifdef __ARM_FEATURE_ATOMICS swpal x1, x2, [x0] #else @@ -121,10 +110,8 @@ aarch64_atomic_xchg_8_default_impl: mov x0, x2 ret - .globl aarch64_atomic_cmpxchg_1_default_impl - .hidden aarch64_atomic_cmpxchg_1_default_impl .align 5 -aarch64_atomic_cmpxchg_1_default_impl: +DECLARE_FUNC(aarch64_atomic_cmpxchg_1_default_impl): #ifdef __ARM_FEATURE_ATOMICS mov x3, x1 casalb w3, w2, [x0] @@ -142,10 +129,8 @@ aarch64_atomic_cmpxchg_1_default_impl: mov w0, w3 ret - .globl aarch64_atomic_cmpxchg_4_default_impl - .hidden aarch64_atomic_cmpxchg_4_default_impl .align 5 -aarch64_atomic_cmpxchg_4_default_impl: +DECLARE_FUNC(aarch64_atomic_cmpxchg_4_default_impl): #ifdef __ARM_FEATURE_ATOMICS mov x3, x1 casal w3, w2, [x0] @@ -162,10 +147,8 @@ aarch64_atomic_cmpxchg_4_default_impl: mov w0, w3 ret - .globl aarch64_atomic_cmpxchg_8_default_impl - .hidden aarch64_atomic_cmpxchg_8_default_impl .align 5 -aarch64_atomic_cmpxchg_8_default_impl: +DECLARE_FUNC(aarch64_atomic_cmpxchg_8_default_impl): #ifdef __ARM_FEATURE_ATOMICS mov x3, x1 casal x3, x2, [x0] @@ -182,10 +165,8 @@ aarch64_atomic_cmpxchg_8_default_impl: mov x0, x3 ret - .globl aarch64_atomic_cmpxchg_4_release_default_impl - .hidden aarch64_atomic_cmpxchg_4_release_default_impl .align 5 -aarch64_atomic_cmpxchg_4_release_default_impl: +DECLARE_FUNC(aarch64_atomic_cmpxchg_4_release_default_impl): #ifdef __ARM_FEATURE_ATOMICS mov x3, x1 casl w3, w2, [x0] @@ -200,10 +181,8 @@ aarch64_atomic_cmpxchg_4_release_default_impl: 1: mov w0, w3 ret - .globl aarch64_atomic_cmpxchg_8_release_default_impl - .hidden aarch64_atomic_cmpxchg_8_release_default_impl .align 5 -aarch64_atomic_cmpxchg_8_release_default_impl: +DECLARE_FUNC(aarch64_atomic_cmpxchg_8_release_default_impl): #ifdef __ARM_FEATURE_ATOMICS mov x3, x1 casl x3, x2, [x0] @@ -218,10 +197,8 @@ aarch64_atomic_cmpxchg_8_release_default_impl: 1: mov x0, x3 ret - .globl aarch64_atomic_cmpxchg_4_seq_cst_default_impl - .hidden aarch64_atomic_cmpxchg_4_seq_cst_default_impl .align 5 -aarch64_atomic_cmpxchg_4_seq_cst_default_impl: +DECLARE_FUNC(aarch64_atomic_cmpxchg_4_seq_cst_default_impl): #ifdef __ARM_FEATURE_ATOMICS mov x3, x1 casal w3, w2, [x0] @@ -236,10 +213,8 @@ aarch64_atomic_cmpxchg_4_seq_cst_default_impl: 1: mov w0, w3 ret - .globl aarch64_atomic_cmpxchg_8_seq_cst_default_impl - .hidden aarch64_atomic_cmpxchg_8_seq_cst_default_impl .align 5 -aarch64_atomic_cmpxchg_8_seq_cst_default_impl: +DECLARE_FUNC(aarch64_atomic_cmpxchg_8_seq_cst_default_impl): #ifdef __ARM_FEATURE_ATOMICS mov x3, x1 casal x3, x2, [x0] @@ -254,10 +229,8 @@ aarch64_atomic_cmpxchg_8_seq_cst_default_impl: 1: mov x0, x3 ret -.globl aarch64_atomic_cmpxchg_1_relaxed_default_impl -.hidden aarch64_atomic_cmpxchg_1_relaxed_default_impl .align 5 -aarch64_atomic_cmpxchg_1_relaxed_default_impl: +DECLARE_FUNC(aarch64_atomic_cmpxchg_1_relaxed_default_impl): #ifdef __ARM_FEATURE_ATOMICS mov x3, x1 casb w3, w2, [x0] @@ -273,10 +246,8 @@ aarch64_atomic_cmpxchg_1_relaxed_default_impl: 1: mov w0, w3 ret - .globl aarch64_atomic_cmpxchg_4_relaxed_default_impl - .hidden aarch64_atomic_cmpxchg_4_relaxed_default_impl .align 5 -aarch64_atomic_cmpxchg_4_relaxed_default_impl: +DECLARE_FUNC(aarch64_atomic_cmpxchg_4_relaxed_default_impl): #ifdef __ARM_FEATURE_ATOMICS mov x3, x1 cas w3, w2, [x0] @@ -291,10 +262,8 @@ aarch64_atomic_cmpxchg_4_relaxed_default_impl: 1: mov w0, w3 ret - .globl aarch64_atomic_cmpxchg_8_relaxed_default_impl - .hidden aarch64_atomic_cmpxchg_8_relaxed_default_impl .align 5 -aarch64_atomic_cmpxchg_8_relaxed_default_impl: +DECLARE_FUNC(aarch64_atomic_cmpxchg_8_relaxed_default_impl): #ifdef __ARM_FEATURE_ATOMICS mov x3, x1 cas x3, x2, [x0] diff --git a/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.S b/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.S index ade867ace01..f9702d5e554 100644 --- a/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.S +++ b/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.S @@ -1,5 +1,6 @@ /* * Copyright (c) 2016, Linaro Ltd. All rights reserved. + * Copyright (c) 2024, Oracle and/or its affiliates. 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 @@ -21,11 +22,8 @@ * questions. * */ - .global _Copy_conjoint_words - .global _Copy_disjoint_words - .hidden _Copy_conjoint_words - .hidden _Copy_disjoint_words +#include "defs.S.inc" s .req x0 d .req x1 @@ -40,7 +38,7 @@ t6 .req x9 t7 .req x10 .align 6 -_Copy_disjoint_words: +DECLARE_FUNC(_Copy_disjoint_words): // Ensure 2 word aligned tbz s, #3, fwd_copy_aligned ldr t0, [s], #8 @@ -138,7 +136,7 @@ fwd_copy_drain: ret .align 6 -_Copy_conjoint_words: +DECLARE_FUNC(_Copy_conjoint_words): sub t0, d, s cmp t0, count, lsl #3 bhs _Copy_disjoint_words diff --git a/src/hotspot/os_cpu/linux_aarch64/safefetch_linux_aarch64.S b/src/hotspot/os_cpu/linux_aarch64/safefetch_linux_aarch64.S index cfbd8f45f28..82d989a9b88 100644 --- a/src/hotspot/os_cpu/linux_aarch64/safefetch_linux_aarch64.S +++ b/src/hotspot/os_cpu/linux_aarch64/safefetch_linux_aarch64.S @@ -23,29 +23,17 @@ * */ - .globl SafeFetchN_impl - .globl _SafeFetchN_fault - .globl _SafeFetchN_continuation - .globl SafeFetch32_impl - .globl _SafeFetch32_fault - .globl _SafeFetch32_continuation - - .hidden SafeFetchN_impl - .hidden _SafeFetchN_fault - .hidden _SafeFetchN_continuation - .hidden SafeFetch32_impl - .hidden _SafeFetch32_fault - .hidden _SafeFetch32_continuation +#include "defs.S.inc" # Support for int SafeFetch32(int* address, int defaultval); # # x0 : address # x1 : defaultval -SafeFetch32_impl: -_SafeFetch32_fault: +DECLARE_FUNC(SafeFetch32_impl): +DECLARE_FUNC(_SafeFetch32_fault): ldr w0, [x0] ret -_SafeFetch32_continuation: +DECLARE_FUNC(_SafeFetch32_continuation): mov x0, x1 ret @@ -53,10 +41,10 @@ _SafeFetch32_continuation: # # x1 : address # x0 : defaultval -SafeFetchN_impl: -_SafeFetchN_fault: +DECLARE_FUNC(SafeFetchN_impl): +DECLARE_FUNC(_SafeFetchN_fault): ldr x0, [x0] ret -_SafeFetchN_continuation: +DECLARE_FUNC(_SafeFetchN_continuation): mov x0, x1 ret diff --git a/src/hotspot/os_cpu/linux_aarch64/threadLS_linux_aarch64.S b/src/hotspot/os_cpu/linux_aarch64/threadLS_linux_aarch64.S index f9f5aab2a6b..ca31585871d 100644 --- a/src/hotspot/os_cpu/linux_aarch64/threadLS_linux_aarch64.S +++ b/src/hotspot/os_cpu/linux_aarch64/threadLS_linux_aarch64.S @@ -1,4 +1,5 @@ // Copyright (c) 2015, 2022, Red Hat Inc. All rights reserved. +// Copyright (c) 2024, Oracle and/or its affiliates. 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 @@ -19,17 +20,15 @@ // or visit www.oracle.com if you need additional information or have any // questions. +#include "defs.S.inc" + // 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 - .hidden _ZN10JavaThread25aarch64_get_thread_helperEv - .type _ZN10JavaThread25aarch64_get_thread_helperEv, %function - -_ZN10JavaThread25aarch64_get_thread_helperEv: +DECLARE_FUNC(_ZN10JavaThread25aarch64_get_thread_helperEv): hint #0x19 // paciasp stp x29, x30, [sp, -16]! adrp x0, :tlsdesc:_ZN6Thread12_thr_currentE diff --git a/src/hotspot/os_cpu/linux_arm/linux_arm_32.S b/src/hotspot/os_cpu/linux_arm/linux_arm_32.S index ad88c58ce78..a866858dae5 100644 --- a/src/hotspot/os_cpu/linux_arm/linux_arm_32.S +++ b/src/hotspot/os_cpu/linux_arm/linux_arm_32.S @@ -21,6 +21,7 @@ # questions. # +#include "defs.S.inc" # NOTE WELL! The _Copy functions are called directly # from server-compiler-generated code via CallLeafNoFP, @@ -28,55 +29,24 @@ # point or use it in the same manner as does the server # compiler. - .globl SpinPause - .hidden SpinPause - .type SpinPause, %function - .globl _Copy_arrayof_conjoint_bytes - .hidden _Copy_arrayof_conjoint_bytes - .type _Copy_arrayof_conjoint_bytes, %function - .globl _Copy_disjoint_words - .hidden _Copy_disjoint_words - .type _Copy_disjoint_words, %function - .globl _Copy_conjoint_words - .hidden _Copy_conjoint_words - .type _Copy_conjoint_words, %function - .globl _Copy_conjoint_jshorts_atomic - .hidden _Copy_conjoint_jshorts_atomic - .type _Copy_conjoint_jshorts_atomic, %function - .globl _Copy_arrayof_conjoint_jshorts - .hidden _Copy_arrayof_conjoint_jshorts - .type _Copy_arrayof_conjoint_jshorts, %function - .globl _Copy_conjoint_jints_atomic - .hidden _Copy_conjoint_jints_atomic - .type _Copy_conjoint_jints_atomic, %function - .globl _Copy_arrayof_conjoint_jints - .hidden _Copy_arrayof_conjoint_jints - .type _Copy_arrayof_conjoint_jints, %function - .globl _Copy_conjoint_jlongs_atomic - .hidden _Copy_conjoint_jlongs_atomic - .type _Copy_conjoint_jlongs_atomic, %function - .globl _Copy_arrayof_conjoint_jlongs - .hidden _Copy_arrayof_conjoint_jlongs - .type _Copy_arrayof_conjoint_jlongs, %function - from .req r0 to .req r1 .text -SpinPause: +DECLARE_FUNC(SpinPause): bx LR # Support for void Copy::arrayof_conjoint_bytes(void* from, # void* to, # size_t count) -_Copy_arrayof_conjoint_bytes: +DECLARE_FUNC(_Copy_arrayof_conjoint_bytes): swi 0x9f0001 # Support for void Copy::disjoint_words(void* from, # void* to, # size_t count) -_Copy_disjoint_words: +DECLARE_FUNC(_Copy_disjoint_words): stmdb sp!, {r3 - r9, ip} cmp r2, #0 @@ -121,7 +91,7 @@ disjoint_words_finish: # Support for void Copy::conjoint_words(void* from, # void* to, # size_t count) -_Copy_conjoint_words: +DECLARE_FUNC(_Copy_conjoint_words): stmdb sp!, {r3 - r9, ip} cmp r2, #0 @@ -201,7 +171,7 @@ conjoint_words_finish: # Support for void Copy::conjoint_jshorts_atomic(void* from, # void* to, # size_t count) -_Copy_conjoint_jshorts_atomic: +DECLARE_FUNC(_Copy_conjoint_jshorts_atomic): stmdb sp!, {r3 - r9, ip} cmp r2, #0 @@ -425,21 +395,21 @@ conjoint_shorts_finish: # Support for void Copy::arrayof_conjoint_jshorts(void* from, # void* to, # size_t count) -_Copy_arrayof_conjoint_jshorts: +DECLARE_FUNC(_Copy_arrayof_conjoint_jshorts): swi 0x9f0001 # Support for void Copy::conjoint_jints_atomic(void* from, # void* to, # size_t count) -_Copy_conjoint_jints_atomic: -_Copy_arrayof_conjoint_jints: +DECLARE_FUNC(_Copy_conjoint_jints_atomic): +DECLARE_FUNC(_Copy_arrayof_conjoint_jints): swi 0x9f0001 # Support for void Copy::conjoint_jlongs_atomic(jlong* from, # jlong* to, # size_t count) -_Copy_conjoint_jlongs_atomic: -_Copy_arrayof_conjoint_jlongs: +DECLARE_FUNC(_Copy_conjoint_jlongs_atomic): +DECLARE_FUNC(_Copy_arrayof_conjoint_jlongs): stmdb sp!, {r3 - r9, ip} cmp r2, #0 diff --git a/src/hotspot/os_cpu/linux_arm/safefetch_linux_arm.S b/src/hotspot/os_cpu/linux_arm/safefetch_linux_arm.S index 07e90fa3079..5c61774a71d 100644 --- a/src/hotspot/os_cpu/linux_arm/safefetch_linux_arm.S +++ b/src/hotspot/os_cpu/linux_arm/safefetch_linux_arm.S @@ -23,24 +23,16 @@ * */ - .globl SafeFetch32_impl - .globl _SafeFetch32_fault - .globl _SafeFetch32_continuation - - .hidden SafeFetch32_impl - .hidden _SafeFetch32_fault - .hidden _SafeFetch32_continuation - - .type SafeFetch32_impl, %function +#include "defs.S.inc" # Support for int SafeFetch32(int* address, int defaultval); # # r0 : address # r1 : defaultval -SafeFetch32_impl: -_SafeFetch32_fault: +DECLARE_FUNC(SafeFetch32_impl): +DECLARE_FUNC(_SafeFetch32_fault): ldr r0, [r0] bx lr -_SafeFetch32_continuation: +DECLARE_FUNC(_SafeFetch32_continuation): mov r0, r1 bx lr diff --git a/src/hotspot/os_cpu/linux_ppc/safefetch_linux_ppc.S b/src/hotspot/os_cpu/linux_ppc/safefetch_linux_ppc.S index 8c96edf01b4..43d8a4e5e98 100644 --- a/src/hotspot/os_cpu/linux_ppc/safefetch_linux_ppc.S +++ b/src/hotspot/os_cpu/linux_ppc/safefetch_linux_ppc.S @@ -23,30 +23,18 @@ * */ - .globl SafeFetchN_impl - .globl _SafeFetchN_fault - .globl _SafeFetchN_continuation - .globl SafeFetch32_impl - .globl _SafeFetch32_fault - .globl _SafeFetch32_continuation - - .hidden SafeFetchN_impl - .hidden _SafeFetchN_fault - .hidden _SafeFetchN_continuation - .hidden SafeFetch32_impl - .hidden _SafeFetch32_fault - .hidden _SafeFetch32_continuation +#include "defs.S.inc" # Support for int SafeFetch32(int* address, int defaultval); # # r3 : address # r4 : defaultval # r3 : retval -SafeFetch32_impl: -_SafeFetch32_fault: +DECLARE_FUNC(SafeFetch32_impl): +DECLARE_FUNC(_SafeFetch32_fault): lwa %r3, 0(%r3) blr -_SafeFetch32_continuation: +DECLARE_FUNC(_SafeFetch32_continuation): mr %r3, %r4 blr @@ -55,10 +43,10 @@ _SafeFetch32_continuation: # r3 : address # r4 : defaultval # r3 : retval -SafeFetchN_impl: -_SafeFetchN_fault: +DECLARE_FUNC(SafeFetchN_impl): +DECLARE_FUNC(_SafeFetchN_fault): ld %r3, 0(%r3) blr -_SafeFetchN_continuation: +DECLARE_FUNC(_SafeFetchN_continuation): mr %r3, %r4 blr diff --git a/src/hotspot/os_cpu/linux_riscv/safefetch_linux_riscv.S b/src/hotspot/os_cpu/linux_riscv/safefetch_linux_riscv.S index 150df7567bd..8c325fe55ca 100644 --- a/src/hotspot/os_cpu/linux_riscv/safefetch_linux_riscv.S +++ b/src/hotspot/os_cpu/linux_riscv/safefetch_linux_riscv.S @@ -23,30 +23,18 @@ * */ - .globl SafeFetchN_impl - .globl _SafeFetchN_fault - .globl _SafeFetchN_continuation - .globl SafeFetch32_impl - .globl _SafeFetch32_fault - .globl _SafeFetch32_continuation - - .hidden SafeFetchN_impl - .hidden _SafeFetchN_fault - .hidden _SafeFetchN_continuation - .hidden SafeFetch32_impl - .hidden _SafeFetch32_fault - .hidden _SafeFetch32_continuation +#include "defs.S.inc" # Support for int SafeFetch32(int* address, int defaultval); # # x10 (a0) : address # x11 (a1) : defaultval # x10 (a0) : retval -SafeFetch32_impl: -_SafeFetch32_fault: +DECLARE_FUNC(SafeFetch32_impl): +DECLARE_FUNC(_SafeFetch32_fault): lw a0, 0(a0) ret -_SafeFetch32_continuation: +DECLARE_FUNC(_SafeFetch32_continuation): mv a0, a1 ret @@ -55,10 +43,10 @@ _SafeFetch32_continuation: # x10 (a0) : address # x11 (a1) : defaultval # x10 (a0) : retval -SafeFetchN_impl: -_SafeFetchN_fault: +DECLARE_FUNC(SafeFetchN_impl): +DECLARE_FUNC(_SafeFetchN_fault): ld a0, 0(a0) ret -_SafeFetchN_continuation: +DECLARE_FUNC(_SafeFetchN_continuation): mv a0, a1 ret diff --git a/src/hotspot/os_cpu/linux_s390/safefetch_linux_s390.S b/src/hotspot/os_cpu/linux_s390/safefetch_linux_s390.S index 43d50c798e5..4ba9f7fb248 100644 --- a/src/hotspot/os_cpu/linux_s390/safefetch_linux_s390.S +++ b/src/hotspot/os_cpu/linux_s390/safefetch_linux_s390.S @@ -23,30 +23,18 @@ * */ - .globl SafeFetchN_impl - .globl _SafeFetchN_fault - .globl _SafeFetchN_continuation - .globl SafeFetch32_impl - .globl _SafeFetch32_fault - .globl _SafeFetch32_continuation - - .hidden SafeFetchN_impl - .hidden _SafeFetchN_fault - .hidden _SafeFetchN_continuation - .hidden SafeFetch32_impl - .hidden _SafeFetch32_fault - .hidden _SafeFetch32_continuation +#include "defs.S.inc" # Support for int SafeFetch32(int* address, int defaultval); # # r2 : address # r3 : defaultval # r2 : retval -SafeFetch32_impl: -_SafeFetch32_fault: +DECLARE_FUNC(SafeFetch32_impl): +DECLARE_FUNC(_SafeFetch32_fault): lgf %r2, 0(%r2) br %r14 -_SafeFetch32_continuation: +DECLARE_FUNC(_SafeFetch32_continuation): lgr %r2, %r3 br %r14 @@ -55,10 +43,10 @@ _SafeFetch32_continuation: # r2 : address # r3 : defaultval # r2 : retval -SafeFetchN_impl: -_SafeFetchN_fault: +DECLARE_FUNC(SafeFetchN_impl): +DECLARE_FUNC(_SafeFetchN_fault): lg %r2, 0(%r2) br %r14 -_SafeFetchN_continuation: +DECLARE_FUNC(_SafeFetchN_continuation): lgr %r2, %r3 br %r14 diff --git a/src/hotspot/os_cpu/linux_x86/linux_x86_32.S b/src/hotspot/os_cpu/linux_x86/linux_x86_32.S index e23cd2b9164..43a9a38e57f 100644 --- a/src/hotspot/os_cpu/linux_x86/linux_x86_32.S +++ b/src/hotspot/os_cpu/linux_x86/linux_x86_32.S @@ -21,7 +21,7 @@ # questions. # - .globl SpinPause +#include "defs.S.inc" # NOTE WELL! The _Copy functions are called directly # from server-compiler-generated code via CallLeafNoFP, @@ -29,35 +29,10 @@ # point or use it in the same manner as does the server # compiler. - .globl _Copy_arrayof_conjoint_bytes - .globl _Copy_conjoint_jshorts_atomic - .globl _Copy_arrayof_conjoint_jshorts - .globl _Copy_conjoint_jints_atomic - .globl _Copy_arrayof_conjoint_jints - .globl _Copy_conjoint_jlongs_atomic - .globl _mmx_Copy_arrayof_conjoint_jshorts - - .globl _Atomic_cmpxchg_long - .globl _Atomic_move_long - - .hidden SpinPause - - .hidden _Copy_arrayof_conjoint_bytes - .hidden _Copy_conjoint_jshorts_atomic - .hidden _Copy_arrayof_conjoint_jshorts - .hidden _Copy_conjoint_jints_atomic - .hidden _Copy_arrayof_conjoint_jints - .hidden _Copy_conjoint_jlongs_atomic - .hidden _mmx_Copy_arrayof_conjoint_jshorts - - .hidden _Atomic_cmpxchg_long - .hidden _Atomic_move_long - .text - .type SpinPause,@function .p2align 4,,15 -SpinPause: +DECLARE_FUNC(SpinPause): rep nop movl $1, %eax @@ -68,8 +43,7 @@ SpinPause: # size_t count) # .p2align 4,,15 - .type _Copy_arrayof_conjoint_bytes,@function -_Copy_arrayof_conjoint_bytes: +DECLARE_FUNC(_Copy_arrayof_conjoint_bytes): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -156,8 +130,7 @@ acb_CopyLeft: # void* to, # size_t count) .p2align 4,,15 - .type _Copy_conjoint_jshorts_atomic,@function -_Copy_conjoint_jshorts_atomic: +DECLARE_FUNC(_Copy_conjoint_jshorts_atomic): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -243,8 +216,7 @@ cs_CopyLeft: # void* to, # size_t count) .p2align 4,,15 - .type _Copy_arrayof_conjoint_jshorts,@function -_Copy_arrayof_conjoint_jshorts: +DECLARE_FUNC(_Copy_arrayof_conjoint_jshorts): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -320,10 +292,8 @@ acs_CopyLeft: # Equivalent to # arrayof_conjoint_jints .p2align 4,,15 - .type _Copy_conjoint_jints_atomic,@function - .type _Copy_arrayof_conjoint_jints,@function -_Copy_conjoint_jints_atomic: -_Copy_arrayof_conjoint_jints: +DECLARE_FUNC(_Copy_conjoint_jints_atomic): +DECLARE_FUNC(_Copy_arrayof_conjoint_jints): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -397,8 +367,7 @@ ci_CopyLeft: # } */ .p2align 4,,15 - .type _Copy_conjoint_jlongs_atomic,@function -_Copy_conjoint_jlongs_atomic: +DECLARE_FUNC(_Copy_conjoint_jlongs_atomic): movl 4+8(%esp),%ecx # count movl 4+0(%esp),%eax # from movl 4+4(%esp),%edx # to @@ -426,8 +395,7 @@ cla_CopyLeft: # void* to, # size_t count) .p2align 4,,15 - .type _mmx_Copy_arrayof_conjoint_jshorts,@function -_mmx_Copy_arrayof_conjoint_jshorts: +DECLARE_FUNC(_mmx_Copy_arrayof_conjoint_jshorts): pushl %esi movl 4+12(%esp),%ecx pushl %edi @@ -524,8 +492,7 @@ mmx_acs_CopyLeft: # jlong exchange_value) # .p2align 4,,15 - .type _Atomic_cmpxchg_long,@function -_Atomic_cmpxchg_long: +DECLARE_FUNC(_Atomic_cmpxchg_long): # 8(%esp) : return PC pushl %ebx # 4(%esp) : old %ebx pushl %edi # 0(%esp) : old %edi @@ -543,8 +510,7 @@ _Atomic_cmpxchg_long: # Support for jlong Atomic::load and Atomic::store. # void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst) .p2align 4,,15 - .type _Atomic_move_long,@function -_Atomic_move_long: +DECLARE_FUNC(_Atomic_move_long): movl 4(%esp), %eax # src fildll (%eax) movl 8(%esp), %eax # dest diff --git a/src/hotspot/os_cpu/linux_x86/linux_x86_64.S b/src/hotspot/os_cpu/linux_x86/linux_x86_64.S index 65580a194af..e15f27f7a6a 100644 --- a/src/hotspot/os_cpu/linux_x86/linux_x86_64.S +++ b/src/hotspot/os_cpu/linux_x86/linux_x86_64.S @@ -21,7 +21,7 @@ # questions. # - .globl SpinPause +#include "defs.S.inc" # NOTE WELL! The _Copy functions are called directly # from server-compiler-generated code via CallLeafNoFP, @@ -29,29 +29,10 @@ # point or use it in the same manner as does the server # compiler. - .globl _Copy_arrayof_conjoint_bytes - .globl _Copy_arrayof_conjoint_jshorts - .globl _Copy_conjoint_jshorts_atomic - .globl _Copy_arrayof_conjoint_jints - .globl _Copy_conjoint_jints_atomic - .globl _Copy_arrayof_conjoint_jlongs - .globl _Copy_conjoint_jlongs_atomic - - .hidden SpinPause - - .hidden _Copy_arrayof_conjoint_bytes - .hidden _Copy_arrayof_conjoint_jshorts - .hidden _Copy_conjoint_jshorts_atomic - .hidden _Copy_arrayof_conjoint_jints - .hidden _Copy_conjoint_jints_atomic - .hidden _Copy_arrayof_conjoint_jlongs - .hidden _Copy_conjoint_jlongs_atomic - .text .align 16 - .type SpinPause,@function -SpinPause: +DECLARE_FUNC(SpinPause): rep nop movq $1, %rax @@ -65,8 +46,7 @@ SpinPause: # rdx - count, treated as ssize_t # .p2align 4,,15 - .type _Copy_arrayof_conjoint_bytes,@function -_Copy_arrayof_conjoint_bytes: +DECLARE_FUNC(_Copy_arrayof_conjoint_bytes): movq %rdx,%r8 # byte count shrq $3,%rdx # qword count cmpq %rdi,%rsi @@ -167,10 +147,8 @@ acb_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - .type _Copy_arrayof_conjoint_jshorts,@function - .type _Copy_conjoint_jshorts_atomic,@function -_Copy_arrayof_conjoint_jshorts: -_Copy_conjoint_jshorts_atomic: +DECLARE_FUNC(_Copy_arrayof_conjoint_jshorts): +DECLARE_FUNC(_Copy_conjoint_jshorts_atomic): movq %rdx,%r8 # word count shrq $2,%rdx # qword count cmpq %rdi,%rsi @@ -257,10 +235,8 @@ acs_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - .type _Copy_arrayof_conjoint_jints,@function - .type _Copy_conjoint_jints_atomic,@function -_Copy_arrayof_conjoint_jints: -_Copy_conjoint_jints_atomic: +DECLARE_FUNC(_Copy_arrayof_conjoint_jints): +DECLARE_FUNC(_Copy_conjoint_jints_atomic): movq %rdx,%r8 # dword count shrq %rdx # qword count cmpq %rdi,%rsi @@ -336,10 +312,8 @@ aci_CopyLeft: # rdx - count, treated as ssize_t # .p2align 4,,15 - .type _Copy_arrayof_conjoint_jlongs,@function - .type _Copy_conjoint_jlongs_atomic,@function -_Copy_arrayof_conjoint_jlongs: -_Copy_conjoint_jlongs_atomic: +DECLARE_FUNC(_Copy_arrayof_conjoint_jlongs): +DECLARE_FUNC(_Copy_conjoint_jlongs_atomic): cmpq %rdi,%rsi leaq -8(%rdi,%rdx,8),%rax # from + count*8 - 8 jbe acl_CopyRight diff --git a/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_32.S b/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_32.S index a0f8577d8d1..73f6cdf38c9 100644 --- a/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_32.S +++ b/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_32.S @@ -21,13 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # - .globl SafeFetch32_impl - .globl _SafeFetch32_fault - .globl _SafeFetch32_continuation - .hidden SafeFetch32_impl - .hidden _SafeFetch32_fault - .hidden _SafeFetch32_continuation +#include "defs.S.inc" .text @@ -36,12 +31,11 @@ # 8(%esp) : default value # 4(%esp) : crash address # 0(%esp) : return pc - .type SafeFetch32_impl,@function -SafeFetch32_impl: +DECLARE_FUNC(SafeFetch32_impl): movl 4(%esp),%ecx # load address from stack -_SafeFetch32_fault: +DECLARE_FUNC(_SafeFetch32_fault): movl (%ecx), %eax # load target value, may fault ret -_SafeFetch32_continuation: +DECLARE_FUNC(_SafeFetch32_continuation): movl 8(%esp),%eax # load default value from stack ret diff --git a/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_64.S b/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_64.S index 1937e717088..b3145141cf2 100644 --- a/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_64.S +++ b/src/hotspot/os_cpu/linux_x86/safefetch_linux_x86_64.S @@ -21,33 +21,20 @@ # or visit www.oracle.com if you need additional information or have any # questions. # - .globl SafeFetch32_impl - .globl SafeFetchN_impl - .globl _SafeFetch32_fault - .globl _SafeFetchN_fault - .globl _SafeFetch32_continuation - .globl _SafeFetchN_continuation - .hidden SafeFetch32_impl - .hidden SafeFetchN_impl - .hidden _SafeFetch32_fault - .hidden _SafeFetchN_fault - .hidden _SafeFetch32_continuation - .hidden _SafeFetchN_continuation +#include "defs.S.inc" .text - # Support for int SafeFetch32(int* address, int defaultval); # # %rdi : address # %esi : defaultval - .type SafeFetch32_impl,@function -SafeFetch32_impl: -_SafeFetch32_fault: +DECLARE_FUNC(SafeFetch32_impl): +DECLARE_FUNC(_SafeFetch32_fault): movl (%rdi), %eax # load target value, may fault ret -_SafeFetch32_continuation: +DECLARE_FUNC(_SafeFetch32_continuation): movl %esi, %eax # return default ret @@ -55,11 +42,10 @@ _SafeFetch32_continuation: # # %rdi : address # %rsi : defaultval - .type SafeFetchN_impl,@function -SafeFetchN_impl: -_SafeFetchN_fault: +DECLARE_FUNC(SafeFetchN_impl): +DECLARE_FUNC(_SafeFetchN_fault): movq (%rdi), %rax # load target value, may fault ret -_SafeFetchN_continuation: +DECLARE_FUNC(_SafeFetchN_continuation): movq %rsi, %rax # return default ret