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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
|
#
# Copyright (c) 2013, 2022, 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/JvmFeatures.gmk))
################################################################################
# Setup CFLAGS and EXCLUDES for the libjvm compilation, depending on which
# jvm features are selected for this jvm variant.
ifeq ($(call check-jvm-feature, compiler1), true)
JVM_CFLAGS_FEATURES += -DCOMPILER1
else
JVM_EXCLUDE_PATTERNS += c1_ c1/
endif
ifeq ($(call check-jvm-feature, compiler2), true)
JVM_CFLAGS_FEATURES += -DCOMPILER2
JVM_SRC_DIRS += $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles
else
JVM_EXCLUDES += opto libadt
JVM_EXCLUDE_FILES += bcEscapeAnalyzer.cpp ciTypeFlow.cpp
JVM_EXCLUDE_PATTERNS += c2_ runtime_ /c2/
endif
ifeq ($(call check-jvm-feature, zero), true)
JVM_EXCLUDES += opto libadt
JVM_EXCLUDE_PATTERNS += c1_ c1/ c2_ runtime_ /c2/
JVM_EXCLUDE_FILES += templateInterpreter.cpp templateInterpreterGenerator.cpp \
bcEscapeAnalyzer.cpp ciTypeFlow.cpp
JVM_CFLAGS_FEATURES += -DZERO -DZERO_LIBARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' $(LIBFFI_CFLAGS)
JVM_LIBS_FEATURES += $(LIBFFI_LIBS)
ifeq ($(ENABLE_LIBFFI_BUNDLING), true)
JVM_LDFLAGS_FEATURES += $(call SET_EXECUTABLE_ORIGIN,/..)
endif
else
JVM_EXCLUDE_PATTERNS += /zero/
endif
ifeq ($(JVM_VARIANT), core)
JVM_CFLAGS_FEATURES += -DVMTYPE=\"Core\"
endif
ifeq ($(JVM_VARIANT), custom)
JVM_CFLAGS_FEATURES += -DVMTYPE=\"Custom\"
endif
ifeq ($(call check-jvm-feature, minimal), true)
JVM_CFLAGS_FEATURES += -DMINIMAL_JVM -DVMTYPE=\"Minimal\"
ifeq ($(call isTargetOs, linux), true)
# Override the default -g with a more liberal strip policy for the minimal JVM
JVM_STRIPFLAGS := --strip-unneeded
endif
endif
ifeq ($(call check-jvm-feature, dtrace), true)
JVM_CFLAGS_FEATURES += -DDTRACE_ENABLED
endif
ifeq ($(call check-jvm-feature, static-build), true)
JVM_CFLAGS_FEATURES += -DSTATIC_BUILD=1
endif
ifneq ($(call check-jvm-feature, jvmti), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_JVMTI=0
JVM_EXCLUDE_FILES += jvmtiGetLoadedClasses.cpp jvmtiThreadState.cpp jvmtiExtensions.cpp \
jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \
jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \
jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \
jvmtiClassFileReconstituter.cpp jvmtiTagMapTable.cpp jvmtiAgent.cpp jvmtiAgentList.cpp
endif
ifneq ($(call check-jvm-feature, jvmci), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_JVMCI=0
JVM_EXCLUDES += jvmci
JVM_EXCLUDE_FILES += jvmciCodeInstaller_$(HOTSPOT_TARGET_CPU_ARCH).cpp
endif
ifneq ($(call check-jvm-feature, vm-structs), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_VM_STRUCTS=0
JVM_EXCLUDE_FILES += vmStructs.cpp
endif
ifneq ($(call check-jvm-feature, jni-check), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_JNI_CHECK=0
JVM_EXCLUDE_FILES += jniCheck.cpp
endif
ifneq ($(call check-jvm-feature, services), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_SERVICES=0
JVM_EXCLUDE_FILES += heapDumper.cpp heapInspection.cpp \
attachListener_$(HOTSPOT_TARGET_OS).cpp attachListener.cpp
endif
ifneq ($(call check-jvm-feature, management), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_MANAGEMENT=0
endif
ifneq ($(call check-jvm-feature, cds), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_CDS=0
JVM_EXCLUDE_FILES += \
classLoaderDataShared.cpp \
classLoaderExt.cpp \
systemDictionaryShared.cpp
JVM_EXCLUDE_PATTERNS += cds/
endif
ifneq ($(call check-jvm-feature, g1gc), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_G1GC=0
JVM_EXCLUDE_PATTERNS += gc/g1
endif
ifneq ($(call check-jvm-feature, parallelgc), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_PARALLELGC=0
JVM_EXCLUDE_PATTERNS += gc/parallel
endif
ifneq ($(call check-jvm-feature, serialgc), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_SERIALGC=0
JVM_EXCLUDE_PATTERNS += gc/serial
endif
ifneq ($(call check-jvm-feature, epsilongc), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_EPSILONGC=0
JVM_EXCLUDE_PATTERNS += gc/epsilon
endif
ifneq ($(call check-jvm-feature, zgc), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_ZGC=0
JVM_EXCLUDE_PATTERNS += gc/z
JVM_EXCLUDE_PATTERNS += gc/x
endif
ifneq ($(call check-jvm-feature, shenandoahgc), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_SHENANDOAHGC=0
JVM_EXCLUDE_PATTERNS += gc/shenandoah
endif
ifneq ($(call check-jvm-feature, jfr), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_JFR=0
JVM_EXCLUDE_PATTERNS += jfr
JVM_EXCLUDE_FILES += compilerEvent.cpp
endif
################################################################################
ifeq ($(call check-jvm-feature, link-time-opt), true)
# Set JVM_OPTIMIZATION directly so other jvm-feature flags can override it
# later on if desired
JVM_OPTIMIZATION := HIGHEST_JVM
ifeq ($(call isCompiler, gcc), true)
JVM_CFLAGS_FEATURES += -flto=auto -fuse-linker-plugin -fno-strict-aliasing -fno-fat-lto-objects
JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto=auto -fuse-linker-plugin -fno-strict-aliasing
else ifeq ($(call isCompiler, microsoft), true)
JVM_CFLAGS_FEATURES += -GL
JVM_LDFLAGS_FEATURES += -LTCG:INCREMENTAL
endif
else
ifeq ($(call isCompiler, gcc), true)
JVM_LDFLAGS_FEATURES += -O1
endif
endif
ifeq ($(call check-jvm-feature, opt-size), true)
JVM_OPTIMIZATION := SIZE
OPT_SPEED_SRC := \
allocation.cpp \
assembler.cpp \
barrierSet.cpp \
basicLock.cpp \
bytecode.cpp \
bytecodeInterpreter.cpp \
c1_Compilation.cpp \
c1_Compiler.cpp \
c1_GraphBuilder.cpp \
c1_LinearScan.cpp \
c1_LIR.cpp \
ciEnv.cpp \
ciObjectFactory.cpp \
codeBlob.cpp \
constantPool.cpp \
constMethod.cpp \
classLoader.cpp \
classLoaderData.cpp \
classFileParser.cpp \
classFileStream.cpp \
cpCache.cpp \
defNewGeneration.cpp \
frame_arm.cpp \
frame_aarch64.cpp \
frame_ppc.cpp \
frame_s390.cpp \
frame_x86.cpp \
genCollectedHeap.cpp \
generation.cpp \
genMarkSweep.cpp \
growableArray.cpp \
handles.cpp \
hashtable.cpp \
heap.cpp \
icache.cpp \
icache_arm.cpp \
icache_aarch64.cpp \
icache_ppc.cpp \
icache_s390.cpp \
icache_x86.cpp \
instanceKlass.cpp \
invocationCounter.cpp \
iterator.cpp \
javaCalls.cpp \
javaClasses.cpp \
jniFastGetField_arm.cpp \
jvm.cpp \
linkResolver.cpp \
klass.cpp \
klassVtable.cpp \
markSweep.cpp \
memRegion.cpp \
memoryPool.cpp \
method.cpp \
methodHandles.cpp \
methodHandles_arm.cpp \
methodLiveness.cpp \
metaspace.cpp \
mutex.cpp \
mutexLocker.cpp \
nativeLookup.cpp \
objArrayKlass.cpp \
os_linux.cpp \
os_linux_arm.cpp \
resourceArea.cpp \
rewriter.cpp \
sharedRuntime.cpp \
signature.cpp \
space.cpp \
stackMapTable.cpp \
symbolTable.cpp \
systemDictionary.cpp \
symbol.cpp \
synchronizer.cpp \
timer.cpp \
typeArrayKlass.cpp \
unsafe.cpp \
utf8.cpp \
vmSymbols.cpp \
#
$(foreach s, $(OPT_SPEED_SRC), \
$(eval BUILD_LIBJVM_$s_OPTIMIZATION := HIGHEST_JVM))
ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), )
BUILD_LIBJVM_systemDictionary.cpp_CXXFLAGS := -fno-optimize-sibling-calls
endif
endif
|