1 #
   2 # Copyright (c) 2013, 2016, 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_
  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_
  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 endif
  51 
  52 ifeq ($(call check-jvm-feature, shark), true)
  53   JVM_CFLAGS_FEATURES += -DSHARK $(LLVM_CFLAGS)
  54   JVM_LDFLAGS_FEATURES += $(LLVM_LDFLAGS)
  55   JVM_LIBS_FEATURES += $(LLVM_LIBS)
  56 else
  57   JVM_EXCLUDES += shark
  58 endif
  59 
  60 ifeq ($(call check-jvm-feature, minimal), true)
  61   JVM_CFLAGS_FEATURES += -DMINIMAL_JVM -DVMTYPE=\"Minimal\"
  62 endif
  63 
  64 ifeq ($(call check-jvm-feature, dtrace), true)
  65   JVM_CFLAGS_FEATURES += -DDTRACE_ENABLED
  66 endif
  67 
  68 ifeq ($(call check-jvm-feature, static-build), true)
  69   JVM_CFLAGS_FEATURES += -DSTATIC_BUILD=1
  70 endif
  71 
  72 ifneq ($(call check-jvm-feature, jvmti), true)
  73   JVM_CFLAGS_FEATURES += -DINCLUDE_JVMTI=0
  74   JVM_EXCLUDE_FILES += jvmtiGetLoadedClasses.cpp jvmtiThreadState.cpp jvmtiExtensions.cpp \
  75       jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \
  76       jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \
  77       jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \
  78       jvmtiClassFileReconstituter.cpp
  79 endif
  80 
  81 ifneq ($(call check-jvm-feature, jvmci), true)
  82   JVM_CFLAGS_FEATURES += -DINCLUDE_JVMCI=0
  83   JVM_EXCLUDES += jvmci
  84   JVM_EXCLUDE_FILES += jvmciCodeInstaller_$(HOTSPOT_TARGET_CPU_ARCH).cpp
  85 endif
  86 
  87 ifneq ($(call check-jvm-feature, fprof), true)
  88   JVM_CFLAGS_FEATURES += -DINCLUDE_FPROF=0
  89   JVM_EXCLUDE_FILES += fprofiler.cpp
  90 endif
  91 
  92 ifneq ($(call check-jvm-feature, vm-structs), true)
  93   JVM_CFLAGS_FEATURES += -DINCLUDE_VM_STRUCTS=0
  94   JVM_EXCLUDE_FILES += vmStructs.cpp
  95 endif
  96 
  97 ifneq ($(call check-jvm-feature, jni-check), true)
  98   JVM_CFLAGS_FEATURES += -DINCLUDE_JNI_CHECK=0
  99   JVM_EXCLUDE_FILES += jniCheck.cpp
 100 endif
 101 
 102 ifneq ($(call check-jvm-feature, services), true)
 103   JVM_CFLAGS_FEATURES += -DINCLUDE_SERVICES=0
 104   JVM_EXCLUDE_FILES += heapDumper.cpp heapInspection.cpp \
 105       attachListener_$(HOTSPOT_TARGET_OS).cpp attachListener.cpp
 106 endif
 107 
 108 ifneq ($(call check-jvm-feature, management), true)
 109   JVM_CFLAGS_FEATURES += -DINCLUDE_MANAGEMENT=0
 110 endif
 111 
 112 ifneq ($(call check-jvm-feature, cds), true)
 113   JVM_CFLAGS_FEATURES += -DINCLUDE_CDS=0
 114   JVM_EXCLUDE_FILES += \
 115       classListParser.cpp \
 116       classLoaderExt.cpp \
 117       filemap.cpp \
 118       metaspaceShared.cpp \
 119       metaspaceShared_$(HOTSPOT_TARGET_CPU).cpp \
 120       metaspaceShared_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
 121       sharedClassUtil.cpp \
 122       sharedPathsMiscInfo.cpp \
 123       systemDictionaryShared.cpp \
 124       #
 125 endif
 126 
 127 ifneq ($(call check-jvm-feature, all-gcs), true)
 128   JVM_CFLAGS_FEATURES += -DINCLUDE_ALL_GCS=0
 129   JVM_EXCLUDE_PATTERNS += \
 130       cms/ g1/ parallel/
 131   JVM_EXCLUDE_FILES += \
 132       concurrentGCThread.cpp \
 133       plab.cpp
 134   JVM_EXCLUDE_FILES += \
 135       g1MemoryPool.cpp \
 136       psMemoryPool.cpp
 137 endif
 138 
 139 ifneq ($(call check-jvm-feature, nmt), true)
 140   JVM_CFLAGS_FEATURES += -DINCLUDE_NMT=0
 141   JVM_EXCLUDE_FILES += \
 142       memBaseline.cpp memReporter.cpp mallocTracker.cpp virtualMemoryTracker.cpp nmtCommon.cpp \
 143       memTracker.cpp nmtDCmd.cpp mallocSiteTable.cpp
 144 endif
 145 
 146 ################################################################################
 147 
 148 ifeq ($(call check-jvm-feature, link-time-opt), true)
 149   # NOTE: Disable automatic opimization level and let the explicit cflag control
 150   # optimization level instead. This activates O3 on slowdebug builds, just
 151   # like the old build, but it's probably not right.
 152   JVM_OPTIMIZATION :=
 153   JVM_CFLAGS_FEATURES += -O3 -flto
 154   JVM_LDFLAGS_FEATURES += -O3 -flto -fwhole-program -fno-strict-aliasing
 155 endif
 156 
 157 ifeq ($(call check-jvm-feature, minimal), true)
 158   ifeq ($(call check-jvm-feature, link-time-opt), false)
 159     JVM_OPTIMIZATION := SIZE
 160     OPT_SPEED_SRC := \
 161         allocation.cpp \
 162         assembler.cpp \
 163         assembler_linux_arm.cpp \
 164         barrierSet.cpp \
 165         basicLock.cpp \
 166         biasedLocking.cpp \
 167         bytecode.cpp \
 168         bytecodeInterpreter.cpp \
 169         bytecodeInterpreter_x86.cpp \
 170         c1_Compilation.cpp \
 171         c1_Compiler.cpp \
 172         c1_GraphBuilder.cpp \
 173         c1_LinearScan.cpp \
 174         c1_LIR.cpp \
 175         ciEnv.cpp \
 176         ciObjectFactory.cpp \
 177         codeBlob.cpp \
 178         constantPool.cpp \
 179         constMethod.cpp \
 180         classLoader.cpp \
 181         classLoaderData.cpp \
 182         classFileParser.cpp \
 183         classFileStream.cpp \
 184         cpCache.cpp \
 185         defNewGeneration.cpp \
 186         frame_arm.cpp \
 187         genCollectedHeap.cpp \
 188         generation.cpp \
 189         genMarkSweep.cpp \
 190         growableArray.cpp \
 191         handles.cpp \
 192         hashtable.cpp \
 193         heap.cpp \
 194         icache.cpp \
 195         icache_arm.cpp \
 196         instanceKlass.cpp \
 197         invocationCounter.cpp \
 198         iterator.cpp \
 199         javaCalls.cpp \
 200         javaClasses.cpp \
 201         jniFastGetField_arm.cpp \
 202         jvm.cpp \
 203         jvm_linux.cpp \
 204         linkResolver.cpp \
 205         klass.cpp \
 206         klassVtable.cpp \
 207         markSweep.cpp \
 208         memRegion.cpp \
 209         memoryPool.cpp \
 210         method.cpp \
 211         methodHandles.cpp \
 212         methodHandles_arm.cpp \
 213         methodLiveness.cpp \
 214         metablock.cpp \
 215         metaspace.cpp \
 216         mutex.cpp \
 217         mutex_linux.cpp \
 218         mutexLocker.cpp \
 219         nativeLookup.cpp \
 220         objArrayKlass.cpp \
 221         os_linux.cpp \
 222         os_linux_arm.cpp \
 223         placeHolders.cpp \
 224         quickSort.cpp \
 225         resourceArea.cpp \
 226         rewriter.cpp \
 227         sharedRuntime.cpp \
 228         signature.cpp \
 229         space.cpp \
 230         stackMapTable.cpp \
 231         symbolTable.cpp \
 232         systemDictionary.cpp \
 233         symbol.cpp \
 234         synchronizer.cpp \
 235         threadLS_bsd_x86.cpp \
 236         threadLS_linux_arm.cpp \
 237         threadLS_linux_x86.cpp \
 238         timer.cpp \
 239         typeArrayKlass.cpp \
 240         unsafe.cpp \
 241         utf8.cpp \
 242         vmSymbols.cpp \
 243         #
 244 
 245     $(foreach s, $(OPT_SPEED_SRC), \
 246         $(eval BUILD_LIBJVM_$s_OPTIMIZATION := HIGHEST_JVM))
 247 
 248     BUILD_LIBJVM_systemDictionary.cpp_CXXFLAGS := -fno-optimize-sibling-calls
 249   endif
 250 endif
 251