diff --git a/make/Makefile b/make/Makefile index c07f286e4bc989e179b85a63f60dac2dcb3234d8..fd46aeef087f255309c6d250bfd9a7551025ef71 100644 --- a/make/Makefile +++ b/make/Makefile @@ -73,7 +73,7 @@ else include defs.make endif -include $(GAMMADIR)/make/closed.make +include $(GAMMADIR)/make/altsrc.make ifneq ($(ALT_OUTPUTDIR),) ALT_OUT=ALT_OUTPUTDIR=$(ALT_OUTPUTDIR) @@ -362,7 +362,8 @@ $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/code/% $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/prims/% $(install-file) -$(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h: $(HS_JNI_ARCH_SRC) +HS_JNI_ARCH_SRC=$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(HS_ARCH)/vm/jni_$(HS_ARCH).h) +$(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h: $(HS_JNI_ARCH_SRC) $(install-file) $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/services/% diff --git a/make/altsrc.make b/make/altsrc.make new file mode 100644 index 0000000000000000000000000000000000000000..a86b83268122aa99c9904e05b4bcc6e10fff1bae --- /dev/null +++ b/make/altsrc.make @@ -0,0 +1,92 @@ +# +# Copyright (c) 2011, 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. +# +# 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. +# +# + +# This file defines variables and macros which are used in the makefiles to +# allow distributions to augment or replace common hotspot code with +# distribution-specific source files. + +# Requires: GAMMADIR +# Provides: +# variables: HS_COMMON_SRC, HS_ALT_SRC, HS_COMMON_SRC_REL, and HS_ALT_SRC_REL +# functions: altsrc-equiv, if-has-altsrc, altsrc, altsrc-replace + +HS_COMMON_SRC_REL=src + +# This needs to be changed to a more generic location, but we keep it as this +# for now for compatibility +HS_ALT_SRC_REL=src/closed + +HS_COMMON_SRC=$(GAMMADIR)/$(HS_COMMON_SRC_REL) +HS_ALT_SRC=$(GAMMADIR)/$(HS_ALT_SRC_REL) + + +## altsrc-equiv +# +# Convert a common source path to an alternative source path +# +# Parameter: An absolute path into the common sources +# Result: The matching path to the alternate-source location +# +altsrc-equiv=$(subst $(HS_COMMON_SRC)/,$(HS_ALT_SRC)/,$(1)) + + +## if-has-altsrc +# +# Conditional macro to test for the existence of an alternate source path +# +# Parameter: An absolute path into the common sources +# Parameter: Result if the alternative-source location exists +# Parameter: Result if the alternative-source location does not exist +# Result: expands to parameter 2 or 3 depending on existence of alternate source +# +if-has-altsrc=$(if $(wildcard $(call altsrc-equiv,$(1))),$(2),$(3)) + + +## altsrc +# +# Converts common source path to alternate source path if the alternate +# path exists, otherwise evaluates to nul (empty string) +# +# Parameter: An absolute path into the common sources +# Result: The equivalent path to the alternate-source location, if such a +# location exists on the filesystem. Otherwise it expands to empty. +# +altsrc=$(call if-has-altsrc,$(1),$(call altsrc-equiv,$(1))) + +## commonsrc +# +# Returns parameter. +# +commonsrc=$(1) + + +## altsrc-replace +# +# Converts a common source path to an alternate source path if the alternate +# source path exists. Otherwise it evaluates to the input common source path. +# +# Parameter: An absolute path into the common sources +# Result: A path to either the common or alternate sources +# +altsrc-replace=$(call if-has-altsrc,$(1),$(call altsrc-equiv,$(1)),$(1)) diff --git a/make/closed.make b/make/closed.make deleted file mode 100644 index df4a45af53dc83ac2107f7e0da23200b2da30711..0000000000000000000000000000000000000000 --- a/make/closed.make +++ /dev/null @@ -1,59 +0,0 @@ -# -# Copyright (c) 2011, 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. -# -# 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. -# -# - -# Support for setting HS_CLOSED_PATH, required GAMMADIR and SRCARCH - -CLOSED_DIR_EXISTS := $(shell \ - if [ -d $(GAMMADIR)/src/closed ] ; then \ - echo true; \ - else \ - echo false; \ - fi) - -CLOSED_SRCARCH_DIR_EXISTS := $(shell \ - if [ -d $(GAMMADIR)/src/closed/cpu/$(SRCARCH)/vm ] ; then \ - echo true; \ - else \ - echo false; \ - fi) - -ifeq ($(CLOSED_SRCARCH_DIR_EXISTS), true) - HS_CLOSED_PATH=closed/ -endif - -# Support for setting HS_JNI_ARCH_SRC, requires HS_SRC_DIR and HS_ARCH - -CLOSED_HS_ARCH_DIR_EXISTS := $(shell \ - if [ -d $(HS_SRC_DIR)/closed/cpu/$(HS_ARCH)/vm ] ; then \ - echo true; \ - else \ - echo false; \ - fi) - -ifeq ($(CLOSED_HS_ARCH_DIR_EXISTS), true) - HS_JNI_ARCH_SRC=$(HS_SRC_DIR)/closed/cpu/$(HS_ARCH)/vm/jni_$(HS_ARCH).h -else - HS_JNI_ARCH_SRC=$(HS_SRC_DIR)/cpu/$(HS_ARCH)/vm/jni_$(HS_ARCH).h -endif - diff --git a/make/linux/makefiles/adlc.make b/make/linux/makefiles/adlc.make index 821cfa74ad251387a23b859be4e862e7f4654738..84ff8f88c582ba20417627505f8798ce81315eb0 100644 --- a/make/linux/makefiles/adlc.make +++ b/make/linux/makefiles/adlc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2011, 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 @@ -39,8 +39,9 @@ OS = $(Platform_os_family) SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad -SOURCES.AD = $(GAMMADIR)/src/$(HS_CLOSED_PATH)cpu/$(ARCH)/vm/$(Platform_arch_model).ad \ - $(GAMMADIR)/src/$(HS_CLOSED_PATH)os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad +SOURCES.AD = \ + $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ + $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad) EXEC = $(OUTDIR)/adlc diff --git a/make/linux/makefiles/buildtree.make b/make/linux/makefiles/buildtree.make index 279e210aed46f33eeff529cc944a338edcee5b77..becd97477c9a936237a7f8c4276c27d7dbb535a2 100644 --- a/make/linux/makefiles/buildtree.make +++ b/make/linux/makefiles/buildtree.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, 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 @@ -56,7 +56,7 @@ # having to read the dependency files for the vm. include $(GAMMADIR)/make/scm.make -include $(GAMMADIR)/make/closed.make +include $(GAMMADIR)/make/altsrc.make # 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details. @@ -148,7 +148,7 @@ endif # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro # or make/hotspot_distro. ifndef HOTSPOT_VM_DISTRO - ifeq ($(CLOSED_DIR_EXISTS), true) + ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) include $(GAMMADIR)/make/hotspot_distro else include $(GAMMADIR)/make/openjdk_distro @@ -173,6 +173,11 @@ $(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE $(SIMPLE_DIRS): $(QUIETLY) mkdir -p $@ +# Convenience macro which takes a source relative path, applies $(1) to the +# absolute path, and then replaces $(GAMMADIR) in the result with a +# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile. +gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2))) + flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst @echo Creating $@ ... $(QUIETLY) ( \ @@ -204,16 +209,28 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst echo; \ echo "Src_Dirs_V = \\"; \ sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ - echo "\$$(GAMMADIR)/src/$(HS_CLOSED_PATH)cpu/$(SRCARCH)/vm \\"; \ - echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \ - echo "\$$(GAMMADIR)/src/$(HS_CLOSED_PATH)os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm"; \ + echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ echo; \ echo "Src_Dirs_I = \\"; \ - echo "\$$(GAMMADIR)/src/share/vm \\"; \ - echo "\$$(GAMMADIR)/src/share/vm/prims \\"; \ - echo "\$$(GAMMADIR)/src/$(HS_CLOSED_PATH)cpu/$(SRCARCH)/vm \\"; \ - echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \ - echo "\$$(GAMMADIR)/src/$(HS_CLOSED_PATH)os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm"; \ + echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \ + echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \ + echo "$(call gamma-path,altsrc,share/vm) \\"; \ + echo "$(call gamma-path,commonsrc,share/vm) \\"; \ + echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ [ -n "$(CFLAGS_BROWSE)" ] && \ echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \ [ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \ @@ -237,9 +254,14 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst ../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm @echo Creating directory list $@ - $(QUIETLY) find $(GAMMADIR)/src/share/vm/* -prune \ + $(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \ + find $(HS_ALT_SRC)/share/vm/* -prune \ + -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ + \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \ + fi; + $(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \ -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ - \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@ + \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@ Makefile: $(BUILDTREE_MAKE) @echo Creating $@ ... diff --git a/make/linux/makefiles/rules.make b/make/linux/makefiles/rules.make index 603037efa265382b53b08dc5798f3589ee20f37d..4237597e986f9c29b0b8e3809d51d5013d7c10c6 100644 --- a/make/linux/makefiles/rules.make +++ b/make/linux/makefiles/rules.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2011, 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 @@ -146,7 +146,7 @@ ifndef LP64 include $(GAMMADIR)/make/pic.make endif -include $(GAMMADIR)/make/closed.make +include $(GAMMADIR)/make/altsrc.make # The non-PIC object files are only generated for 32 bit platforms. ifdef LP64 diff --git a/make/linux/makefiles/top.make b/make/linux/makefiles/top.make index 688ba373a43f3eb23fe408f4ae7c009b19d4be07..41c50940d253563a10dad078eb8fab56abc09a5c 100644 --- a/make/linux/makefiles/top.make +++ b/make/linux/makefiles/top.make @@ -39,7 +39,7 @@ # Instead, use "gmake" (or "gnumake") from the command line. --Rose #MAKE = gmake -include $(GAMMADIR)/make/closed.make +include $(GAMMADIR)/make/altsrc.make TOPDIR = $(shell echo `pwd`) GENERATED = $(TOPDIR)/../generated @@ -59,8 +59,8 @@ Cached_plat = $(GENERATED)/platform.current AD_Dir = $(GENERATED)/adfiles ADLC = $(AD_Dir)/adlc -AD_Spec = $(GAMMADIR)/src/$(HS_CLOSED_PATH)cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad -AD_Src = $(GAMMADIR)/src/share/vm/adlc +AD_Spec = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad) +AD_Src = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc) AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp AD_Files = $(AD_Names:%=$(AD_Dir)/%) diff --git a/make/linux/makefiles/vm.make b/make/linux/makefiles/vm.make index c772c6ff59731dc7ded29d38a0601a298b7f776b..d564055c539009385b8d6f91e3b6e474e0597847 100644 --- a/make/linux/makefiles/vm.make +++ b/make/linux/makefiles/vm.make @@ -28,6 +28,7 @@ # Common build rules. MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles include $(MAKEFILES_DIR)/rules.make +include $(GAMMADIR)/make/altsrc.make default: build @@ -119,17 +120,27 @@ JVM = jvm LIBJVM = lib$(JVM).so LIBJVM_G = lib$(JVM)$(G_SUFFIX).so -CORE_PATHS := $(shell find $(GAMMADIR)/src/share/vm/* -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \)) -CORE_PATHS += $(GAMMADIR)/src/os/$(Platform_os_family)/vm -CORE_PATHS += $(GAMMADIR)/src/$(HS_CLOSED_PATH)cpu/$(Platform_arch)/vm -CORE_PATHS += $(GAMMADIR)/src/$(HS_CLOSED_PATH)os_cpu/$(Platform_os_arch)/vm -CORE_PATHS += $(GENERATED)/jvmtifiles +SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt -COMPILER1_PATHS := $(GAMMADIR)/src/share/vm/c1 +SOURCE_PATHS=\ + $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \ + \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \)) +SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm +SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm +SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm +SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm -COMPILER2_PATHS := $(GAMMADIR)/src/share/vm/opto -COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt -COMPILER2_PATHS += $(GENERATED)/adfiles +CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path)) +CORE_PATHS+=$(GENERATED)/jvmtifiles + +COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1) +COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1 + +COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto) +COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt) +COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto +COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt +COMPILER2_PATHS += $(GENERATED)/adfiles # Include dirs per type. Src_Dirs/CORE := $(CORE_PATHS) diff --git a/make/solaris/makefiles/adlc.make b/make/solaris/makefiles/adlc.make index 7fc55b9d39e2c0e172ee94a455e97c4796378052..981e187f7294730499f3dac62dcfdaf548e808aa 100644 --- a/make/solaris/makefiles/adlc.make +++ b/make/solaris/makefiles/adlc.make @@ -27,6 +27,7 @@ # It knows how to compile, link, and run the adlc. include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make +include $(GAMMADIR)/make/altsrc.make # ######################################################################### @@ -39,8 +40,9 @@ OS = $(Platform_os_family) SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad -SOURCES.AD = $(GAMMADIR)/src/cpu/$(ARCH)/vm/$(Platform_arch_model).ad \ - $(GAMMADIR)/src/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad +SOURCES.AD = \ + $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ + $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad) EXEC = $(OUTDIR)/adlc diff --git a/make/solaris/makefiles/buildtree.make b/make/solaris/makefiles/buildtree.make index 08224ef11039ac2e397b94d6e924c1f10b3970f7..8cca8a07ebbc9b8d469cd5514c4bc67ab911c071 100644 --- a/make/solaris/makefiles/buildtree.make +++ b/make/solaris/makefiles/buildtree.make @@ -56,6 +56,7 @@ # having to read the dependency files for the vm. include $(GAMMADIR)/make/scm.make +include $(GAMMADIR)/make/altsrc.make # 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details. QUIETLY$(MAKE_VERBOSE) = @ @@ -139,13 +140,7 @@ endif # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro # or make/hotspot_distro. ifndef HOTSPOT_VM_DISTRO - CLOSED_DIR_EXISTS := $(shell \ - if [ -d $(GAMMADIR)/src/closed ] ; then \ - echo true; \ - else \ - echo false; \ - fi) - ifeq ($(CLOSED_DIR_EXISTS), true) + ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) include $(GAMMADIR)/make/hotspot_distro else include $(GAMMADIR)/make/openjdk_distro @@ -170,6 +165,11 @@ $(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE $(SIMPLE_DIRS): $(QUIETLY) mkdir -p $@ +# Convenience macro which takes a source relative path, applies $(1) to the +# absolute path, and then replaces $(GAMMADIR) in the result with a +# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile. +gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2))) + flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst @echo Creating $@ ... $(QUIETLY) ( \ @@ -202,16 +202,28 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst echo; \ echo "Src_Dirs_V = \\"; \ sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ - echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \ - echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \ - echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \ + echo "$(call gamma-path,altsrc,cpu/$(ARCH)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,cpu/$(ARCH)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ echo; \ echo "Src_Dirs_I = \\"; \ - echo "\$$(GAMMADIR)/src/share/vm \\"; \ - echo "\$$(GAMMADIR)/src/share/vm/prims \\"; \ - echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \ - echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \ - echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \ + echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \ + echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \ + echo "$(call gamma-path,altsrc,share/vm) \\"; \ + echo "$(call gamma-path,commonsrc,share/vm) \\"; \ + echo "$(call gamma-path,altsrc,cpu/$(ARCH)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,cpu/$(ARCH)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ + echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ + echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ [ -n "$(CFLAGS_BROWSE)" ] && \ echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \ [ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \ @@ -235,9 +247,14 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst ../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm @echo Creating directory list $@ - $(QUIETLY) find $(GAMMADIR)/src/share/vm/* -prune \ + $(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \ + find $(HS_ALT_SRC)/share/vm/* -prune \ + -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ + \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \ + fi; + $(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \ -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ - \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@ + \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@ Makefile: $(BUILDTREE_MAKE) @echo Creating $@ ... diff --git a/make/solaris/makefiles/rules.make b/make/solaris/makefiles/rules.make index baafe9c4fd0743552f4faaacf72e6d16de666571..4f2cc8608050c445f4e7c462f8f573445dd430e3 100644 --- a/make/solaris/makefiles/rules.make +++ b/make/solaris/makefiles/rules.make @@ -146,6 +146,8 @@ ifndef LP64 include $(GAMMADIR)/make/pic.make endif +include $(GAMMADIR)/make/altsrc.make + # Sun compiler for 64 bit Solaris does not support building non-PIC object files. ifdef LP64 %.o: %.cpp diff --git a/make/solaris/makefiles/top.make b/make/solaris/makefiles/top.make index b0505e77aae357947a635773844027136364a900..893e9c00cabfdabb7ba20f1fb6d4f197a4d62853 100644 --- a/make/solaris/makefiles/top.make +++ b/make/solaris/makefiles/top.make @@ -39,6 +39,8 @@ # Instead, use "gmake" (or "gnumake") from the command line. --Rose #MAKE = gmake +include $(GAMMADIR)/make/altsrc.make + GENERATED = ../generated VM = $(GAMMADIR)/src/share/vm Plat_File = $(Platform_file) @@ -48,8 +50,8 @@ Cached_plat = $(GENERATED)/platform.current AD_Dir = $(GENERATED)/adfiles ADLC = $(AD_Dir)/adlc -AD_Spec = $(GAMMADIR)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad -AD_Src = $(GAMMADIR)/src/share/vm/adlc +AD_Spec = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad) +AD_Src = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc) AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp AD_Files = $(AD_Names:%=$(AD_Dir)/%) diff --git a/make/solaris/makefiles/vm.make b/make/solaris/makefiles/vm.make index 9728b1dc43c8b16143ca76af458980eb9dd130f9..5ad02c00c539b50945b9a9ffdc26a9e7651b48fb 100644 --- a/make/solaris/makefiles/vm.make +++ b/make/solaris/makefiles/vm.make @@ -28,6 +28,7 @@ # Common build rules. MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles include $(MAKEFILES_DIR)/rules.make +include $(GAMMADIR)/make/altsrc.make default: build @@ -139,16 +140,26 @@ JVM = jvm LIBJVM = lib$(JVM).so LIBJVM_G = lib$(JVM)$(G_SUFFIX).so -CORE_PATHS := $(shell find $(GAMMADIR)/src/share/vm/* -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \)) -CORE_PATHS += $(GAMMADIR)/src/os/$(Platform_os_family)/vm -CORE_PATHS += $(GAMMADIR)/src/cpu/$(Platform_arch)/vm -CORE_PATHS += $(GAMMADIR)/src/os_cpu/$(Platform_os_arch)/vm -CORE_PATHS += $(GENERATED)/jvmtifiles +SPECIAL_PATHS:=adlc c1 dist gc_implementation opto shark libadt -COMPILER1_PATHS := $(GAMMADIR)/src/share/vm/c1 +SOURCE_PATHS=\ + $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \ + \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \)) +SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm +SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm +SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm +SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm -COMPILER2_PATHS := $(GAMMADIR)/src/share/vm/opto -COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt +CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path)) +CORE_PATHS+=$(GENERATED)/jvmtifiles + +COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1) +COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1 + +COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto) +COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt) +COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto +COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt COMPILER2_PATHS += $(GENERATED)/adfiles # Include dirs per type. diff --git a/make/windows/create_obj_files.sh b/make/windows/create_obj_files.sh index 52ae0bb785c1bc09b2ffa88cfb7a1b59e75e012c..0c8276962e643bc866d962d1246f8bdbafc5630e 100644 --- a/make/windows/create_obj_files.sh +++ b/make/windows/create_obj_files.sh @@ -51,21 +51,48 @@ Platform_os_arch=windows_$Platform_arch WorkSpace=$4 GENERATED=$5 -BASE_PATHS="` $FIND ${WorkSpace}/src/share/vm ! -name vm -prune -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \)`" -BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/share/vm/gc_implementation/shared" -BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/os/${Platform_os_family}/vm" -BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/cpu/${Platform_arch}/vm" -BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/os_cpu/${Platform_os_arch}/vm" +COMMONSRC_REL=src +ALTSRC_REL=src/closed # Change this to pick up alt sources from somewhere else + +COMMONSRC=${WorkSpace}/${COMMONSRC_REL} +ALTSRC=${WorkSpace}/${ALTSRC_REL} + +BASE_PATHS="`if [ -d ${ALTSRC}/share/vm ]; then $FIND ${ALTSRC}/share/vm ! -name vm -prune -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \); fi`" +BASE_PATHS="${BASE_PATHS} ` $FIND ${COMMONSRC}/share/vm ! -name vm -prune -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \)`" + +for sd in \ + share/vm/gc_implementation/shared \ + os/${Platform_os_family}/vm \ + cpu/${Platform_arch}/vm \ + os_cpu/${Platform_os_arch}/vm; do + if [ -d "${ALTSRC}/${sd}" ]; then + BASE_PATHS="${BASE_PATHS} ${ALTSRC}/${sd}" + fi + BASE_PATHS="${BASE_PATHS} ${COMMONSRC}/${sd}" +done + BASE_PATHS="${BASE_PATHS} ${GENERATED}/jvmtifiles" CORE_PATHS="${BASE_PATHS}" # shared is already in BASE_PATHS. Should add vm/memory but that one is also in BASE_PATHS. -CORE_PATHS="${CORE_PATHS} `$FIND ${WorkSpace}/src/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" +if [ -d "${ALTSRC}/share/vm/gc_implementation" ]; then + CORE_PATHS="${CORE_PATHS} `$FIND ${ALTSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" +fi +CORE_PATHS="${CORE_PATHS} `$FIND ${COMMONSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" -COMPILER1_PATHS="${WorkSpace}/src/share/vm/c1" +if [ -d "${ALTSRC}/share/vm/c1" ]; then + COMPILER1_PATHS="${ALTSRC}/share/vm/c1" +fi +COMPILER1_PATHS="${COMPILER1_PATHS} ${COMMONSRC}/share/vm/c1" -COMPILER2_PATHS="${WorkSpace}/src/share/vm/opto" -COMPILER2_PATHS="${COMPILER2_PATHS} ${WorkSpace}/src/share/vm/libadt" +if [ -d "${ALTSRC}/share/vm/opto" ]; then + COMPILER2_PATHS="${ALTSRC}/share/vm/opto" +fi +COMPILER2_PATHS="${COMPILER2_PATHS} ${COMMONSRC}/share/vm/opto" +if [ -d "${ALTSRC}/share/vm/libadt" ]; then + COMPILER2_PATHS="${COMPILER2_PATHS} ${ALTSRC}/share/vm/libadt" +fi +COMPILER2_PATHS="${COMPILER2_PATHS} ${COMMONSRC}/share/vm/libadt" COMPILER2_PATHS="${COMPILER2_PATHS} ${GENERATED}/adfiles" # Include dirs per type. diff --git a/make/windows/makefiles/vm.make b/make/windows/makefiles/vm.make index 69ff1a7e780037f9269962d19144b5698f631455..4bcdd4a3bbea25ab75f7d1fdeb8d132572e76110 100644 --- a/make/windows/makefiles/vm.make +++ b/make/windows/makefiles/vm.make @@ -27,6 +27,9 @@ Res_Files=.\version.res !include ..\generated\objfiles.make +COMMONSRC=$(WorkSpace)\src +ALTSRC=$(WorkSpace)\src\closed + !ifdef RELEASE !ifdef DEVELOP CPP_FLAGS=$(CPP_FLAGS) /D "DEBUG" @@ -111,13 +114,30 @@ LINK_FLAGS=$(LINK_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \ /export:JVM_GetThreadStateValues \ /export:JVM_InitAgentProperties -CPP_INCLUDE_DIRS=\ - /I "..\generated" \ - /I "$(WorkSpace)\src\share\vm" \ - /I "$(WorkSpace)\src\share\vm\prims" \ - /I "$(WorkSpace)\src\os\windows\vm" \ - /I "$(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm" \ - /I "$(WorkSpace)\src\cpu\$(Platform_arch)\vm" +CPP_INCLUDE_DIRS=/I "..\generated" + +!if exists($(ALTSRC)\share\vm) +CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\share\vm" +!endif + +!if exists($(ALTSRC)\os\windows\vm) +CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\os\windows\vm" +!endif + +!if exists($(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm) +CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm" +!endif + +!if exists($(ALTSRC)\cpu\$(Platform_arch)\vm) +CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\cpu\$(Platform_arch)\vm" +!endif + +CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) \ + /I "$(COMMONSRC)\share\vm" \ + /I "$(COMMONSRC)\share\vm\prims" \ + /I "$(COMMONSRC)\os\windows\vm" \ + /I "$(COMMONSRC)\os_cpu\windows_$(Platform_arch)\vm" \ + /I "$(COMMONSRC)\cpu\$(Platform_arch)\vm" CPP_DONT_USE_PCH=/D DONT_USE_PRECOMPILED_HEADER @@ -127,7 +147,7 @@ CPP_USE_PCH=/Fp"vm.pch" /Yu"precompiled.hpp" CPP_USE_PCH=$(CPP_DONT_USE_PCH) !endif -# Where to find the source code for the virtual machine +# Where to find the source code for the virtual machine (is this used?) VM_PATH=../generated VM_PATH=$(VM_PATH);../generated/adfiles VM_PATH=$(VM_PATH);../generated/jvmtifiles @@ -188,81 +208,157 @@ bytecodeInterpreterWithChecks.obj: ..\generated\jvmtifiles\bytecodeInterpreterWi $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp # Default rules for the Virtual Machine -{$(WorkSpace)\src\share\vm\c1}.cpp.obj:: +{$(COMMONSRC)\share\vm\c1}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\compiler}.cpp.obj:: +{$(COMMONSRC)\share\vm\compiler}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\code}.cpp.obj:: +{$(COMMONSRC)\share\vm\code}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\interpreter}.cpp.obj:: +{$(COMMONSRC)\share\vm\interpreter}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\ci}.cpp.obj:: +{$(COMMONSRC)\share\vm\ci}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\classfile}.cpp.obj:: +{$(COMMONSRC)\share\vm\classfile}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\gc_implementation\parallelScavenge}.cpp.obj:: +{$(COMMONSRC)\share\vm\gc_implementation\parallelScavenge}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\gc_implementation\shared}.cpp.obj:: +{$(COMMONSRC)\share\vm\gc_implementation\shared}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\gc_implementation\parNew}.cpp.obj:: +{$(COMMONSRC)\share\vm\gc_implementation\parNew}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\gc_implementation\concurrentMarkSweep}.cpp.obj:: +{$(COMMONSRC)\share\vm\gc_implementation\concurrentMarkSweep}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\gc_implementation\g1}.cpp.obj:: +{$(COMMONSRC)\share\vm\gc_implementation\g1}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\gc_interface}.cpp.obj:: +{$(COMMONSRC)\share\vm\gc_interface}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\asm}.cpp.obj:: +{$(COMMONSRC)\share\vm\asm}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\memory}.cpp.obj:: +{$(COMMONSRC)\share\vm\memory}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\oops}.cpp.obj:: +{$(COMMONSRC)\share\vm\oops}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\prims}.cpp.obj:: +{$(COMMONSRC)\share\vm\prims}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\runtime}.cpp.obj:: +{$(COMMONSRC)\share\vm\runtime}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\services}.cpp.obj:: +{$(COMMONSRC)\share\vm\services}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\utilities}.cpp.obj:: +{$(COMMONSRC)\share\vm\utilities}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\libadt}.cpp.obj:: +{$(COMMONSRC)\share\vm\libadt}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\share\vm\opto}.cpp.obj:: +{$(COMMONSRC)\share\vm\opto}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\os\windows\vm}.cpp.obj:: +{$(COMMONSRC)\os\windows\vm}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< # This guy should remain a single colon rule because # otherwise we can't specify the output filename. -{$(WorkSpace)\src\os\windows\vm}.rc.res: +{$(COMMONSRC)\os\windows\vm}.rc.res: + @$(RC) $(RC_FLAGS) /fo"$@" $< + +{$(COMMONSRC)\cpu\$(Platform_arch)\vm}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(COMMONSRC)\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\c1}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\compiler}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\code}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\interpreter}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\ci}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\classfile}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\gc_implementation\parallelScavenge}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\gc_implementation\shared}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\gc_implementation\parNew}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\gc_implementation\concurrentMarkSweep}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\gc_implementation\g1}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\gc_interface}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\asm}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\memory}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\oops}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\prims}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\runtime}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\services}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\utilities}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\libadt}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\share\vm\opto}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +{$(ALTSRC)\os\windows\vm}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + +# otherwise we can't specify the output filename. +{$(ALTSRC)\os\windows\vm}.rc.res: @$(RC) $(RC_FLAGS) /fo"$@" $< -{$(WorkSpace)\src\cpu\$(Platform_arch)\vm}.cpp.obj:: +{$(ALTSRC)\cpu\$(Platform_arch)\vm}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< -{$(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj:: +{$(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< {..\generated\incls}.cpp.obj:: diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp index 4a83a4195373e48a36f292a63562800f18195306..95a522b2c296a8f39254181242e36c74446d6ad3 100644 --- a/src/share/vm/runtime/globals.hpp +++ b/src/share/vm/runtime/globals.hpp @@ -3655,6 +3655,12 @@ class CommandLineFlags { manageable(bool, PrintConcurrentLocks, false, \ "Print java.util.concurrent locks in thread dump") \ \ + diagnostic(bool, TransmitErrorReport, false, \ + "Enable error report transmission on erroneous termination") \ + \ + diagnostic(ccstr, ErrorReportServer, NULL, \ + "Override built-in error report server address") \ + \ /* Shared spaces */ \ \ product(bool, UseSharedSpaces, true, \ diff --git a/src/share/vm/runtime/vm_version.cpp b/src/share/vm/runtime/vm_version.cpp index 11db0c39ab3baf804e4b928463d8728d875664fd..4afc8cea3b9c328ea9b511eb77efadb91225d271 100644 --- a/src/share/vm/runtime/vm_version.cpp +++ b/src/share/vm/runtime/vm_version.cpp @@ -245,6 +245,10 @@ const char* Abstract_VM_Version::internal_vm_info_string() { " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER; } +const char *Abstract_VM_Version::vm_build_user() { + return HOTSPOT_BUILD_USER; +} + unsigned int Abstract_VM_Version::jvm_version() { return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) | ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) | diff --git a/src/share/vm/runtime/vm_version.hpp b/src/share/vm/runtime/vm_version.hpp index 6c2dfb7acfda8486300d504de33ae66cb7d71e04..28b243f41bafd9b0e50f537e1873aea744ec1907 100644 --- a/src/share/vm/runtime/vm_version.hpp +++ b/src/share/vm/runtime/vm_version.hpp @@ -59,6 +59,7 @@ class Abstract_VM_Version: AllStatic { static const char* vm_info_string(); static const char* vm_release(); static const char* vm_platform_string(); + static const char* vm_build_user(); static int vm_major_version() { assert(_initialized, "not initialized"); return _vm_major_version; } static int vm_minor_version() { assert(_initialized, "not initialized"); return _vm_minor_version; } diff --git a/src/share/vm/utilities/errorReporter.cpp b/src/share/vm/utilities/errorReporter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9d10453948db3b4eaba44054088cdcd82c9f8be5 --- /dev/null +++ b/src/share/vm/utilities/errorReporter.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2011, 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. + * + * 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. + * + */ + +#include "precompiled.hpp" +#include "utilities/errorReporter.hpp" + +ErrorReporter::ErrorReporter() {} + +void ErrorReporter::call(FILE* fd, char* buffer, int length) { +} + diff --git a/src/share/vm/utilities/errorReporter.hpp b/src/share/vm/utilities/errorReporter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e7fae5fba22814f42b85f54a23ced72e1d6f16bb --- /dev/null +++ b/src/share/vm/utilities/errorReporter.hpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2011, 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. + * + * 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. + * + */ + +#ifndef SHARE_VM_UTILITIES_ERRORREPORTER_HPP +#define SHARE_VM_UTILITIES_ERRORREPORTER_HPP + +#include "utilities/globalDefinitions.hpp" + +class ErrorReporter : public StackObj { + +public: + ErrorReporter(); + ~ErrorReporter(){}; + + void call(FILE* fd, char *buffer, int length); +}; + +#endif // ndef SHARE_VM_UTILITIES_ERRORREPORTER_HPP diff --git a/src/share/vm/utilities/ostream.cpp b/src/share/vm/utilities/ostream.cpp index acad5fda1e4572f777e0d6ff25671d02de61c754..897dba137accf73d8f8802685abbf880944e39f6 100644 --- a/src/share/vm/utilities/ostream.cpp +++ b/src/share/vm/utilities/ostream.cpp @@ -314,6 +314,11 @@ fileStream::fileStream(const char* file_name) { _need_close = true; } +fileStream::fileStream(const char* file_name, const char* opentype) { + _file = fopen(file_name, opentype); + _need_close = true; +} + void fileStream::write(const char* s, size_t len) { if (_file != NULL) { // Make an unused local variable to avoid warning from gcc 4.x compiler. @@ -322,6 +327,25 @@ void fileStream::write(const char* s, size_t len) { update_position(s, len); } +long fileStream::fileSize() { + long size = -1; + if (_file != NULL) { + long pos = ::ftell(_file); + if (::fseek(_file, 0, SEEK_END) == 0) { + size = ::ftell(_file); + } + ::fseek(_file, pos, SEEK_SET); + } + return size; +} + +char* fileStream::readln(char *data, int count ) { + char * ret = ::fgets(data, count, _file); + //Get rid of annoying \n char + data[::strlen(data)-1] = '\0'; + return ret; +} + fileStream::~fileStream() { if (_file != NULL) { if (_need_close) fclose(_file); diff --git a/src/share/vm/utilities/ostream.hpp b/src/share/vm/utilities/ostream.hpp index fd86a8da9e7ce6761cb3655f143e69eac729edf8..1776a5b98e788da7be071e097e9ac8cea2a9c598 100644 --- a/src/share/vm/utilities/ostream.hpp +++ b/src/share/vm/utilities/ostream.hpp @@ -159,10 +159,17 @@ class fileStream : public outputStream { bool _need_close; public: fileStream(const char* file_name); + fileStream(const char* file_name, const char* opentype); fileStream(FILE* file) { _file = file; _need_close = false; } ~fileStream(); bool is_open() const { return _file != NULL; } + void set_need_close(bool b) { _need_close = b;} virtual void write(const char* c, size_t len); + size_t read(void *data, size_t size, size_t count) { return ::fread(data, size, count, _file); } + char* readln(char *data, int count); + int eof() { return feof(_file); } + long fileSize(); + void rewind() { ::rewind(_file); } void flush(); }; diff --git a/src/share/vm/utilities/vmError.cpp b/src/share/vm/utilities/vmError.cpp index 662e5a7c91a80c14a5c8c7a3b4cd95bd00b08d14..af05eed8a60551cfd45fb9781d5493642e67c9ba 100644 --- a/src/share/vm/utilities/vmError.cpp +++ b/src/share/vm/utilities/vmError.cpp @@ -35,6 +35,7 @@ #include "utilities/debug.hpp" #include "utilities/decoder.hpp" #include "utilities/defaultStream.hpp" +#include "utilities/errorReporter.hpp" #include "utilities/top.hpp" #include "utilities/vmError.hpp" @@ -769,6 +770,7 @@ void VMError::report_and_die() { // then save detailed information in log file (verbose = true). static bool out_done = false; // done printing to standard out static bool log_done = false; // done saving error log + static bool transmit_report_done = false; // done error reporting static fdStream log; // error log if (SuppressFatalErrorMessage) { @@ -859,7 +861,7 @@ void VMError::report_and_die() { bool copy_ok = Arguments::copy_expand_pid(ErrorFile, strlen(ErrorFile), buffer, sizeof(buffer)); if (copy_ok) { - fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, 0666); + fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); } } @@ -870,7 +872,7 @@ void VMError::report_and_die() { // so use the default name in the current directory jio_snprintf(&buffer[len], sizeof(buffer)-len, "%shs_err_pid%u.log", os::file_separator(), os::current_process_id()); - fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, 0666); + fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); } if (fd == -1) { @@ -879,7 +881,7 @@ void VMError::report_and_die() { if (tmpdir != NULL && tmpdir[0] != '\0') { jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log", tmpdir, os::file_separator(), os::current_process_id()); - fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, 0666); + fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); } } @@ -892,6 +894,9 @@ void VMError::report_and_die() { } else { out.print_raw_cr("# Can not save log file, dump to screen.."); log.set_fd(defaultStream::output_fd()); + /* Error reporting currently needs dumpfile. + * Maybe implement direct streaming in the future.*/ + transmit_report_done = true; } } @@ -900,6 +905,16 @@ void VMError::report_and_die() { first_error->_current_step = 0; // reset current_step first_error->_current_step_info = ""; // reset current_step string + // Run error reporting to determine whether or not to report the crash. + if (!transmit_report_done && should_report_bug(first_error->_id)) { + transmit_report_done = true; + FILE* hs_err = ::fdopen(log.fd(), "r"); + if (NULL != hs_err) { + ErrorReporter er; + er.call(hs_err, buffer, O_BUFLEN); + } + } + if (log.fd() != defaultStream::output_fd()) { close(log.fd()); }