2
# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation. Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
26
$(eval $(call IncludeCustomExtension, hotspot/lib/JvmOverrideFiles.gmk))
28
################################################################################
29
# This file contains explicit overrides of CFLAGS and/or precompiled header
30
# status for individual files on specific platforms.
32
ifeq ($(TOOLCHAIN_TYPE), gcc)
33
BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments
34
BUILD_LIBJVM_jvmciCompilerToVM.cpp_CXXFLAGS := -fno-var-tracking-assignments
35
BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_CXXFLAGS := -fno-var-tracking-assignments
36
ifeq ($(DEBUG_LEVEL), release)
37
# Need extra inlining to collapse shared marking code into the hot marking loop
38
BUILD_LIBJVM_shenandoahMark.cpp_CXXFLAGS := --param inline-unit-growth=1000
42
LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NONE)
43
# If the FDLIBM_CFLAGS variable is non-empty we know
44
# that the fdlibm-fork in hotspot can get optimized
45
# by using -ffp-contract=off on GCC/Clang platforms.
46
ifneq ($(FDLIBM_CFLAGS), )
47
LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NORM)
50
ifeq ($(call isTargetOs, linux), true)
51
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
52
BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
54
ifeq ($(TOOLCHAIN_TYPE), clang)
55
JVM_PRECOMPILED_HEADER_EXCLUDE := \
56
sharedRuntimeTrig.cpp \
57
sharedRuntimeTrans.cpp \
62
ifeq ($(call isTargetCpu, x86), true)
63
# Performance measurements show that by compiling GC related code, we could
64
# significantly reduce the GC pause time on 32 bit Linux/Unix platforms by
65
# compiling without the PIC flag (-fPIC on linux).
66
# See 6454213 for more details.
67
ALL_SRC := $(call FindFiles, $(TOPDIR)/src/hotspot/share, *.cpp)
68
NONPIC_FILTER := $(addsuffix %, $(addprefix $(TOPDIR)/src/hotspot/share/, \
70
# Due to what looks like a bug in the old build implementation of this, add a
71
# couple of more files that were accidentally matched as substrings of GC related
73
NONPIC_SRC := $(filter $(NONPIC_FILTER), $(ALL_SRC)) globals.cpp location.cpp
74
# Declare variables for each source file that needs the pic flag like this:
75
# BUILD_JVM_<srcfile>_CXXFLAGS := -fno-PIC
76
# This will get implicitly picked up by SetupJdkLibrary below.
77
$(foreach s, $(NONPIC_SRC), $(eval BUILD_LIBJVM_$(notdir $s)_CXXFLAGS := -fno-PIC))
80
else ifeq ($(call isTargetOs, macosx), true)
81
# The copied fdlibm routines in these files must not be optimized
82
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
83
BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
84
ifeq ($(TOOLCHAIN_TYPE), clang)
85
# NOTE: The old build tested clang version to make sure this workaround
86
# for the clang bug was still needed.
87
BUILD_LIBJVM_loopTransform.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
89
# The following files are compiled at various optimization
90
# levels due to optimization issues encountered at the
91
# default level. The Clang compiler issues a compile
92
# time error if there is an optimization level specification
93
# skew between the PCH file and the C++ file. Especially if the
94
# PCH file is compiled at a higher optimization level than
95
# the C++ file. One solution might be to prepare extra optimization
96
# level specific PCH files for the opt build and use them here, but
97
# it's probably not worth the effort as long as only a few files
98
# need this special handling.
99
JVM_PRECOMPILED_HEADER_EXCLUDE := \
100
sharedRuntimeTrig.cpp \
101
sharedRuntimeTrans.cpp \
103
jvmciCompilerToVM.cpp \
108
else ifeq ($(call isTargetOs, aix), true)
109
ifeq ($(TOOLCHAIN_TYPE), clang)
110
BUILD_LIBJVM_synchronizer.cpp_CXXFLAGS := -fno-inline
112
BUILD_LIBJVM_synchronizer.cpp_CXXFLAGS := -qnoinline
114
BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
115
# Disable aggressive optimizations for functions in sharedRuntimeTrig.cpp
116
# and sharedRuntimeTrans.cpp on ppc64.
117
# -qstrict turns off the following optimizations:
118
# * Performing code motion and scheduling on computations such as loads
119
# and floating-point computations that may trigger an exception.
120
# * Relaxing conformance to IEEE rules.
121
# * Reassociating floating-point expressions.
122
# When using '-qstrict' there still remains one problem
123
# in javasoft.sqe.tests.api.java.lang.Math.sin5Tests when run in compile-all
124
# mode, so don't optimize sharedRuntimeTrig.cpp at all.
125
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
127
ifneq ($(DEBUG_LEVEL),slowdebug)
128
# Compiling jvmtiEnterTrace.cpp with full optimization needs more than 30min
129
# (mostly because of '-qhot=level=1' and the more than 1300 'log_trace' calls
130
# which cause a lot of template expansion).
131
BUILD_LIBJVM_jvmtiEnterTrace.cpp_OPTIMIZATION := LOW
134
# Disable ELF decoder on AIX (AIX uses XCOFF).
135
JVM_EXCLUDE_PATTERNS += elf
137
else ifeq ($(call isTargetOs, windows), true)
138
JVM_PRECOMPILED_HEADER_EXCLUDE := \
139
bytecodeInterpreter.cpp \
140
bytecodeInterpreterWithChecks.cpp \
144
osThread_windows.cpp \
145
jvmciCompilerToVMInit.cpp \
148
# Workaround for jvmciCompilerToVM.cpp long compilation time
149
BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_OPTIMIZATION := NONE