1 #
   2 # Copyright (c) 2013, 2018, 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/JvmOverrideFiles.gmk))
  27 
  28 ################################################################################
  29 # This file contains explicit overrides of CFLAGS and/or precompiled header
  30 # status for individual files on specific platforms.
  31 
  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   BUILD_LIBJVM_assembler_x86.cpp_CXXFLAGS := -Wno-maybe-uninitialized
  37   BUILD_LIBJVM_cardTableBarrierSetAssembler_x86.cpp_CXXFLAGS := -Wno-maybe-uninitialized
  38   BUILD_LIBJVM_interp_masm_x86.cpp_CXXFLAGS := -Wno-uninitialized
  39 endif
  40 
  41 LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NONE)
  42 # If the FDLIBM_CFLAGS variable is non-empty we know
  43 # that the fdlibm-fork in hotspot can get optimized
  44 # by using -ffp-contract=off on GCC/Clang platforms.
  45 ifneq ($(FDLIBM_CFLAGS), )
  46   LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NORM)
  47 endif
  48 
  49 ifeq ($(OPENJDK_TARGET_OS), linux)
  50   BUILD_LIBJVM_ostream.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
  51   BUILD_LIBJVM_logFileOutput.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
  52 
  53   BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
  54   BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
  55 
  56   ifeq ($(TOOLCHAIN_TYPE), clang)
  57     JVM_PRECOMPILED_HEADER_EXCLUDE := \
  58         sharedRuntimeTrig.cpp \
  59         sharedRuntimeTrans.cpp \
  60         #
  61   endif
  62 
  63   ifeq ($(OPENJDK_TARGET_CPU), x86)
  64     # Performance measurements show that by compiling GC related code, we could
  65     # significantly reduce the GC pause time on 32 bit Linux/Unix platforms by
  66     # compiling without the PIC flag (-fPIC on linux).
  67     # See 6454213 for more details.
  68     ALL_SRC := $(filter %.cpp, $(call CacheFind, $(TOPDIR)/src/hotspot/share))
  69     NONPIC_FILTER := $(addsuffix %, $(addprefix $(TOPDIR)/src/hotspot/share/, \
  70         memory oops gc))
  71     # Due to what looks like a bug in the old build implementation of this, add a
  72     # couple of more files that were accidentally matched as substrings of GC related
  73     # files.
  74     NONPIC_SRC := $(filter $(NONPIC_FILTER), $(ALL_SRC)) globals.cpp location.cpp
  75     # Declare variables for each source file that needs the pic flag like this:
  76     # BUILD_JVM_<srcfile>_CXXFLAGS := -fno-PIC
  77     # This will get implicitly picked up by SetupNativeCompilation below.
  78     $(foreach s, $(NONPIC_SRC), $(eval BUILD_LIBJVM_$(notdir $s)_CXXFLAGS := -fno-PIC))
  79   endif
  80 
  81 else ifeq ($(OPENJDK_TARGET_OS), solaris)
  82   ifneq ($(DEBUG_LEVEL), slowdebug)
  83     # dev studio 12.6 workaround
  84     BUILD_LIBJVM_arguments.cpp_OPTIMIZATION := LOW
  85     # Workaround for a bug in dtrace.  If ciEnv::post_compiled_method_load_event()
  86     # is inlined, the resulting dtrace object file needs a reference to this
  87     # function, whose symbol name is too long for dtrace.  So disable inlining
  88     # for this method for now. (fix this when dtrace bug 6258412 is fixed)
  89     BUILD_LIBJVM_ciEnv.cpp_CXXFLAGS := \
  90         -xinline=no%__1cFciEnvbFpost_compiled_method_load_event6MpnHnmethod__v_
  91     # dtrace cannot handle tail call optimization (6672627, 6693876)
  92     BUILD_LIBJVM_jni.cpp_CXXFLAGS := -Qoption ube -O~yz
  93     BUILD_LIBJVM_stubGenerator_$(HOTSPOT_TARGET_CPU).cpp_CXXFLAGS := -xspace
  94 
  95     ifeq ($(OPENJDK_TARGET_CPU), x86_64)
  96       # Temporary until SS10 C++ compiler is fixed
  97       BUILD_LIBJVM_generateOptoStub.cpp_CXXFLAGS := -xO2
  98       # Temporary util SS12u1 C++ compiler is fixed
  99       BUILD_LIBJVM_c1_LinearScan.cpp_CXXFLAGS := -xO2
 100     endif
 101   endif
 102 
 103   # Need extra inlining to get oop_ps_push_contents functions to perform well enough.
 104   ifeq ($(DEBUG_LEVEL),release)
 105     BUILD_LIBJVM_psPromotionManager.cpp_CXXFLAGS := -W2,-Ainline:inc=1000
 106   endif
 107 
 108   ifeq ($(DEBUG_LEVEL), fastdebug)
 109     # this hangs in iropt now (7113504)
 110     BUILD_LIBJVM_compileBroker.cpp_CXXFLAGS := -xO2
 111 
 112     # Frame size > 100k  if we allow inlining via -g0!
 113     BUILD_LIBJVM_bytecodeInterpreter.cpp_CXXFLAGS := +d
 114     BUILD_LIBJVM_bytecodeInterpreterWithChecks.cpp_CXXFLAGS := +d
 115 
 116     ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
 117       # ube explodes on x86
 118       BUILD_LIBJVM_bytecodeInterpreter.cpp_CXXFLAGS += -xO1
 119       BUILD_LIBJVM_bytecodeInterpreterWithChecks.cpp_CXXFLAGS += -xO1
 120     endif
 121 
 122   endif
 123 
 124   # Workaround for jvmciCompilerToVM.cpp long compilation time
 125   BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_OPTIMIZATION := NONE
 126 
 127 else ifeq ($(OPENJDK_TARGET_OS), macosx)
 128   # The copied fdlibm routines in these files must not be optimized
 129   BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
 130   BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
 131   ifeq ($(TOOLCHAIN_TYPE), clang)
 132     # NOTE: The old build tested clang version to make sure this workaround
 133     # for the clang bug was still needed.
 134     BUILD_LIBJVM_loopTransform.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
 135     ifneq ($(DEBUG_LEVEL), slowdebug)
 136       BUILD_LIBJVM_unsafe.cpp_CXXFLAGS := -O1
 137     endif
 138 
 139     # The following files are compiled at various optimization
 140     # levels due to optimization issues encountered at the
 141     # default level. The Clang compiler issues a compile
 142     # time error if there is an optimization level specification
 143     # skew between the PCH file and the C++ file.  Especially if the
 144     # PCH file is compiled at a higher optimization level than
 145     # the C++ file.  One solution might be to prepare extra optimization
 146     # level specific PCH files for the opt build and use them here, but
 147     # it's probably not worth the effort as long as only a few files
 148     # need this special handling.
 149     JVM_PRECOMPILED_HEADER_EXCLUDE := \
 150         sharedRuntimeTrig.cpp \
 151         sharedRuntimeTrans.cpp \
 152         loopTransform.cpp \
 153         unsafe.cpp \
 154         jvmciCompilerToVM.cpp \
 155         #
 156   endif
 157 
 158 else ifeq ($(OPENJDK_TARGET_OS), aix)
 159   BUILD_LIBJVM_synchronizer.cpp_CXXFLAGS := -qnoinline
 160   BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
 161   # Disable aggressive optimizations for functions in sharedRuntimeTrig.cpp
 162   # and sharedRuntimeTrans.cpp on ppc64.
 163   # -qstrict turns off the following optimizations:
 164   #   * Performing code motion and scheduling on computations such as loads
 165   #     and floating-point computations that may trigger an exception.
 166   #   * Relaxing conformance to IEEE rules.
 167   #   * Reassociating floating-point expressions.
 168   # When using '-qstrict' there still remains one problem
 169   # in javasoft.sqe.tests.api.java.lang.Math.sin5Tests when run in compile-all
 170   # mode, so don't optimize sharedRuntimeTrig.cpp at all.
 171   BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
 172 
 173   ifneq ($(DEBUG_LEVEL),slowdebug)
 174     # Compiling jvmtiEnterTrace.cpp with full optimization needs more than 30min
 175     # (mostly because of '-qhot=level=1' and the more than 1300 'log_trace' calls
 176     # which cause a lot of template expansion).
 177     BUILD_LIBJVM_jvmtiEnterTrace.cpp_OPTIMIZATION := LOW
 178   endif
 179 
 180   # Disable ELF decoder on AIX (AIX uses XCOFF).
 181   JVM_EXCLUDE_PATTERNS += elf
 182 
 183 else ifeq ($(OPENJDK_TARGET_OS), windows)
 184   JVM_PRECOMPILED_HEADER_EXCLUDE := \
 185       bytecodeInterpreter.cpp \
 186       bytecodeInterpreterWithChecks.cpp \
 187       opcodes.cpp \
 188       os_windows.cpp \
 189       os_windows_x86.cpp \
 190       osThread_windows.cpp \
 191       jvmciCompilerToVMInit.cpp \
 192       #
 193 
 194   # Workaround for jvmciCompilerToVM.cpp long compilation time
 195   BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_OPTIMIZATION := NONE
 196 
 197 endif