Skip to content

Commit 3949bc3

Browse files
committed
Add split patches for OpenJDK upstreaming
1 parent 320d0ff commit 3949bc3

File tree

3 files changed

+247
-0
lines changed

3 files changed

+247
-0
lines changed

upstream/armv5.patch

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
diff --git a/src/hotspot/cpu/arm/vm_version_arm_32.cpp b/src/hotspot/cpu/arm/vm_version_arm_32.cpp
2+
index df0fb2e..f15dabd 100644
3+
--- a/src/hotspot/cpu/arm/vm_version_arm_32.cpp
4+
+++ b/src/hotspot/cpu/arm/vm_version_arm_32.cpp
5+
@@ -303,6 +303,15 @@ void VM_Version::initialize() {
6+
FLAG_SET_DEFAULT(UseUnalignedAccesses, false);
7+
}
8+
9+
+ // ARMv5 MP workaround
10+
+ if (arm_arch() == 5) {
11+
+ if (FLAG_IS_DEFAULT(AssumeMP)) {
12+
+ FLAG_SET_DEFAULT(AssumeMP, false);
13+
+ } else if (AssumeMP) {
14+
+ warning("AssumeMP can not be true for ARMv5 as there is only uniprocessor support");
15+
+ FLAG_SET_DEFAULT(AssumeMP, false);
16+
+ }
17+
+ }
18+
_is_initialized = true;
19+
}
20+
21+
diff --git a/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.hpp b/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.hpp
22+
index 9e6bda2..01a4ade 100644
23+
--- a/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.hpp
24+
+++ b/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.hpp
25+
@@ -72,7 +72,7 @@ inline static void dmb_sy() {
26+
__asm__ volatile (
27+
".word 0xF57FF050 | 0xf" : : : "memory");
28+
#endif
29+
- } else {
30+
+ } else if (VM_Version::arm_arch() == 6) {
31+
intptr_t zero = 0;
32+
__asm__ volatile (
33+
"mcr p15, 0, %0, c7, c10, 5"
34+
@@ -96,7 +96,7 @@ inline static void dmb_st() {
35+
__asm__ volatile (
36+
".word 0xF57FF050 | 0xe" : : : "memory");
37+
#endif
38+
- } else {
39+
+ } else if (VM_Version::arm_arch() == 6) {
40+
intptr_t zero = 0;
41+
__asm__ volatile (
42+
"mcr p15, 0, %0, c7, c10, 5"
43+
diff --git a/src/hotspot/cpu/arm/assembler_arm_32.hpp b/src/hotspot/cpu/arm/assembler_arm_32.hpp
44+
index 53d6d17..c949c63 100644
45+
--- a/src/hotspot/cpu/arm/assembler_arm_32.hpp
46+
+++ b/src/hotspot/cpu/arm/assembler_arm_32.hpp
47+
@@ -498,7 +498,7 @@ class Assembler : public AbstractAssembler {
48+
void dmb(DMB_Opt opt, Register reg) {
49+
if (VM_Version::arm_arch() >= 7) {
50+
emit_int32(0xF57FF050 | opt);
51+
- } else {
52+
+ } else if (VM_Version::arm_arch() == 6) {
53+
bool preserve_tmp = (reg == noreg);
54+
if(preserve_tmp) {
55+
reg = Rtemp;

upstream/optimizations.patch

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
diff --git a/make/autoconf/flags-other.m4 b/make/autoconf/flags-other.m4
2+
index e10e589..c72b939 100644
3+
--- a/make/autoconf/flags-other.m4
4+
+++ b/make/autoconf/flags-other.m4
5+
@@ -121,6 +121,16 @@ AC_DEFUN([FLAGS_SETUP_ASFLAGS_CPU_DEP],
6+
# Misuse EXTRA_CFLAGS to mimic old behavior
7+
$2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS ${$2EXTRA_CFLAGS}"
8+
9+
+ if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-ev3; then
10+
+ $2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS -mcpu=arm926ej-s"
11+
+ elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-rpi1; then
12+
+ $2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS -mcpu=arm1176jzf-s"
13+
+ elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-rpi2; then
14+
+ $2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS -mcpu=cortex-a7"
15+
+ elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-rpi3; then
16+
+ $2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS -mcpu=cortex-a53"
17+
+ fi
18+
+
19+
AC_SUBST($2JVM_ASFLAGS)
20+
])
21+
22+
diff --git a/make/autoconf/flags.m4 b/make/autoconf/flags.m4
23+
index 472e7a6..45445f2 100644
24+
--- a/make/autoconf/flags.m4
25+
+++ b/make/autoconf/flags.m4
26+
@@ -34,7 +34,7 @@ m4_include([flags-other.m4])
27+
AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
28+
[
29+
AC_ARG_WITH(abi-profile, [AS_HELP_STRING([--with-abi-profile],
30+
- [specify ABI profile for ARM builds (arm-vfp-sflt,arm-vfp-hflt,arm-sflt, armv5-vfp-sflt,armv6-vfp-hflt,arm64,aarch64) @<:@toolchain dependent@:>@ ])])
31+
+ [specify ABI profile for ARM builds (arm-vfp-sflt,arm-vfp-hflt,arm-sflt,arm-ev3,arm-rpi1,arm-rpi2,arm-rpi3,armv5-vfp-sflt,armv6-vfp-hflt,arm64,aarch64) @<:@toolchain dependent@:>@ ])])
32+
33+
if test "x$with_abi_profile" != x; then
34+
if test "x$OPENJDK_TARGET_CPU" != xarm && \
35+
@@ -55,6 +55,18 @@ AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
36+
elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
37+
ARM_FLOAT_TYPE=sflt
38+
ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
39+
+ elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-ev3; then
40+
+ ARM_FLOAT_TYPE=sflt
41+
+ ARM_ARCH_TYPE_FLAGS='-mcpu=arm926ej-s -marm'
42+
+ elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-rpi1; then
43+
+ ARM_FLOAT_TYPE=vfp-hflt
44+
+ ARM_ARCH_TYPE_FLAGS='-mcpu=arm1176jzf-s -marm'
45+
+ elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-rpi2; then
46+
+ ARM_FLOAT_TYPE=vfp-hflt
47+
+ ARM_ARCH_TYPE_FLAGS='-mcpu=cortex-a7 -marm'
48+
+ elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-rpi3; then
49+
+ ARM_FLOAT_TYPE=vfp-hflt
50+
+ ARM_ARCH_TYPE_FLAGS='-mcpu=cortex-a53 -marm'
51+
elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
52+
ARM_FLOAT_TYPE=vfp-sflt
53+
ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'

upstream/softfloat.patch

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
diff --git a/make/autoconf/lib-softfloat.m4 b/make/autoconf/lib-softfloat.m4
2+
new file mode 100644
3+
index 0000000..7fa1ed1
4+
--- /dev/null
5+
+++ b/make/autoconf/lib-softfloat.m4
6+
@@ -0,0 +1,57 @@
7+
+#
8+
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
9+
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10+
+#
11+
+# This code is free software; you can redistribute it and/or modify it
12+
+# under the terms of the GNU General Public License version 2 only, as
13+
+# published by the Free Software Foundation. Oracle designates this
14+
+# particular file as subject to the "Classpath" exception as provided
15+
+# by Oracle in the LICENSE file that accompanied this code.
16+
+#
17+
+# This code is distributed in the hope that it will be useful, but WITHOUT
18+
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19+
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20+
+# version 2 for more details (a copy is included in the LICENSE file that
21+
+# accompanied this code).
22+
+#
23+
+# You should have received a copy of the GNU General Public License version
24+
+# 2 along with this work; if not, write to the Free Software Foundation,
25+
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26+
+#
27+
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
28+
+# or visit www.oracle.com if you need additional information or have any
29+
+# questions.
30+
+#
31+
+
32+
+################################################################################
33+
+# Setup softfloat helper
34+
+################################################################################
35+
+AC_DEFUN_ONCE([LIB_SETUP_SOFTFLOAT],
36+
+[
37+
+ AC_ARG_WITH(softfloat, [AS_HELP_STRING([--with-softfloat],
38+
+ [specify path to patched softfloat.a])])
39+
+
40+
+ if test "x$NEEDS_LIB_SOFTFLOAT" = xfalse; then
41+
+ if (test "x${with_softfloat}" != x && test "x${with_softfloat}" != xno); then
42+
+ AC_MSG_WARN([[softfloat not used, so --with-softfloat is ignored]])
43+
+ fi
44+
+ SOFTFLOAT_LIBS=
45+
+ else
46+
+ SOFTFLOAT_FOUND=no
47+
+
48+
+ if test "x${with_softfloat}" = xno; then
49+
+ AC_MSG_ERROR([It is not possible to disable the use of softfloat. Remove the --without-softfloat option.])
50+
+ fi
51+
+
52+
+ if test "x${with_softfloat}" != x; then
53+
+ SOFTFLOAT_LIBS="${with_softfloat}"
54+
+ SOFTFLOAT_FOUND=yes
55+
+ fi
56+
+ if test "x$SOFTFLOAT_FOUND" = xno; then
57+
+ HELP_MSG_MISSING_DEPENDENCY([softfloat])
58+
+ AC_MSG_ERROR([Could not find softfloat! $HELP_MSG])
59+
+ fi
60+
+ fi
61+
+
62+
+ AC_SUBST(SOFTFLOAT_LIBS)
63+
+])
64+
diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
65+
index 5bf8569..eec4be6 100644
66+
--- a/make/autoconf/libraries.m4
67+
+++ b/make/autoconf/libraries.m4
68+
@@ -32,6 +32,7 @@ m4_include([lib-freetype.m4])
69+
m4_include([lib-std.m4])
70+
m4_include([lib-x11.m4])
71+
m4_include([lib-fontconfig.m4])
72+
+m4_include([lib-softfloat.m4])
73+
74+
################################################################################
75+
# Determine which libraries are needed for this configuration
76+
@@ -78,6 +79,13 @@ AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
77+
NEEDS_LIB_ALSA=false
78+
fi
79+
80+
+ if (test "x$OPENJDK_TARGET_CPU" == xarm &&
81+
+ test "x$ARM_FLOAT_TYPE" = xsflt); then
82+
+ NEEDS_LIB_SOFTFLOAT=true
83+
+ else
84+
+ NEEDS_LIB_SOFTFLOAT=false
85+
+ fi
86+
+
87+
# Check if ffi is needed
88+
if HOTSPOT_CHECK_JVM_VARIANT(zero); then
89+
NEEDS_LIB_FFI=true
90+
@@ -97,6 +105,7 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
91+
LIB_SETUP_FONTCONFIG
92+
LIB_SETUP_FREETYPE
93+
LIB_SETUP_ALSA
94+
+ LIB_SETUP_SOFTFLOAT
95+
LIB_SETUP_LIBFFI
96+
LIB_SETUP_BUNDLED_LIBS
97+
LIB_SETUP_MISC_LIBS
98+
diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in
99+
index ec45949..f3b222e 100644
100+
--- a/make/autoconf/spec.gmk.in
101+
+++ b/make/autoconf/spec.gmk.in
102+
@@ -343,6 +343,7 @@ FONTCONFIG_CFLAGS:=@FONTCONFIG_CFLAGS@
103+
CUPS_CFLAGS:=@CUPS_CFLAGS@
104+
ALSA_LIBS:=@ALSA_LIBS@
105+
ALSA_CFLAGS:=@ALSA_CFLAGS@
106+
+SOFTFLOAT_LIBS:=@SOFTFLOAT_LIBS@
107+
LIBFFI_LIBS:=@LIBFFI_LIBS@
108+
LIBFFI_CFLAGS:=@LIBFFI_CFLAGS@
109+
ENABLE_LIBFFI_BUNDLING:=@ENABLE_LIBFFI_BUNDLING@
110+
diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk
111+
index a4b67f0..15f8ae6 100644
112+
--- a/make/hotspot/lib/CompileJvm.gmk
113+
+++ b/make/hotspot/lib/CompileJvm.gmk
114+
@@ -49,6 +49,7 @@ JVM_LDFLAGS += \
115+
116+
JVM_LIBS += \
117+
$(JVM_LIBS_FEATURES) \
118+
+ $(SOFTFLOAT_LIBS) \
119+
#
120+
121+
# These files and directories are always excluded
122+
diff --git a/src/hotspot/cpu/arm/assembler_arm_32.hpp b/src/hotspot/cpu/arm/assembler_arm_32.hpp
123+
index 53d6d17..c949c63 100644
124+
--- a/src/hotspot/cpu/arm/assembler_arm_32.hpp
125+
+++ b/src/hotspot/cpu/arm/assembler_arm_32.hpp
126+
@@ -1239,10 +1239,11 @@ extern int __aeabi_dcmpgt(double, double);
127+
128+
// Imported code from glibc soft-fp bundle for
129+
// calculation accuracy improvement. See CR 6757269.
130+
-extern double __aeabi_fadd_glibc(float, float);
131+
-extern double __aeabi_fsub_glibc(float, float);
132+
+extern float __aeabi_fadd_glibc(float, float);
133+
+extern float __aeabi_fsub_glibc(float, float);
134+
extern double __aeabi_dadd_glibc(double, double);
135+
extern double __aeabi_dsub_glibc(double, double);
136+
+
137+
};
138+
#endif // __SOFTFP__
139+

0 commit comments

Comments
 (0)