hotspot/makefiles/lib/JvmOverrideFiles.gmk
author erikj
Fri, 08 Apr 2016 13:14:23 +0200
changeset 37437 f824aabc7af8
permissions -rw-r--r--
8152666: The new Hotspot Build System Reviewed-by: ihse, dcubed, erikj Contributed-by: magnus.ihse.bursie@oracle.com, erik.joelsson@oracle.com, ingemar.aberg@oracle.com

#
# Copyright (c) 2013, 2016, 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/JvmOverrideFiles.gmk))

################################################################################
# This file contains explicit overrides of CFLAGS and/or precompiled header
# status for individual files on specific platforms.

ifeq ($(TOOLCHAIN_TYPE), gcc)
  BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments -O0
endif

ifeq ($(OPENJDK_TARGET_OS), linux)
  BUILD_LIBJVM_ostream.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64

  ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
    BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE)
    BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE)

    ifeq ($(TOOLCHAIN_TYPE), clang)
      JVM_PRECOMPILED_HEADER_EXCLUDE := \
          sharedRuntimeTrig.cpp \
          sharedRuntimeTrans.cpp \
          #
    endif
  endif

  ifeq ($(OPENJDK_TARGET_CPU), x86)
    # Performance measurements show that by compiling GC related code, we could
    # significantly reduce the GC pause time on 32 bit Linux/Unix platforms by
    # compiling without the PIC flag (-fPIC on linux).
    # See 6454213 for more details.
    ALL_SRC := $(filter %.cpp, $(call CacheFind, $(HOTSPOT_TOPDIR)/src/share/vm))
    NONPIC_FILTER := $(addsuffix %, $(addprefix $(HOTSPOT_TOPDIR)/src/share/vm/, \
        memory oops gc))
    # Due to what looks like a bug in the old build implementation of this, add a
    # couple of more files that were accidentally matched as substrings of GC related
    # files.
    NONPIC_SRC := $(filter $(NONPIC_FILTER), $(ALL_SRC)) globals.cpp location.cpp
    # Declare variables for each source file that needs the pic flag like this:
    # BUILD_JVM_<srcfile>_CXXFLAGS := -fno-PIC
    # This will get implicitly picked up by SetupNativeCompilation below.
    $(foreach s, $(NONPIC_SRC), $(eval BUILD_LIBJVM_$(notdir $s)_CXXFLAGS := -fno-PIC))
  endif

else ifeq ($(OPENJDK_TARGET_OS), solaris)
  ifneq ($(DEBUG_LEVEL), slowdebug)
    # Workaround for a bug in dtrace.  If ciEnv::post_compiled_method_load_event()
    # is inlined, the resulting dtrace object file needs a reference to this
    # function, whose symbol name is too long for dtrace.  So disable inlining
    # for this method for now. (fix this when dtrace bug 6258412 is fixed)
    BUILD_LIBJVM_ciEnv.cpp_CXXFLAGS := \
        -xinline=no%__1cFciEnvbFpost_compiled_method_load_event6MpnHnmethod__v_
    # dtrace cannot handle tail call optimization (6672627, 6693876)
    BUILD_LIBJVM_jni.cpp_CXXFLAGS := -Qoption ube -O~yz
    BUILD_LIBJVM_stubGenerator_$(HOTSPOT_TARGET_CPU).cpp_CXXFLAGS := -xspace

    ifeq ($(OPENJDK_TARGET_CPU), x86_64)
      # Temporary until SS10 C++ compiler is fixed
      BUILD_LIBJVM_generateOptoStub.cpp_CXXFLAGS := -xO2
      # Temporary util SS12u1 C++ compiler is fixed
      BUILD_LIBJVM_c1_LinearScan.cpp_CXXFLAGS := -xO2
    endif
  endif

  # Need extra inlining to get oop_ps_push_contents functions to perform well enough.
  ifeq ($(DEBUG_LEVEL),release)
    BUILD_LIBJVM_psPromotionManager.cpp_CXXFLAGS := -W2,-Ainline:inc=1000
  endif

  ifeq ($(DEBUG_LEVEL), fastdebug)
    # this hangs in iropt now (7113504)
    BUILD_LIBJVM_compileBroker.cpp_CXXFLAGS := -xO2

    # Frame size > 100k  if we allow inlining via -g0!
    BUILD_LIBJVM_bytecodeInterpreter.cpp_CXXFLAGS := +d
    BUILD_LIBJVM_bytecodeInterpreterWithChecks.cpp_CXXFLAGS := +d

    ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
      # ube explodes on x86
      BUILD_LIBJVM_bytecodeInterpreter.cpp_CXXFLAGS += -xO1
      BUILD_LIBJVM_bytecodeInterpreterWithChecks.cpp_CXXFLAGS += -xO1
    endif

  endif

else ifeq ($(OPENJDK_TARGET_OS), macosx)
  # The copied fdlibm routines in these files must not be optimized
  BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
  BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
  ifeq ($(TOOLCHAIN_TYPE), clang)
    # NOTE: The old build tested clang version to make sure this workaround
    # for the clang bug was still needed.
    BUILD_LIBJVM_loopTransform.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
    ifneq ($(DEBUG_LEVEL), slowdebug)
      BUILD_LIBJVM_unsafe.cpp_CXXFLAGS := -O1
    endif

    # The following files are compiled at various optimization
    # levels due to optimization issues encountered at the
    # default level. The Clang compiler issues a compile
    # time error if there is an optimization level specification
    # skew between the PCH file and the C++ file.  Especially if the
    # PCH file is compiled at a higher optimization level than
    # the C++ file.  One solution might be to prepare extra optimization
    # level specific PCH files for the opt build and use them here, but
    # it's probably not worth the effort as long as only a few files
    # need this special handling.
    JVM_PRECOMPILED_HEADER_EXCLUDE := \
        sharedRuntimeTrig.cpp \
        sharedRuntimeTrans.cpp \
        loopTransform.cpp \
        unsafe.cpp \
        jvmciCompilerToVM.cpp \
        #
  endif

else ifeq ($(OPENJDK_TARGET_OS), aix)
  BUILD_LIBJVM_synchronizer.cpp_CXXFLAGS := -qnoinline
  BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
  # Disable aggressive optimizations for functions in sharedRuntimeTrig.cpp
  # and sharedRuntimeTrans.cpp on ppc64.
  # -qstrict turns off the following optimizations:
  #   * Performing code motion and scheduling on computations such as loads
  #     and floating-point computations that may trigger an exception.
  #   * Relaxing conformance to IEEE rules.
  #   * Reassociating floating-point expressions.
  # When using '-qstrict' there still remains one problem
  # in javasoft.sqe.tests.api.java.lang.Math.sin5Tests when run in compile-all
  # mode, so don't optimize sharedRuntimeTrig.cpp at all.
  BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)

  # Disable ELF decoder on AIX (AIX uses XCOFF).
  JVM_EXCLUDE_PATTERNS += elf

else ifeq ($(OPENJDK_TARGET_OS), windows)
  JVM_PRECOMPILED_HEADER_EXCLUDE := \
      bytecodeInterpreter.cpp \
      bytecodeInterpreterWithChecks.cpp \
      opcodes.cpp \
      os_windows.cpp \
      os_windows_x86.cpp \
      osThread_windows.cpp \
      #
endif