1 # 2 # Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 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. 10 # 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). 16 # 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. 20 # 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 23 # questions. 24 # 25 26 $(eval $(call IncludeCustomExtension, hotspot/lib/JvmFeatures.gmk)) 27 28 ################################################################################ 29 # Setup CFLAGS and EXCLUDES for the libjvm compilation, depending on which 30 # jvm features are selected for this jvm variant. 31 32 ifeq ($(call check-jvm-feature, compiler1), true) 33 JVM_CFLAGS_FEATURES += -DCOMPILER1 34 else 35 JVM_EXCLUDE_PATTERNS += c1_ c1/ 36 endif 37 38 ifeq ($(call check-jvm-feature, compiler2), true) 39 JVM_CFLAGS_FEATURES += -DCOMPILER2 40 JVM_SRC_DIRS += $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles 41 else 42 JVM_EXCLUDES += opto libadt 43 JVM_EXCLUDE_FILES += bcEscapeAnalyzer.cpp ciTypeFlow.cpp 44 JVM_EXCLUDE_PATTERNS += c2_ runtime_ /c2/ 45 endif 46 47 ifeq ($(call check-jvm-feature, zero), true) 48 JVM_CFLAGS_FEATURES += -DZERO -DCC_INTERP -DZERO_LIBARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' $(LIBFFI_CFLAGS) 49 JVM_LIBS_FEATURES += $(LIBFFI_LIBS) 50 ifeq ($(ENABLE_LIBFFI_BUNDLING), true) 51 JVM_LDFLAGS_FEATURES += $(call SET_EXECUTABLE_ORIGIN,/..) 52 endif 53 ifeq ($(call isTargetCpu, sparcv9), true) 54 BUILD_LIBJVM_EXTRA_FILES := $(TOPDIR)/src/hotspot/cpu/sparc/memset_with_concurrent_readers_sparc.cpp 55 endif 56 endif 57 58 ifeq ($(JVM_VARIANT), custom) 59 JVM_CFLAGS_FEATURES += -DVMTYPE=\"Custom\" 60 endif 61 62 ifeq ($(call check-jvm-feature, minimal), true) 63 JVM_CFLAGS_FEATURES += -DMINIMAL_JVM -DVMTYPE=\"Minimal\" 64 ifeq ($(call isTargetOs, linux), true) 65 # Override the default -g with a more liberal strip policy for the minimal JVM 66 JVM_STRIPFLAGS := --strip-unneeded 67 endif 68 endif 69 70 ifeq ($(call check-jvm-feature, dtrace), true) 71 JVM_CFLAGS_FEATURES += -DDTRACE_ENABLED 72 endif 73 74 ifeq ($(call check-jvm-feature, static-build), true) 75 JVM_CFLAGS_FEATURES += -DSTATIC_BUILD=1 76 endif 77 78 ifneq ($(call check-jvm-feature, jvmti), true) 79 JVM_CFLAGS_FEATURES += -DINCLUDE_JVMTI=0 80 JVM_EXCLUDE_FILES += jvmtiGetLoadedClasses.cpp jvmtiThreadState.cpp jvmtiExtensions.cpp \ 81 jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \ 82 jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \ 83 jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \ 84 jvmtiClassFileReconstituter.cpp 85 endif 86 87 ifneq ($(call check-jvm-feature, jvmci), true) 88 JVM_CFLAGS_FEATURES += -DINCLUDE_JVMCI=0 89 JVM_EXCLUDES += jvmci 90 JVM_EXCLUDE_FILES += jvmciCodeInstaller_$(HOTSPOT_TARGET_CPU_ARCH).cpp 91 endif 92 93 ifneq ($(call check-jvm-feature, vm-structs), true) 94 JVM_CFLAGS_FEATURES += -DINCLUDE_VM_STRUCTS=0 95 JVM_EXCLUDE_FILES += vmStructs.cpp 96 endif 97 98 ifneq ($(call check-jvm-feature, jni-check), true) 99 JVM_CFLAGS_FEATURES += -DINCLUDE_JNI_CHECK=0 100 JVM_EXCLUDE_FILES += jniCheck.cpp 101 endif 102 103 ifneq ($(call check-jvm-feature, services), true) 104 JVM_CFLAGS_FEATURES += -DINCLUDE_SERVICES=0 105 JVM_EXCLUDE_FILES += heapDumper.cpp heapInspection.cpp \ 106 attachListener_$(HOTSPOT_TARGET_OS).cpp attachListener.cpp 107 endif 108 109 ifneq ($(call check-jvm-feature, management), true) 110 JVM_CFLAGS_FEATURES += -DINCLUDE_MANAGEMENT=0 111 endif 112 113 ifneq ($(call check-jvm-feature, cds), true) 114 JVM_CFLAGS_FEATURES += -DINCLUDE_CDS=0 115 JVM_EXCLUDE_FILES += \ 116 classListParser.cpp \ 117 classLoaderExt.cpp \ 118 dynamicArchive.cpp \ 119 filemap.cpp \ 120 heapShared.cpp \ 121 metaspaceShared.cpp \ 122 metaspaceShared_$(HOTSPOT_TARGET_CPU).cpp \ 123 metaspaceShared_$(HOTSPOT_TARGET_CPU_ARCH).cpp \ 124 sharedClassUtil.cpp \ 125 sharedPathsMiscInfo.cpp \ 126 systemDictionaryShared.cpp \ 127 # 128 endif 129 130 ifneq ($(call check-jvm-feature, nmt), true) 131 JVM_CFLAGS_FEATURES += -DINCLUDE_NMT=0 132 JVM_EXCLUDE_FILES += \ 133 memBaseline.cpp memReporter.cpp mallocTracker.cpp virtualMemoryTracker.cpp nmtCommon.cpp \ 134 memTracker.cpp nmtDCmd.cpp mallocSiteTable.cpp threadStackTracker.cpp 135 endif 136 137 ifneq ($(call check-jvm-feature, aot), true) 138 JVM_CFLAGS_FEATURES += -DINCLUDE_AOT=0 139 JVM_EXCLUDE_FILES += \ 140 compiledIC_aot_x86_64.cpp compiledIC_aot_aarch64.cpp \ 141 compilerRuntime.cpp aotCodeHeap.cpp aotCompiledMethod.cpp \ 142 aotLoader.cpp compiledIC_aot.cpp 143 endif 144 145 ifneq ($(call check-jvm-feature, g1gc), true) 146 JVM_CFLAGS_FEATURES += -DINCLUDE_G1GC=0 147 JVM_EXCLUDE_PATTERNS += gc/g1 148 endif 149 150 ifneq ($(call check-jvm-feature, parallelgc), true) 151 JVM_CFLAGS_FEATURES += -DINCLUDE_PARALLELGC=0 152 JVM_EXCLUDE_PATTERNS += gc/parallel 153 endif 154 155 ifneq ($(call check-jvm-feature, serialgc), true) 156 JVM_CFLAGS_FEATURES += -DINCLUDE_SERIALGC=0 157 JVM_EXCLUDE_PATTERNS += gc/serial 158 endif 159 160 ifneq ($(call check-jvm-feature, epsilongc), true) 161 JVM_CFLAGS_FEATURES += -DINCLUDE_EPSILONGC=0 162 JVM_EXCLUDE_PATTERNS += gc/epsilon 163 endif 164 165 ifneq ($(call check-jvm-feature, zgc), true) 166 JVM_CFLAGS_FEATURES += -DINCLUDE_ZGC=0 167 JVM_EXCLUDE_PATTERNS += gc/z 168 endif 169 170 ifneq ($(call check-jvm-feature, shenandoahgc), true) 171 JVM_CFLAGS_FEATURES += -DINCLUDE_SHENANDOAHGC=0 172 JVM_EXCLUDE_PATTERNS += gc/shenandoah 173 endif 174 175 ifneq ($(call check-jvm-feature, jfr), true) 176 JVM_CFLAGS_FEATURES += -DINCLUDE_JFR=0 177 JVM_EXCLUDE_PATTERNS += jfr 178 JVM_EXCLUDE_FILES += compilerEvent.cpp 179 endif 180 181 ################################################################################ 182 183 ifeq ($(call check-jvm-feature, link-time-opt), true) 184 # NOTE: Disable automatic opimization level and let the explicit cflag control 185 # optimization level instead. This activates O3 on slowdebug builds, just 186 # like the old build, but it's probably not right. 187 JVM_OPTIMIZATION := 188 JVM_CFLAGS_FEATURES += -O3 -flto 189 JVM_LDFLAGS_FEATURES += -O3 -flto -fuse-linker-plugin -fno-strict-aliasing 190 endif 191 192 ifeq ($(call check-jvm-feature, opt-size), true) 193 JVM_OPTIMIZATION := SIZE 194 OPT_SPEED_SRC := \ 195 allocation.cpp \ 196 assembler.cpp \ 197 barrierSet.cpp \ 198 basicLock.cpp \ 199 biasedLocking.cpp \ 200 bytecode.cpp \ 201 bytecodeInterpreter.cpp \ 202 c1_Compilation.cpp \ 203 c1_Compiler.cpp \ 204 c1_GraphBuilder.cpp \ 205 c1_LinearScan.cpp \ 206 c1_LIR.cpp \ 207 ciEnv.cpp \ 208 ciObjectFactory.cpp \ 209 codeBlob.cpp \ 210 constantPool.cpp \ 211 constMethod.cpp \ 212 classLoader.cpp \ 213 classLoaderData.cpp \ 214 classFileParser.cpp \ 215 classFileStream.cpp \ 216 cpCache.cpp \ 217 defNewGeneration.cpp \ 218 frame_arm.cpp \ 219 frame_aarch64.cpp \ 220 frame_ppc.cpp \ 221 frame_s390.cpp \ 222 frame_x86.cpp \ 223 genCollectedHeap.cpp \ 224 generation.cpp \ 225 genMarkSweep.cpp \ 226 growableArray.cpp \ 227 handles.cpp \ 228 hashtable.cpp \ 229 heap.cpp \ 230 icache.cpp \ 231 icache_arm.cpp \ 232 icache_aarch64.cpp \ 233 icache_ppc.cpp \ 234 icache_s390.cpp \ 235 icache_x86.cpp \ 236 instanceKlass.cpp \ 237 invocationCounter.cpp \ 238 iterator.cpp \ 239 javaCalls.cpp \ 240 javaClasses.cpp \ 241 jniFastGetField_arm.cpp \ 242 jvm.cpp \ 243 linkResolver.cpp \ 244 klass.cpp \ 245 klassVtable.cpp \ 246 markSweep.cpp \ 247 memRegion.cpp \ 248 memoryPool.cpp \ 249 method.cpp \ 250 methodHandles.cpp \ 251 methodHandles_arm.cpp \ 252 methodLiveness.cpp \ 253 metaspace.cpp \ 254 mutex.cpp \ 255 mutexLocker.cpp \ 256 nativeLookup.cpp \ 257 objArrayKlass.cpp \ 258 os_linux.cpp \ 259 os_linux_arm.cpp \ 260 resourceArea.cpp \ 261 rewriter.cpp \ 262 sharedRuntime.cpp \ 263 signature.cpp \ 264 space.cpp \ 265 stackMapTable.cpp \ 266 symbolTable.cpp \ 267 systemDictionary.cpp \ 268 symbol.cpp \ 269 synchronizer.cpp \ 270 timer.cpp \ 271 typeArrayKlass.cpp \ 272 unsafe.cpp \ 273 utf8.cpp \ 274 vmSymbols.cpp \ 275 # 276 277 $(foreach s, $(OPT_SPEED_SRC), \ 278 $(eval BUILD_LIBJVM_$s_OPTIMIZATION := HIGHEST_JVM)) 279 280 ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), ) 281 BUILD_LIBJVM_systemDictionary.cpp_CXXFLAGS := -fno-optimize-sibling-calls 282 endif 283 endif