Skip to content
Permalink
Browse files
8248238: Implementation: JEP 388: Windows AArch64 Support
8272181: Windows-AArch64:Backport fix of `Backtracing broken on PAC enabled systems`

Co-authored-by: Monica Beckwith <mbeckwit@openjdk.org>
Co-authored-by: Ludovic Henry <luhenry@openjdk.org>
Co-authored-by: Bernhard Urban-Forster <burban@openjdk.org>
Reviewed-by: burban, aph, adinn, mbeckwit
Backport-of: 9604ee8
  • Loading branch information
4 people authored and RealCLanger committed Nov 26, 2021
1 parent 19a1969 commit 7bdb8ac7f9f9a83779427da7a6d7f5e9ae548db7
Showing with 2,220 additions and 180 deletions.
  1. +10 −0 make/autoconf/basics.m4
  2. +36 −17 make/autoconf/basics_windows.m4
  3. +3 −1 make/autoconf/flags-cflags.m4
  4. +3 −1 make/autoconf/flags-ldflags.m4
  5. +4 −4 make/autoconf/hotspot.m4
  6. +56 −11 make/autoconf/toolchain.m4
  7. +86 −64 make/autoconf/toolchain_windows.m4
  8. +15 −0 make/devkit/createWindowsDevkit2017.sh
  9. +7 −1 make/gensrc/GensrcMisc.gmk
  10. +7 −0 make/hotspot/gensrc/GensrcAdlc.gmk
  11. +4 −0 src/hotspot/cpu/aarch64/assembler_aarch64.cpp
  12. +21 −1 src/hotspot/cpu/aarch64/assembler_aarch64.hpp
  13. +3 −0 src/hotspot/cpu/aarch64/c1_FpuStackSim_aarch64.cpp
  14. +1 −14 src/hotspot/cpu/aarch64/icache_aarch64.hpp
  15. +7 −1 src/hotspot/cpu/aarch64/immediate_aarch64.cpp
  16. +10 −10 src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
  17. +11 −3 src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp
  18. +1 −0 src/hotspot/cpu/aarch64/vm_version_ext_aarch64.cpp
  19. +137 −43 src/hotspot/os/windows/os_windows.cpp
  20. +44 −0 src/hotspot/os_cpu/linux_aarch64/icache_linux_aarch64.hpp
  21. +26 −0 src/hotspot/os_cpu/windows_aarch64/assembler_windows_aarch64.cpp
  22. +108 −0 src/hotspot/os_cpu/windows_aarch64/atomic_windows_aarch64.hpp
  23. +44 −0 src/hotspot/os_cpu/windows_aarch64/bytes_windows_aarch64.inline.hpp
  24. +158 −0 src/hotspot/os_cpu/windows_aarch64/copy_windows_aarch64.inline.hpp
  25. +50 −0 src/hotspot/os_cpu/windows_aarch64/globals_windows_aarch64.hpp
  26. +44 −0 src/hotspot/os_cpu/windows_aarch64/icache_windows_aarch64.hpp
  27. +58 −0 src/hotspot/os_cpu/windows_aarch64/orderAccess_windows_aarch64.hpp
  28. +312 −0 src/hotspot/os_cpu/windows_aarch64/os_windows_aarch64.cpp
  29. +36 −0 src/hotspot/os_cpu/windows_aarch64/os_windows_aarch64.hpp
  30. +30 −0 src/hotspot/os_cpu/windows_aarch64/os_windows_aarch64.inline.hpp
  31. +34 −0 src/hotspot/os_cpu/windows_aarch64/pauth_windows_aarch64.inline.hpp
  32. +37 −0 src/hotspot/os_cpu/windows_aarch64/prefetch_windows_aarch64.inline.hpp
  33. +100 −0 src/hotspot/os_cpu/windows_aarch64/thread_windows_aarch64.cpp
  34. +79 −0 src/hotspot/os_cpu/windows_aarch64/thread_windows_aarch64.hpp
  35. +102 −0 src/hotspot/os_cpu/windows_aarch64/unwind_windows_aarch64.hpp
  36. +49 −0 src/hotspot/os_cpu/windows_aarch64/vmStructs_windows_aarch64.hpp
  37. +87 −0 src/hotspot/os_cpu/windows_aarch64/vm_version_windows_aarch64.cpp
  38. +35 −0 src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp
  39. +5 −5 src/hotspot/share/prims/jni.cpp
  40. +13 −0 src/hotspot/share/runtime/java.hpp
  41. +4 −0 src/hotspot/share/utilities/globalDefinitions_visCPP.hpp
  42. +2 −0 src/java.base/windows/native/libjava/java_props_md.c
  43. +2 −2 src/jdk.attach/windows/classes/sun/tools/attach/AttachProviderImpl.java
  44. +3 −1 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java
  45. +4 −0 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java
  46. +94 −0 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/aarch64/WindbgAARCH64Thread.java
  47. +47 −0 ...tspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/aarch64/WindbgAARCH64ThreadContext.java
  48. +45 −0 ...tspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/aarch64/WindbgAARCH64ThreadFactory.java
  49. +5 −1 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java
  50. +138 −0 ...pot.agent/share/classes/sun/jvm/hotspot/runtime/win32_aarch64/Win32AARCH64JavaThreadPDAccess.java
  51. +3 −0 src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp
@@ -672,6 +672,16 @@ AC_DEFUN([BASIC_EVAL_DEVKIT_VARIABLE],
fi
])

###############################################################################
# Evaluates platform specific overrides for build devkit variables.
# $1: Name of variable
AC_DEFUN([BASIC_EVAL_BUILD_DEVKIT_VARIABLE],
[
if test "x[$]$1" = x; then
eval $1="\${$1_${OPENJDK_BUILD_CPU}}"
fi
])

###############################################################################
AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
[
@@ -381,10 +381,44 @@ AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH],
# called fixpath.
FIXPATH=
if test "x$OPENJDK_BUILD_OS" = xwindows; then
AC_MSG_CHECKING([if fixpath can be created])
FIXPATH_SRC="$TOPDIR/make/src/native/fixpath.c"
FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe"
FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath"
if test "x$OPENJDK_TARGET_CPU" != "xaarch64"; then
AC_MSG_CHECKING([if fixpath can be created])
FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe"
FIXPATH_SRC_W="$FIXPATH_SRC"
FIXPATH_BIN_W="$FIXPATH_BIN"
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_SRC_W])
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_BIN_W])
$RM -rf $FIXPATH_BIN $FIXPATH_DIR
$MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin
cd $FIXPATH_DIR
$CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1
cd $CURDIR
if test ! -x $FIXPATH_BIN; then
AC_MSG_RESULT([no])
cat $FIXPATH_DIR/fixpath1.log
AC_MSG_ERROR([Could not create $FIXPATH_BIN])
fi
AC_MSG_RESULT([yes])
else # OPENJDK_TARGET_CPU is aarch64
AC_MSG_CHECKING([if fixpath is in place])
FIXPATH_BIN="$TOPDIR/fixpath.exe"
$RM -rf $FIXPATH_DIR
$MKDIR -p $FIXPATH_DIR
if test ! -x $FIXPATH_BIN; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not find fixpath.exe under $TOPDIR])
fi
AC_MSG_RESULT([yes])
fi
if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
# Important to keep the .exe suffix on Cygwin for Hotspot makefiles
FIXPATH="$FIXPATH_BIN -c"
@@ -396,22 +430,7 @@ AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH],
fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'`
FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list"
fi
FIXPATH_SRC_W="$FIXPATH_SRC"
FIXPATH_BIN_W="$FIXPATH_BIN"
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_SRC_W])
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_BIN_W])
$RM -rf $FIXPATH_BIN $FIXPATH_DIR
$MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin
cd $FIXPATH_DIR
$CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1
cd $CURDIR
if test ! -x $FIXPATH_BIN; then
AC_MSG_RESULT([no])
cat $FIXPATH_DIR/fixpath1.log
AC_MSG_ERROR([Could not create $FIXPATH_BIN])
fi
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([if fixpath.exe works])
cd $FIXPATH_DIR
$FIXPATH $CC $FIXPATH_SRC -Fe$FIXPATH_DIR/fixpath2.exe \
@@ -695,7 +695,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DcpuIntel -Di586 -D$FLAGS_CPU_LEGACY_LIB"
fi
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
if test "x$FLAGS_CPU" = xx86_64; then
if test "x$FLAGS_CPU" = xaarch64; then
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_ARM64_ -Darm64"
elif test "x$FLAGS_CPU" = xx86_64; then
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_AMD64_ -Damd64"
else
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_X86_ -Dx86"
@@ -185,12 +185,14 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP],
$1_CPU_LDFLAGS_JVM_ONLY="-xarch=sparc"
fi
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
if test "x${OPENJDK_$1_CPU}" = "xx86"; then
$1_CPU_LDFLAGS="-safeseh"
# NOTE: Old build added -machine. Probably not needed.
$1_CPU_LDFLAGS_JVM_ONLY="-machine:I386"
$1_CPU_EXECUTABLE_LDFLAGS="-stack:327680"
elif test "x${OPENJDK_$1_CPU}" = "xaarch64"; then
$1_CPU_EXECUTABLE_LDFLAGS="-stack:1048576"
else
$1_CPU_LDFLAGS_JVM_ONLY="-machine:AMD64"
$1_CPU_EXECUTABLE_LDFLAGS="-stack:1048576"
@@ -221,7 +221,7 @@ AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_AOT],
if test "x$ENABLE_AOT" = "xtrue"; then
# Only enable AOT on X64 platforms.
if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-aarch64" ; then
if test -e "${TOPDIR}/src/jdk.aot"; then
if test -e "${TOPDIR}/src/jdk.internal.vm.compiler"; then
ENABLE_AOT="true"
@@ -240,7 +240,7 @@ AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_AOT],
else
ENABLE_AOT="false"
if test "x$enable_aot" = "xyes"; then
AC_MSG_ERROR([AOT is currently only supported on x86_64 and aarch64. Remove --enable-aot.])
AC_MSG_ERROR([AOT is currently only supported on x86_64 and linux-aarch64. Remove --enable-aot.])
fi
fi
fi
@@ -355,7 +355,7 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
# Only enable Shenandoah on supported arches, and only if requested
AC_MSG_CHECKING([if shenandoah can be built])
if HOTSPOT_CHECK_JVM_FEATURE(shenandoahgc); then
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86" || test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86" || test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-aarch64" ; then
AC_MSG_RESULT([yes])
else
DISABLED_JVM_FEATURES="$DISABLED_JVM_FEATURES shenandoahgc"
@@ -412,7 +412,7 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
# Only enable jvmci on x86_64, sparcv9 and aarch64
if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-aarch64" ; then
AC_MSG_RESULT([yes])
JVM_FEATURES_jvmci="jvmci"
INCLUDE_JVMCI="true"
@@ -918,14 +918,18 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
. $CONFIGURESUPPORT_OUTPUTDIR/build-devkit.info
# This potentially sets the following:
# A descriptive name of the devkit
BASIC_EVAL_DEVKIT_VARIABLE([BUILD_DEVKIT_NAME])
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_NAME])
# Corresponds to --with-extra-path
BASIC_EVAL_DEVKIT_VARIABLE([BUILD_DEVKIT_EXTRA_PATH])
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_EXTRA_PATH])
# Corresponds to --with-toolchain-path
BASIC_EVAL_DEVKIT_VARIABLE([BUILD_DEVKIT_TOOLCHAIN_PATH])
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_TOOLCHAIN_PATH])
# Corresponds to --with-sysroot
BASIC_EVAL_DEVKIT_VARIABLE([BUILD_DEVKIT_SYSROOT])
# Skip the Window specific parts
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_SYSROOT])
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_VS_INCLUDE])
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_VS_LIB])
fi
fi
AC_MSG_CHECKING([for build platform devkit])
@@ -935,13 +939,22 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
AC_MSG_RESULT([$BUILD_DEVKIT_ROOT])
fi
BUILD_SYSROOT="$BUILD_DEVKIT_SYSROOT"
PATH="$BUILD_DEVKIT_EXTRA_PATH:$PATH"
# Fallback default of just /bin if DEVKIT_PATH is not defined
# Fallback default of just /bin if DEVKIT_PATH is not defined
if test "x$BUILD_DEVKIT_TOOLCHAIN_PATH" = x; then
BUILD_DEVKIT_TOOLCHAIN_PATH="$BUILD_DEVKIT_ROOT/bin"
fi
PATH="$BUILD_DEVKIT_TOOLCHAIN_PATH:$BUILD_DEVKIT_EXTRA_PATH"
PATH="$BUILD_DEVKIT_TOOLCHAIN_PATH:$PATH"
BUILD_SYSROOT="$BUILD_DEVKIT_SYSROOT"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
BUILD_VS_INCLUDE="$BUILD_DEVKIT_VS_INCLUDE"
BUILD_VS_LIB="$BUILD_DEVKIT_VS_LIB"
TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS([BUILD_])
fi
fi
fi
@@ -967,9 +980,37 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
BASIC_FIXUP_EXECUTABLE(BUILD_STRIP)
# Assume the C compiler is the assembler
BUILD_AS="$BUILD_CC -c"
# Just like for the target compiler, use the compiler as linker
BUILD_LD="$BUILD_CC"
BUILD_LDCXX="$BUILD_CXX"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
# In the Microsoft toolchain we have a separate LD command "link".
# Make sure we reject /usr/bin/link (as determined in CYGWIN_LINK), which is
# a cygwin program for something completely different.
AC_CHECK_PROG([BUILD_LD], [link$EXE_SUFFIX],[link$EXE_SUFFIX],,, [$CYGWIN_LINK])
BASIC_FIXUP_EXECUTABLE(BUILD_LD)
# Verify that we indeed succeeded with this trick.
AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
# Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS,
# which, in combination with WSLENV, will make the WSL layer complain
old_path="$PATH"
PATH=
"$BUILD_LD" --version > /dev/null
if test $? -eq 0 ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.])
else
AC_MSG_RESULT([yes])
fi
PATH="$old_path"
BUILD_LDCXX="$BUILD_LD"
else
# Just like for the target compiler, use the compiler as linker
BUILD_LD="$BUILD_CC"
BUILD_LDCXX="$BUILD_CXX"
fi
PATH="$OLDPATH"
@@ -1025,6 +1066,10 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
if test "x$COMPILER_CPU_TEST" != "xx64"; then
AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
fi
elif test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
if test "x$COMPILER_CPU_TEST" != "xARM64"; then
AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "arm64".])
fi
fi
fi

1 comment on commit 7bdb8ac

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 7bdb8ac Nov 26, 2021

Please sign in to comment.