From d778b4cd2b80cf4da3c845ad094da354132e76c2 Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Tue, 11 Sep 2018 18:18:51 +0200 Subject: [PATCH] 8210425: [x86] sharedRuntimeTrig/sharedRuntimeTrans compiled without optimization Compile with -O2 and -ffp-contract=off as for fdlibm. Reviewed-by: erikj, lucy, aph --- make/hotspot/lib/JvmOverrideFiles.gmk | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/make/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk index cd37fda6ef2..3e32966fa18 100644 --- a/make/hotspot/lib/JvmOverrideFiles.gmk +++ b/make/hotspot/lib/JvmOverrideFiles.gmk @@ -38,20 +38,26 @@ ifeq ($(TOOLCHAIN_TYPE), gcc) BUILD_LIBJVM_interp_masm_x86.cpp_CXXFLAGS := -Wno-uninitialized 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) @@ -120,8 +126,8 @@ else ifeq ($(OPENJDK_TARGET_OS), solaris) else ifeq ($(OPENJDK_TARGET_OS), macosx) # The copied fdlibm routines in these files must not be optimized - BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE) - BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE) + BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG) + BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG) ifeq ($(TOOLCHAIN_TYPE), clang) # NOTE: The old build tested clang version to make sure this workaround # for the clang bug was still needed.