Rebase annocheck fixes for JDK 11.

Note: RHBZ#1632174 supercedes RHBZ#1624122.
This commit is contained in:
Severin Gehwolf 2018-09-28 10:31:16 +02:00
parent 5b6222d89a
commit eac7e3ef7c
6 changed files with 224 additions and 11 deletions

View File

@ -0,0 +1,84 @@
# HG changeset patch
# User sgehwolf
# Date 1536142767 -7200
# Wed Sep 05 12:19:27 2018 +0200
# Node ID 7ea57274e55054579d1532e757edb21e67beed83
# Parent 3ee91722550680c18b977f0e00b1013323b5c9ef
8210416: [linux] Poor StrictMath performance due to non-optimized compilation
Summary: Compile fdlibm with -O2 -ffp-contract=off on gcc/clang arches.
Reviewed-by: aph, erikj, dholmes, darcy
diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4
--- a/make/autoconf/flags-cflags.m4
+++ b/make/autoconf/flags-cflags.m4
@@ -373,6 +373,18 @@
FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
+ COMPILER_FP_CONTRACT_OFF_FLAG="-ffp-contract=off"
+ # Check that the compiler supports -ffp-contract=off flag
+ # Set FDLIBM_CFLAGS to -ffp-contract=off if it does. Empty
+ # otherwise.
+ # These flags are required for GCC-based builds of
+ # fdlibm with optimization without losing precision.
+ # Notably, -ffp-contract=off needs to be added for GCC >= 4.6.
+ FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_FP_CONTRACT_OFF_FLAG}],
+ IF_TRUE: [FDLIBM_CFLAGS=${COMPILER_FP_CONTRACT_OFF_FLAG}],
+ IF_FALSE: [FDLIBM_CFLAGS=""])
+ AC_SUBST(FDLIBM_CFLAGS)
+
# Tests are only ever compiled for TARGET
CFLAGS_TESTLIB="$CFLAGS_JDKLIB"
CXXFLAGS_TESTLIB="$CXXFLAGS_JDKLIB"
diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in
--- a/make/autoconf/spec.gmk.in
+++ b/make/autoconf/spec.gmk.in
@@ -450,6 +450,7 @@
LIBJSIG_HASHSTYLE_LDFLAGS := @LIBJSIG_HASHSTYLE_LDFLAGS@
LIBJSIG_NOEXECSTACK_LDFLAGS := @LIBJSIG_NOEXECSTACK_LDFLAGS@
+FDLIBM_CFLAGS := @FDLIBM_CFLAGS@
JVM_CFLAGS := @JVM_CFLAGS@
JVM_LDFLAGS := @JVM_LDFLAGS@
JVM_ASFLAGS := @JVM_ASFLAGS@
diff --git a/make/lib/CoreLibraries.gmk b/make/lib/CoreLibraries.gmk
--- a/make/lib/CoreLibraries.gmk
+++ b/make/lib/CoreLibraries.gmk
@@ -39,20 +39,15 @@
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
endif
-ifeq ($(OPENJDK_TARGET_OS), linux)
- ifeq ($(OPENJDK_TARGET_CPU), ppc64)
- BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
- else ifeq ($(OPENJDK_TARGET_CPU), ppc64le)
- BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
- else ifeq ($(OPENJDK_TARGET_CPU), s390x)
- BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
- else ifeq ($(OPENJDK_TARGET_CPU), aarch64)
- BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
- endif
+# If FDLIBM_CFLAGS is non-empty we know that we can optimize
+# fdlibm by adding those extra C flags. Currently GCC,
+# and clang only.
+ifneq ($(FDLIBM_CFLAGS), )
+ BUILD_LIBFDLIBM_OPTIMIZATION := LOW
endif
LIBFDLIBM_SRC := $(TOPDIR)/src/java.base/share/native/libfdlibm
-LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC)
+LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC) $(FDLIBM_CFLAGS)
ifneq ($(OPENJDK_TARGET_OS), macosx)
$(eval $(call SetupNativeCompilation, BUILD_LIBFDLIBM, \
@@ -64,10 +59,6 @@
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
CFLAGS_windows_debug := -DLOGGING, \
CFLAGS_aix := -qfloat=nomaf, \
- CFLAGS_linux_ppc64 := -ffp-contract=off, \
- CFLAGS_linux_ppc64le := -ffp-contract=off, \
- CFLAGS_linux_s390x := -ffp-contract=off, \
- CFLAGS_linux_aarch64 := -ffp-contract=off, \
DISABLED_WARNINGS_gcc := sign-compare misleading-indentation, \
DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
ARFLAGS := $(ARFLAGS), \

View File

@ -0,0 +1,48 @@
# HG changeset patch
# User sgehwolf
# Date 1536682731 -7200
# Tue Sep 11 18:18:51 2018 +0200
# Node ID 7157249fdd4366d95dd68f3d083ebb0ef84c753b
# Parent 8d86b149e10f0a0896e5fd4d8d407e5fda64a529
8210425: [x86] sharedRuntimeTrig/sharedRuntimeTrans compiled without optimization
Reviewed-by: duke
diff --git a/make/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk
--- a/make/hotspot/lib/JvmOverrideFiles.gmk
+++ b/make/hotspot/lib/JvmOverrideFiles.gmk
@@ -41,20 +41,26 @@
BUILD_LIBJVM_shenandoahTraversalGC.cpp_CXXFLAGS := --param inline-unit-growth=1000
endif
+LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NONE)
+# If the FDLIBM_CFLAGS variable is non-empty we know
+# that the fdlibm-fork in hotspot can get optimized
+# by using -ffp-contract=off on GCC/Clang platforms.
+ifneq ($(FDLIBM_CFLAGS), )
+ LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NORM)
+endif
+
ifeq ($(OPENJDK_TARGET_OS), linux)
BUILD_LIBJVM_ostream.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
BUILD_LIBJVM_logFileOutput.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
- ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
- BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE)
- BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE)
+ BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
+ BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
- ifeq ($(TOOLCHAIN_TYPE), clang)
- JVM_PRECOMPILED_HEADER_EXCLUDE := \
- sharedRuntimeTrig.cpp \
- sharedRuntimeTrans.cpp \
- #
- endif
+ ifeq ($(TOOLCHAIN_TYPE), clang)
+ JVM_PRECOMPILED_HEADER_EXCLUDE := \
+ sharedRuntimeTrig.cpp \
+ sharedRuntimeTrans.cpp \
+ #
endif
ifeq ($(OPENJDK_TARGET_CPU), x86)

View File

@ -0,0 +1,21 @@
# HG changeset patch
# User sgehwolf
# Date 1536751862 -7200
# Wed Sep 12 13:31:02 2018 +0200
# Node ID f95c6746fe256fe0456e0ea0d2930631ef840286
# Parent 7157249fdd4366d95dd68f3d083ebb0ef84c753b
8210647: libsaproc is being compiled without optimization
Reviewed-by: duke
diff --git a/make/lib/Lib-jdk.hotspot.agent.gmk b/make/lib/Lib-jdk.hotspot.agent.gmk
--- a/make/lib/Lib-jdk.hotspot.agent.gmk
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk
@@ -52,7 +52,7 @@
$(eval $(call SetupJdkLibrary, BUILD_LIBSA, \
NAME := saproc, \
- OPTIMIZATION := NONE, \
+ OPTIMIZATION := LOW, \
DISABLED_WARNINGS_microsoft := 4267, \
DISABLED_WARNINGS_gcc := sign-compare, \
DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \

View File

@ -0,0 +1,21 @@
# HG changeset patch
# User sgehwolf
# Date 1536829660 -7200
# Thu Sep 13 11:07:40 2018 +0200
# Node ID 39ccca116f79139fc4b779f5df83cb32357b9ae9
# Parent 7512bd28304cf0dc5676247990f1907162c719ca
8210703: vmStructs.cpp compiled with -O0
Reviewed-by: duke
diff --git a/make/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk
--- a/make/hotspot/lib/JvmOverrideFiles.gmk
+++ b/make/hotspot/lib/JvmOverrideFiles.gmk
@@ -30,7 +30,7 @@
# status for individual files on specific platforms.
ifeq ($(TOOLCHAIN_TYPE), gcc)
- BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments -O0
+ BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments
BUILD_LIBJVM_jvmciCompilerToVM.cpp_CXXFLAGS := -fno-var-tracking-assignments
BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_CXXFLAGS := -fno-var-tracking-assignments
BUILD_LIBJVM_assembler_x86.cpp_CXXFLAGS := -Wno-maybe-uninitialized

View File

@ -0,0 +1,20 @@
# HG changeset patch
# User sgehwolf
# Date 1537541916 -7200
# Fri Sep 21 16:58:36 2018 +0200
# Node ID cd8483acfe56ade257685d93323f78e6e13704a0
# Parent e40fa3a70efdbc22f85c0d30350189f632779831
8210761: libjsig is being compiled without optimization
Reviewed-by: duke
diff --git a/make/lib/Lib-java.base.gmk b/make/lib/Lib-java.base.gmk
--- a/make/lib/Lib-java.base.gmk
+++ b/make/lib/Lib-java.base.gmk
@@ -138,6 +138,7 @@
$(eval $(call SetupJdkLibrary, BUILD_LIBJSIG, \
NAME := jsig, \
+ OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJSIG_CFLAGS), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \

View File

@ -104,10 +104,11 @@
# Filter out flags from the optflags macro that cause problems with the OpenJDK build
# We filter out -O flags so that the optimization of HotSpot is not lowered from O3 to O2
# We filter out -Wall which will otherwise cause HotSpot to produce hundreds of thousands of warnings (100+mb logs)
# We replace it with -Wformat (required by -Werror=format-security) and -Wno-cpp to avoid FORTIFY_SOURCE warnings
# We filter out -fexceptions as the HotSpot build explicitly does -fno-exceptions and it's otherwise the default for C++
%global ourflags %(echo %optflags | sed -e 's|-Wall|-Wformat -Wno-cpp|')
%global ourflags %(echo %optflags | sed -e 's|-Wall|-Wformat -Wno-cpp|' | sed -r -e 's|-O[0-9]*||')
%global ourcppflags %(echo %ourflags | sed -e 's|-fexceptions||')
%global ourldflags %{__global_ldflags}
@ -837,7 +838,7 @@ Provides: java-%{javaver}-%{origin}-src%{?1} = %{epoch}:%{version}-%{release}
Name: java-%{javaver}-%{origin}
Version: %{newjavaver}.%{buildver}
Release: 8%{?dist}
Release: 9%{?dist}
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
# also included the epoch in their virtual provides. This created a
@ -924,10 +925,10 @@ Patch7: RHBZ-1630996-JDK-8210858-workaround-disable-aarch64-intrinsic-log.pat
#
#############################################
# 8210416, RHBZ#1624122: [linux] Poor StrictMath performance due to non-optimized compilation
Patch8: JDK-8210416-RHBZ-1624122-fdlibm-opt-fix.patch
# 8210425, RHBZ#1624122: [x86] sharedRuntimeTrig/sharedRuntimeTrans compiled without optimization
Patch9: JDK-8210425-RHBZ-1624122-sharedRuntimeTrig-opt-fix.patch
# 8210416, RHBZ#1632174: [linux] Poor StrictMath performance due to non-optimized compilation
Patch8: JDK-8210416-RHBZ-1632174-fdlibm-opt-fix.patch
# 8210425, RHBZ#1632174: [x86] sharedRuntimeTrig/sharedRuntimeTrans compiled without optimization
Patch9: JDK-8210425-RHBZ-1632174-sharedRuntimeTrig-opt-fix.patch
#############################################
#
@ -935,10 +936,12 @@ Patch9: JDK-8210425-RHBZ-1624122-sharedRuntimeTrig-opt-fix.patch
#
#############################################
# 8210647, RHBZ#1624122: libsaproc is being compiled without optimization
Patch10: JDK-8210647-RHBZ-1624122-libsaproc-opt-fix.patch
# 8210703, RHBZ#1624122: vmStructs.cpp compiled with -O0
Patch11: JDK-8210703-RHBZ-1624122-vmStructs-opt-fix.patch
# 8210647, RHBZ#1632174: libsaproc is being compiled without optimization
Patch10: JDK-8210647-RHBZ-1632174-libsaproc-opt-fix.patch
# 8210761, RHBZ#1632174: libjsig is being compiled without optimization
Patch11: JDK-8210761-RHBZ-1632174-libjsig-opt-fix.patch
# 8210703, RHBZ#1632174: vmStructs.cpp compiled with -O0
Patch12: JDK-8210703-RHBZ-1632174-vmStructs-opt-fix.patch
BuildRequires: autoconf
@ -1209,7 +1212,7 @@ pushd %{top_level_dir_name}
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
popd # openjdk
@ -1760,6 +1763,22 @@ require "copy_jdk_configs.lua"
%changelog
* Fri Sep 28 2018 Severin Gehwolf <sgehwolf@redhat.com> - 1:11.0.ea.28-9
- Rework changes from 1:11.0.ea.22-6. RHBZ#1632174 supercedes
RHBZ-1624122.
- Add patch, JDK-8210416-RHBZ-1632174-fdlibm-opt-fix.patch, so as to
optimize compilation of fdlibm library.
- Add patch, JDK-8210425-RHBZ-1632174-sharedRuntimeTrig-opt-fix.patch, so
as to optimize compilation of sharedRuntime{Trig,Trans}.cpp
- Add patch, JDK-8210647-RHBZ-1632174-libsaproc-opt-fix.patch, so as to
optimize compilation of libsaproc (extra c flags won't override
optimization).
- Add patch, JDK-8210761-RHBZ-1632174-libjsig-opt-fix.patch, so as to
optimize compilation of libjsig.
- Add patch, JDK-8210703-RHBZ-1632174-vmStructs-opt-fix.patch, so as to
optimize compilation of vmStructs.cpp (part of libjvm.so).
- Reinstate filtering of opt flags coming from redhat-rpm-config.
* Thu Sep 27 2018 Jiri Vanek <jvanek@redhat.com> - 1:11.0.ea.28-8
- removed version less provides
- javadocdir moved to arched dir as it is no longer noarch