1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
#
# Copyright (c) 2013, 2023, 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. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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.
#
$(eval $(call IncludeCustomExtension, hotspot/lib/JvmOverrideFiles.gmk))
################################################################################
# This file contains explicit overrides of CFLAGS and/or precompiled header
# status for individual files on specific platforms.
ifeq ($(TOOLCHAIN_TYPE), gcc)
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
ifeq ($(DEBUG_LEVEL), release)
# Need extra inlining to collapse shared marking code into the hot marking loop
BUILD_LIBJVM_shenandoahMark.cpp_CXXFLAGS := --param inline-unit-growth=1000
endif
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)
# Don't optimize fdlibm-fork for Zero on Linux sparc
# See JDK-XXXX
ifeq ($(call check-jvm-feature, zero), true)
ifeq ($(OPENJDK_TARGET_OS), linux)
ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NONE)
endif
endif
endif
endif
ifeq ($(call isTargetOs, linux), true)
BUILD_LIBJVM_ostream.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
BUILD_LIBJVM_logFileOutput.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
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 \
$(OPT_SPEED_SRC) \
#
endif
ifeq ($(call isTargetCpu, x86), true)
# Performance measurements show that by compiling GC related code, we could
# significantly reduce the GC pause time on 32 bit Linux/Unix platforms by
# compiling without the PIC flag (-fPIC on linux).
# See 6454213 for more details.
ALL_SRC := $(call FindFiles, $(TOPDIR)/src/hotspot/share, *.cpp)
NONPIC_FILTER := $(addsuffix %, $(addprefix $(TOPDIR)/src/hotspot/share/, \
memory oops gc))
# Due to what looks like a bug in the old build implementation of this, add a
# couple of more files that were accidentally matched as substrings of GC related
# files.
NONPIC_SRC := $(filter $(NONPIC_FILTER), $(ALL_SRC)) globals.cpp location.cpp
# Declare variables for each source file that needs the pic flag like this:
# BUILD_JVM_<srcfile>_CXXFLAGS := -fno-PIC
# This will get implicitly picked up by SetupNativeCompilation below.
$(foreach s, $(NONPIC_SRC), $(eval BUILD_LIBJVM_$(notdir $s)_CXXFLAGS := -fno-PIC))
endif
else ifeq ($(call isTargetOs, macosx), true)
# The copied fdlibm routines in these files must not be optimized
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.
BUILD_LIBJVM_loopTransform.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
# The following files are compiled at various optimization
# levels due to optimization issues encountered at the
# default level. The Clang compiler issues a compile
# time error if there is an optimization level specification
# skew between the PCH file and the C++ file. Especially if the
# PCH file is compiled at a higher optimization level than
# the C++ file. One solution might be to prepare extra optimization
# level specific PCH files for the opt build and use them here, but
# it's probably not worth the effort as long as only a few files
# need this special handling.
JVM_PRECOMPILED_HEADER_EXCLUDE := \
sharedRuntimeTrig.cpp \
sharedRuntimeTrans.cpp \
loopTransform.cpp \
jvmciCompilerToVM.cpp \
$(OPT_SPEED_SRC) \
#
endif
else ifeq ($(call isTargetOs, aix), true)
ifeq ($(TOOLCHAIN_TYPE), clang)
BUILD_LIBJVM_synchronizer.cpp_CXXFLAGS := -fno-inline
else
BUILD_LIBJVM_synchronizer.cpp_CXXFLAGS := -qnoinline
endif
BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
# Disable aggressive optimizations for functions in sharedRuntimeTrig.cpp
# and sharedRuntimeTrans.cpp on ppc64.
# -qstrict turns off the following optimizations:
# * Performing code motion and scheduling on computations such as loads
# and floating-point computations that may trigger an exception.
# * Relaxing conformance to IEEE rules.
# * Reassociating floating-point expressions.
# When using '-qstrict' there still remains one problem
# in javasoft.sqe.tests.api.java.lang.Math.sin5Tests when run in compile-all
# mode, so don't optimize sharedRuntimeTrig.cpp at all.
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
ifneq ($(DEBUG_LEVEL),slowdebug)
# Compiling jvmtiEnterTrace.cpp with full optimization needs more than 30min
# (mostly because of '-qhot=level=1' and the more than 1300 'log_trace' calls
# which cause a lot of template expansion).
BUILD_LIBJVM_jvmtiEnterTrace.cpp_OPTIMIZATION := LOW
endif
# Disable ELF decoder on AIX (AIX uses XCOFF).
JVM_EXCLUDE_PATTERNS += elf
else ifeq ($(call isTargetOs, windows), true)
JVM_PRECOMPILED_HEADER_EXCLUDE := \
bytecodeInterpreter.cpp \
bytecodeInterpreterWithChecks.cpp \
opcodes.cpp \
os_windows.cpp \
os_windows_x86.cpp \
osThread_windows.cpp \
jvmciCompilerToVMInit.cpp \
#
# Workaround for jvmciCompilerToVM.cpp long compilation time
BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_OPTIMIZATION := NONE
endif
|