This commit is contained in:
Robert Ottenhag 2011-02-11 05:40:41 -08:00
commit 3447053144
31 changed files with 764 additions and 200 deletions

View File

@ -73,7 +73,7 @@ else
include defs.make include defs.make
endif endif
include $(GAMMADIR)/make/closed.make include $(GAMMADIR)/make/altsrc.make
ifneq ($(ALT_OUTPUTDIR),) ifneq ($(ALT_OUTPUTDIR),)
ALT_OUT=ALT_OUTPUTDIR=$(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/% $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/prims/%
$(install-file) $(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) $(install-file)
$(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/services/% $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/services/%

92
hotspot/make/altsrc.make Normal file
View File

@ -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))

View File

@ -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

View File

@ -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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # 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 SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad
SOURCES.AD = $(GAMMADIR)/src/$(HS_CLOSED_PATH)cpu/$(ARCH)/vm/$(Platform_arch_model).ad \ SOURCES.AD = \
$(GAMMADIR)/src/$(HS_CLOSED_PATH)os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).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 EXEC = $(OUTDIR)/adlc

View File

@ -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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # 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. # having to read the dependency files for the vm.
include $(GAMMADIR)/make/scm.make 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. # '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 # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
# or make/hotspot_distro. # or make/hotspot_distro.
ifndef HOTSPOT_VM_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 include $(GAMMADIR)/make/hotspot_distro
else else
include $(GAMMADIR)/make/openjdk_distro include $(GAMMADIR)/make/openjdk_distro
@ -173,6 +173,11 @@ $(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE
$(SIMPLE_DIRS): $(SIMPLE_DIRS):
$(QUIETLY) mkdir -p $@ $(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 flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
@echo Creating $@ ... @echo Creating $@ ...
$(QUIETLY) ( \ $(QUIETLY) ( \
@ -204,16 +209,28 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
echo; \ echo; \
echo "Src_Dirs_V = \\"; \ echo "Src_Dirs_V = \\"; \
sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \
echo "\$$(GAMMADIR)/src/$(HS_CLOSED_PATH)cpu/$(SRCARCH)/vm \\"; \ echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \ echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
echo "\$$(GAMMADIR)/src/$(HS_CLOSED_PATH)os_cpu/$(OS_FAMILY)_$(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; \
echo "Src_Dirs_I = \\"; \ echo "Src_Dirs_I = \\"; \
echo "\$$(GAMMADIR)/src/share/vm \\"; \ echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \
echo "\$$(GAMMADIR)/src/share/vm/prims \\"; \ echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \
echo "\$$(GAMMADIR)/src/$(HS_CLOSED_PATH)cpu/$(SRCARCH)/vm \\"; \ echo "$(call gamma-path,altsrc,share/vm) \\"; \
echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \ echo "$(call gamma-path,commonsrc,share/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)"; \
[ -n "$(CFLAGS_BROWSE)" ] && \ [ -n "$(CFLAGS_BROWSE)" ] && \
echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \ echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
[ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \ [ -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 ../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
@echo Creating directory list $@ @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 {} \ -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) Makefile: $(BUILDTREE_MAKE)
@echo Creating $@ ... @echo Creating $@ ...

View File

@ -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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -146,7 +146,7 @@ ifndef LP64
include $(GAMMADIR)/make/pic.make include $(GAMMADIR)/make/pic.make
endif endif
include $(GAMMADIR)/make/closed.make include $(GAMMADIR)/make/altsrc.make
# The non-PIC object files are only generated for 32 bit platforms. # The non-PIC object files are only generated for 32 bit platforms.
ifdef LP64 ifdef LP64

View File

@ -39,7 +39,7 @@
# Instead, use "gmake" (or "gnumake") from the command line. --Rose # Instead, use "gmake" (or "gnumake") from the command line. --Rose
#MAKE = gmake #MAKE = gmake
include $(GAMMADIR)/make/closed.make include $(GAMMADIR)/make/altsrc.make
TOPDIR = $(shell echo `pwd`) TOPDIR = $(shell echo `pwd`)
GENERATED = $(TOPDIR)/../generated GENERATED = $(TOPDIR)/../generated
@ -59,8 +59,8 @@ Cached_plat = $(GENERATED)/platform.current
AD_Dir = $(GENERATED)/adfiles AD_Dir = $(GENERATED)/adfiles
ADLC = $(AD_Dir)/adlc ADLC = $(AD_Dir)/adlc
AD_Spec = $(GAMMADIR)/src/$(HS_CLOSED_PATH)cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad AD_Spec = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad)
AD_Src = $(GAMMADIR)/src/share/vm/adlc AD_Src = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc)
AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp
AD_Files = $(AD_Names:%=$(AD_Dir)/%) AD_Files = $(AD_Names:%=$(AD_Dir)/%)

View File

@ -28,6 +28,7 @@
# Common build rules. # Common build rules.
MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
include $(MAKEFILES_DIR)/rules.make include $(MAKEFILES_DIR)/rules.make
include $(GAMMADIR)/make/altsrc.make
default: build default: build
@ -119,17 +120,27 @@ JVM = jvm
LIBJVM = lib$(JVM).so LIBJVM = lib$(JVM).so
LIBJVM_G = lib$(JVM)$(G_SUFFIX).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 \)) SPECIAL_PATHS:=adlc c1 gc_implementation opto shark 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
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 CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt CORE_PATHS+=$(GENERATED)/jvmtifiles
COMPILER2_PATHS += $(GENERATED)/adfiles
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. # Include dirs per type.
Src_Dirs/CORE := $(CORE_PATHS) Src_Dirs/CORE := $(CORE_PATHS)

View File

@ -27,6 +27,7 @@
# It knows how to compile, link, and run the adlc. # It knows how to compile, link, and run the adlc.
include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make 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 SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad
SOURCES.AD = $(GAMMADIR)/src/cpu/$(ARCH)/vm/$(Platform_arch_model).ad \ SOURCES.AD = \
$(GAMMADIR)/src/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).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 EXEC = $(OUTDIR)/adlc

View File

@ -56,6 +56,7 @@
# having to read the dependency files for the vm. # having to read the dependency files for the vm.
include $(GAMMADIR)/make/scm.make include $(GAMMADIR)/make/scm.make
include $(GAMMADIR)/make/altsrc.make
# 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details. # 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details.
QUIETLY$(MAKE_VERBOSE) = @ QUIETLY$(MAKE_VERBOSE) = @
@ -139,13 +140,7 @@ endif
# Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
# or make/hotspot_distro. # or make/hotspot_distro.
ifndef HOTSPOT_VM_DISTRO ifndef HOTSPOT_VM_DISTRO
CLOSED_DIR_EXISTS := $(shell \ ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
if [ -d $(GAMMADIR)/src/closed ] ; then \
echo true; \
else \
echo false; \
fi)
ifeq ($(CLOSED_DIR_EXISTS), true)
include $(GAMMADIR)/make/hotspot_distro include $(GAMMADIR)/make/hotspot_distro
else else
include $(GAMMADIR)/make/openjdk_distro include $(GAMMADIR)/make/openjdk_distro
@ -170,6 +165,11 @@ $(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE
$(SIMPLE_DIRS): $(SIMPLE_DIRS):
$(QUIETLY) mkdir -p $@ $(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 flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
@echo Creating $@ ... @echo Creating $@ ...
$(QUIETLY) ( \ $(QUIETLY) ( \
@ -202,16 +202,28 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
echo; \ echo; \
echo "Src_Dirs_V = \\"; \ echo "Src_Dirs_V = \\"; \
sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \
echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \ echo "$(call gamma-path,altsrc,cpu/$(ARCH)/vm) \\"; \
echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \ echo "$(call gamma-path,commonsrc,cpu/$(ARCH)/vm) \\"; \
echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(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; \
echo "Src_Dirs_I = \\"; \ echo "Src_Dirs_I = \\"; \
echo "\$$(GAMMADIR)/src/share/vm \\"; \ echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \
echo "\$$(GAMMADIR)/src/share/vm/prims \\"; \ echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \
echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \ echo "$(call gamma-path,altsrc,share/vm) \\"; \
echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \ echo "$(call gamma-path,commonsrc,share/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)"; \
[ -n "$(CFLAGS_BROWSE)" ] && \ [ -n "$(CFLAGS_BROWSE)" ] && \
echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \ echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
[ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \ [ -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 ../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
@echo Creating directory list $@ @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 {} \ -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) Makefile: $(BUILDTREE_MAKE)
@echo Creating $@ ... @echo Creating $@ ...

View File

@ -146,6 +146,8 @@ ifndef LP64
include $(GAMMADIR)/make/pic.make include $(GAMMADIR)/make/pic.make
endif endif
include $(GAMMADIR)/make/altsrc.make
# Sun compiler for 64 bit Solaris does not support building non-PIC object files. # Sun compiler for 64 bit Solaris does not support building non-PIC object files.
ifdef LP64 ifdef LP64
%.o: %.cpp %.o: %.cpp

View File

@ -39,6 +39,8 @@
# Instead, use "gmake" (or "gnumake") from the command line. --Rose # Instead, use "gmake" (or "gnumake") from the command line. --Rose
#MAKE = gmake #MAKE = gmake
include $(GAMMADIR)/make/altsrc.make
GENERATED = ../generated GENERATED = ../generated
VM = $(GAMMADIR)/src/share/vm VM = $(GAMMADIR)/src/share/vm
Plat_File = $(Platform_file) Plat_File = $(Platform_file)
@ -48,8 +50,8 @@ Cached_plat = $(GENERATED)/platform.current
AD_Dir = $(GENERATED)/adfiles AD_Dir = $(GENERATED)/adfiles
ADLC = $(AD_Dir)/adlc ADLC = $(AD_Dir)/adlc
AD_Spec = $(GAMMADIR)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad AD_Spec = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad)
AD_Src = $(GAMMADIR)/src/share/vm/adlc AD_Src = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc)
AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp
AD_Files = $(AD_Names:%=$(AD_Dir)/%) AD_Files = $(AD_Names:%=$(AD_Dir)/%)

View File

@ -28,6 +28,7 @@
# Common build rules. # Common build rules.
MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
include $(MAKEFILES_DIR)/rules.make include $(MAKEFILES_DIR)/rules.make
include $(GAMMADIR)/make/altsrc.make
default: build default: build
@ -139,16 +140,26 @@ JVM = jvm
LIBJVM = lib$(JVM).so LIBJVM = lib$(JVM).so
LIBJVM_G = lib$(JVM)$(G_SUFFIX).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 \)) SPECIAL_PATHS:=adlc c1 dist gc_implementation opto shark 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
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 CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt 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 COMPILER2_PATHS += $(GENERATED)/adfiles
# Include dirs per type. # Include dirs per type.

View File

@ -51,21 +51,48 @@ Platform_os_arch=windows_$Platform_arch
WorkSpace=$4 WorkSpace=$4
GENERATED=$5 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 \)`" COMMONSRC_REL=src
BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/share/vm/gc_implementation/shared" ALTSRC_REL=src/closed # Change this to pick up alt sources from somewhere else
BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/os/${Platform_os_family}/vm"
BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/cpu/${Platform_arch}/vm" COMMONSRC=${WorkSpace}/${COMMONSRC_REL}
BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/os_cpu/${Platform_os_arch}/vm" 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" BASE_PATHS="${BASE_PATHS} ${GENERATED}/jvmtifiles"
CORE_PATHS="${BASE_PATHS}" CORE_PATHS="${BASE_PATHS}"
# shared is already in BASE_PATHS. Should add vm/memory but that one is also in 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" if [ -d "${ALTSRC}/share/vm/opto" ]; then
COMPILER2_PATHS="${COMPILER2_PATHS} ${WorkSpace}/src/share/vm/libadt" 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" COMPILER2_PATHS="${COMPILER2_PATHS} ${GENERATED}/adfiles"
# Include dirs per type. # Include dirs per type.

View File

@ -27,6 +27,9 @@ Res_Files=.\version.res
!include ..\generated\objfiles.make !include ..\generated\objfiles.make
COMMONSRC=$(WorkSpace)\src
ALTSRC=$(WorkSpace)\src\closed
!ifdef RELEASE !ifdef RELEASE
!ifdef DEVELOP !ifdef DEVELOP
CPP_FLAGS=$(CPP_FLAGS) /D "DEBUG" 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_GetThreadStateValues \
/export:JVM_InitAgentProperties /export:JVM_InitAgentProperties
CPP_INCLUDE_DIRS=\ CPP_INCLUDE_DIRS=/I "..\generated"
/I "..\generated" \
/I "$(WorkSpace)\src\share\vm" \ !if exists($(ALTSRC)\share\vm)
/I "$(WorkSpace)\src\share\vm\prims" \ CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\share\vm"
/I "$(WorkSpace)\src\os\windows\vm" \ !endif
/I "$(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm" \
/I "$(WorkSpace)\src\cpu\$(Platform_arch)\vm" !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 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) CPP_USE_PCH=$(CPP_DONT_USE_PCH)
!endif !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=../generated
VM_PATH=$(VM_PATH);../generated/adfiles VM_PATH=$(VM_PATH);../generated/adfiles
VM_PATH=$(VM_PATH);../generated/jvmtifiles 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 $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp
# Default rules for the Virtual Machine # 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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(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 $< $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
# This guy should remain a single colon rule because # This guy should remain a single colon rule because
# otherwise we can't specify the output filename. # 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"$@" $< @$(RC) $(RC_FLAGS) /fo"$@" $<
{$(WorkSpace)\src\cpu\$(Platform_arch)\vm}.cpp.obj:: {$(COMMONSRC)\cpu\$(Platform_arch)\vm}.cpp.obj::
$(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
{$(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj:: {$(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"$@" $<
{$(ALTSRC)\cpu\$(Platform_arch)\vm}.cpp.obj::
$(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
{$(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj::
$(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
{..\generated\incls}.cpp.obj:: {..\generated\incls}.cpp.obj::

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -131,6 +131,7 @@
#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
#define SEC_IN_NANOSECS 1000000000LL #define SEC_IN_NANOSECS 1000000000LL
#define LARGEPAGES_BIT (1 << 6)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// global variables // global variables
julong os::Linux::_physical_memory = 0; julong os::Linux::_physical_memory = 0;
@ -2817,6 +2818,43 @@ bool os::unguard_memory(char* addr, size_t size) {
return linux_mprotect(addr, size, PROT_READ|PROT_WRITE); return linux_mprotect(addr, size, PROT_READ|PROT_WRITE);
} }
/*
* Set the coredump_filter bits to include largepages in core dump (bit 6)
*
* From the coredump_filter documentation:
*
* - (bit 0) anonymous private memory
* - (bit 1) anonymous shared memory
* - (bit 2) file-backed private memory
* - (bit 3) file-backed shared memory
* - (bit 4) ELF header pages in file-backed private memory areas (it is
* effective only if the bit 2 is cleared)
* - (bit 5) hugetlb private memory
* - (bit 6) hugetlb shared memory
*/
static void set_coredump_filter(void) {
FILE *f;
long cdm;
if ((f = fopen("/proc/self/coredump_filter", "r+")) == NULL) {
return;
}
if (fscanf(f, "%lx", &cdm) != 1) {
fclose(f);
return;
}
rewind(f);
if ((cdm & LARGEPAGES_BIT) == 0) {
cdm |= LARGEPAGES_BIT;
fprintf(f, "%#lx", cdm);
}
fclose(f);
}
// Large page support // Large page support
static size_t _large_page_size = 0; static size_t _large_page_size = 0;
@ -2874,6 +2912,8 @@ bool os::large_page_init() {
_page_sizes[2] = 0; _page_sizes[2] = 0;
} }
set_coredump_filter();
// Large page support is available on 2.6 or newer kernel, some vendors // Large page support is available on 2.6 or newer kernel, some vendors
// (e.g. Redhat) have backported it to their 2.4 based distributions. // (e.g. Redhat) have backported it to their 2.4 based distributions.
// We optimistically assume the support is available. If later it turns out // We optimistically assume the support is available. If later it turns out

View File

@ -0,0 +1,61 @@
/*
* 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
* 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 "prims/jvm.h"
#include "runtime/os.hpp"
#include "utilities/vmError.hpp"
#include <unistd.h>
#include <sys/resource.h>
// Check core dump limit and report possible place where core can be found
void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
struct rlimit rlim;
static char cwd[O_BUFLEN];
bool success;
get_current_directory(cwd, sizeof(cwd));
if (getrlimit(RLIMIT_CORE, &rlim) != 0) {
jio_snprintf(buffer, bufferSize, "%s/core or core.%d (may not exist)", cwd, current_process_id());
success = true;
} else {
switch(rlim.rlim_cur) {
case RLIM_INFINITY:
jio_snprintf(buffer, bufferSize, "%s/core or core.%d", cwd, current_process_id());
success = true;
break;
case 0:
jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again");
success = false;
break;
default:
jio_snprintf(buffer, bufferSize, "%s/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", cwd, current_process_id(), (unsigned long)(rlim.rlim_cur >> 10));
success = true;
break;
}
}
VMError::report_coredump_status(buffer, success);
}

View File

@ -1,5 +1,5 @@
/* /*
* CopyrighT (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -915,6 +915,85 @@ void os::shutdown() {
} }
} }
static BOOL (WINAPI *_MiniDumpWriteDump) ( HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION,
PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION);
void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
HINSTANCE dbghelp;
EXCEPTION_POINTERS ep;
MINIDUMP_EXCEPTION_INFORMATION mei;
HANDLE hProcess = GetCurrentProcess();
DWORD processId = GetCurrentProcessId();
HANDLE dumpFile;
MINIDUMP_TYPE dumpType;
static const char* cwd;
// If running on a client version of Windows and user has not explicitly enabled dumping
if (!os::win32::is_windows_server() && !CreateMinidumpOnCrash) {
VMError::report_coredump_status("Minidumps are not enabled by default on client versions of Windows", false);
return;
// If running on a server version of Windows and user has explictly disabled dumping
} else if (os::win32::is_windows_server() && !FLAG_IS_DEFAULT(CreateMinidumpOnCrash) && !CreateMinidumpOnCrash) {
VMError::report_coredump_status("Minidump has been disabled from the command line", false);
return;
}
dbghelp = LoadLibrary("DBGHELP.DLL");
if (dbghelp == NULL) {
VMError::report_coredump_status("Failed to load dbghelp.dll", false);
return;
}
_MiniDumpWriteDump = CAST_TO_FN_PTR(
BOOL(WINAPI *)( HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION,
PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION),
GetProcAddress(dbghelp, "MiniDumpWriteDump"));
if (_MiniDumpWriteDump == NULL) {
VMError::report_coredump_status("Failed to find MiniDumpWriteDump() in module dbghelp.dll", false);
return;
}
dumpType = (MINIDUMP_TYPE)(MiniDumpWithFullMemory | MiniDumpWithHandleData);
// Older versions of dbghelp.h doesn't contain all the dumptypes we want, dbghelp.h with
// API_VERSION_NUMBER 11 or higher contains the ones we want though
#if API_VERSION_NUMBER >= 11
dumpType = (MINIDUMP_TYPE)(dumpType | MiniDumpWithFullMemoryInfo | MiniDumpWithThreadInfo |
MiniDumpWithUnloadedModules);
#endif
cwd = get_current_directory(NULL, 0);
jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp",cwd, current_process_id());
dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (dumpFile == INVALID_HANDLE_VALUE) {
VMError::report_coredump_status("Failed to create file for dumping", false);
return;
}
ep.ContextRecord = (PCONTEXT) contextRecord;
ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord;
mei.ThreadId = GetCurrentThreadId();
mei.ExceptionPointers = &ep;
// Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all
// the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then.
if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, &mei, NULL, NULL) == false &&
_MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, &mei, NULL, NULL) == false) {
VMError::report_coredump_status("Call to MiniDumpWriteDump() failed", false);
} else {
VMError::report_coredump_status(buffer, true);
}
CloseHandle(dumpFile);
}
void os::abort(bool dump_core) void os::abort(bool dump_core)
{ {
os::shutdown(); os::shutdown();
@ -3274,7 +3353,7 @@ volatile intx os::win32::_os_thread_count = 0;
bool os::win32::_is_nt = false; bool os::win32::_is_nt = false;
bool os::win32::_is_windows_2003 = false; bool os::win32::_is_windows_2003 = false;
bool os::win32::_is_windows_server = false;
void os::win32::initialize_system_info() { void os::win32::initialize_system_info() {
SYSTEM_INFO si; SYSTEM_INFO si;
@ -3293,9 +3372,9 @@ void os::win32::initialize_system_info() {
GlobalMemoryStatusEx(&ms); GlobalMemoryStatusEx(&ms);
_physical_memory = ms.ullTotalPhys; _physical_memory = ms.ullTotalPhys;
OSVERSIONINFO oi; OSVERSIONINFOEX oi;
oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx(&oi); GetVersionEx((OSVERSIONINFO*)&oi);
switch(oi.dwPlatformId) { switch(oi.dwPlatformId) {
case VER_PLATFORM_WIN32_WINDOWS: _is_nt = false; break; case VER_PLATFORM_WIN32_WINDOWS: _is_nt = false; break;
case VER_PLATFORM_WIN32_NT: case VER_PLATFORM_WIN32_NT:
@ -3305,6 +3384,10 @@ void os::win32::initialize_system_info() {
if (os_vers == 5002) { if (os_vers == 5002) {
_is_windows_2003 = true; _is_windows_2003 = true;
} }
if (oi.wProductType == VER_NT_DOMAIN_CONTROLLER ||
oi.wProductType == VER_NT_SERVER) {
_is_windows_server = true;
}
} }
break; break;
default: fatal("Unknown platform"); default: fatal("Unknown platform");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -38,6 +38,7 @@ class win32 {
static size_t _default_stack_size; static size_t _default_stack_size;
static bool _is_nt; static bool _is_nt;
static bool _is_windows_2003; static bool _is_windows_2003;
static bool _is_windows_server;
public: public:
// Windows-specific interface: // Windows-specific interface:
@ -64,6 +65,9 @@ class win32 {
// Tells whether the platform is NT or Windown95 // Tells whether the platform is NT or Windown95
static bool is_nt() { return _is_nt; } static bool is_nt() { return _is_nt; }
// Tells whether this is a server version of Windows
static bool is_windows_server() { return _is_windows_server; }
// Tells whether the platform is Windows 2003 // Tells whether the platform is Windows 2003
static bool is_windows_2003() { return _is_windows_2003; } static bool is_windows_2003() { return _is_windows_2003; }

View File

@ -108,7 +108,6 @@
template(java_lang_AssertionStatusDirectives, "java/lang/AssertionStatusDirectives") \ template(java_lang_AssertionStatusDirectives, "java/lang/AssertionStatusDirectives") \
template(sun_jkernel_DownloadManager, "sun/jkernel/DownloadManager") \ template(sun_jkernel_DownloadManager, "sun/jkernel/DownloadManager") \
template(getBootClassPathEntryForClass_name, "getBootClassPathEntryForClass") \ template(getBootClassPathEntryForClass_name, "getBootClassPathEntryForClass") \
template(setBootClassLoaderHook_name, "setBootClassLoaderHook") \
template(sun_misc_PostVMInitHook, "sun/misc/PostVMInitHook") \ template(sun_misc_PostVMInitHook, "sun/misc/PostVMInitHook") \
\ \
/* class file format tags */ \ /* class file format tags */ \

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -790,6 +790,9 @@ class CommandLineFlags {
product(bool, ShowMessageBoxOnError, false, \ product(bool, ShowMessageBoxOnError, false, \
"Keep process alive on VM fatal error") \ "Keep process alive on VM fatal error") \
\ \
product(bool, CreateMinidumpOnCrash, false, \
"Create minidump on VM fatal error") \
\
product_pd(bool, UseOSErrorReporting, \ product_pd(bool, UseOSErrorReporting, \
"Let VM fatal error propagate to the OS (ie. WER on Windows)") \ "Let VM fatal error propagate to the OS (ie. WER on Windows)") \
\ \
@ -3655,6 +3658,12 @@ class CommandLineFlags {
manageable(bool, PrintConcurrentLocks, false, \ manageable(bool, PrintConcurrentLocks, false, \
"Print java.util.concurrent locks in thread dump") \ "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 */ \ /* Shared spaces */ \
\ \
product(bool, UseSharedSpaces, true, \ product(bool, UseSharedSpaces, true, \

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -614,6 +614,9 @@ class os: AllStatic {
// Structured OS Exception support // Structured OS Exception support
static void os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread); static void os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread);
// On Windows this will create an actual minidump, on Linux/Solaris it will simply check core dump limits
static void check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize);
// JVMTI & JVM monitoring and management support // JVMTI & JVM monitoring and management support
// The thread_cpu_time() and current_thread_cpu_time() are only // The thread_cpu_time() and current_thread_cpu_time() are only
// supported if is_thread_cpu_time_supported() returns true. // supported if is_thread_cpu_time_supported() returns true.

View File

@ -962,22 +962,6 @@ static void call_initializeSystemClass(TRAPS) {
vmSymbols::void_method_signature(), CHECK); vmSymbols::void_method_signature(), CHECK);
} }
#ifdef KERNEL
static void set_jkernel_boot_classloader_hook(TRAPS) {
klassOop k = SystemDictionary::sun_jkernel_DownloadManager_klass();
instanceKlassHandle klass (THREAD, k);
if (k == NULL) {
// sun.jkernel.DownloadManager may not present in the JDK; just return
return;
}
JavaValue result(T_VOID);
JavaCalls::call_static(&result, klass, vmSymbols::setBootClassLoaderHook_name(),
vmSymbols::void_method_signature(), CHECK);
}
#endif // KERNEL
// General purpose hook into Java code, run once when the VM is initialized. // General purpose hook into Java code, run once when the VM is initialized.
// The Java library method itself may be changed independently from the VM. // The Java library method itself may be changed independently from the VM.
static void call_postVMInitHook(TRAPS) { static void call_postVMInitHook(TRAPS) {
@ -1611,7 +1595,15 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
uncaught_exception, // Arg 2 uncaught_exception, // Arg 2
THREAD); THREAD);
} }
CLEAR_PENDING_EXCEPTION; if (HAS_PENDING_EXCEPTION) {
ResourceMark rm(this);
jio_fprintf(defaultStream::error_stream(),
"\nException: %s thrown from the UncaughtExceptionHandler"
" in thread \"%s\"\n",
Klass::cast(pending_exception()->klass())->external_name(),
get_thread_name());
CLEAR_PENDING_EXCEPTION;
}
} }
} }
@ -3284,12 +3276,6 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
} }
#ifdef KERNEL
if (JDK_Version::is_gte_jdk17x_version()) {
set_jkernel_boot_classloader_hook(THREAD);
}
#endif // KERNEL
#ifndef SERIALGC #ifndef SERIALGC
// Support for ConcurrentMarkSweep. This should be cleaned up // Support for ConcurrentMarkSweep. This should be cleaned up
// and better encapsulated. The ugly nested if test would go away // and better encapsulated. The ugly nested if test would go away

View File

@ -245,6 +245,10 @@ const char* Abstract_VM_Version::internal_vm_info_string() {
" by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER; " 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() { unsigned int Abstract_VM_Version::jvm_version() {
return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) | return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) | ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |

View File

@ -59,6 +59,7 @@ class Abstract_VM_Version: AllStatic {
static const char* vm_info_string(); static const char* vm_info_string();
static const char* vm_release(); static const char* vm_release();
static const char* vm_platform_string(); 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_major_version() { assert(_initialized, "not initialized"); return _vm_major_version; }
static int vm_minor_version() { assert(_initialized, "not initialized"); return _vm_minor_version; } static int vm_minor_version() { assert(_initialized, "not initialized"); return _vm_minor_version; }

View File

@ -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) {
}

View File

@ -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

View File

@ -314,6 +314,11 @@ fileStream::fileStream(const char* file_name) {
_need_close = true; _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) { void fileStream::write(const char* s, size_t len) {
if (_file != NULL) { if (_file != NULL) {
// Make an unused local variable to avoid warning from gcc 4.x compiler. // 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); 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() { fileStream::~fileStream() {
if (_file != NULL) { if (_file != NULL) {
if (_need_close) fclose(_file); if (_need_close) fclose(_file);

View File

@ -159,10 +159,17 @@ class fileStream : public outputStream {
bool _need_close; bool _need_close;
public: public:
fileStream(const char* file_name); fileStream(const char* file_name);
fileStream(const char* file_name, const char* opentype);
fileStream(FILE* file) { _file = file; _need_close = false; } fileStream(FILE* file) { _file = file; _need_close = false; }
~fileStream(); ~fileStream();
bool is_open() const { return _file != NULL; } 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); 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(); void flush();
}; };

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/decoder.hpp" #include "utilities/decoder.hpp"
#include "utilities/defaultStream.hpp" #include "utilities/defaultStream.hpp"
#include "utilities/errorReporter.hpp"
#include "utilities/top.hpp" #include "utilities/top.hpp"
#include "utilities/vmError.hpp" #include "utilities/vmError.hpp"
@ -200,6 +201,15 @@ static void print_bug_submit_message(outputStream *out, Thread *thread) {
out->print_raw_cr("#"); out->print_raw_cr("#");
} }
bool VMError::coredump_status;
char VMError::coredump_message[O_BUFLEN];
void VMError::report_coredump_status(const char* message, bool status) {
coredump_status = status;
strncpy(coredump_message, message, sizeof(coredump_message));
coredump_message[sizeof(coredump_message)-1] = 0;
}
// Return a string to describe the error // Return a string to describe the error
char* VMError::error_string(char* buf, int buflen) { char* VMError::error_string(char* buf, int buflen) {
@ -453,6 +463,15 @@ void VMError::report(outputStream* st) {
st->cr(); st->cr();
st->print_cr("#"); st->print_cr("#");
} }
STEP(63, "(printing core file information)")
st->print("# ");
if (coredump_status) {
st->print("Core dump written. Default location: %s", coredump_message);
} else {
st->print("Failed to write core dump. %s", coredump_message);
}
st->print_cr("");
st->print_cr("#");
STEP(65, "(printing bug submit message)") STEP(65, "(printing bug submit message)")
@ -769,6 +788,7 @@ void VMError::report_and_die() {
// then save detailed information in log file (verbose = true). // then save detailed information in log file (verbose = true).
static bool out_done = false; // done printing to standard out static bool out_done = false; // done printing to standard out
static bool log_done = false; // done saving error log static bool log_done = false; // done saving error log
static bool transmit_report_done = false; // done error reporting
static fdStream log; // error log static fdStream log; // error log
if (SuppressFatalErrorMessage) { if (SuppressFatalErrorMessage) {
@ -790,6 +810,9 @@ void VMError::report_and_die() {
ShowMessageBoxOnError = false; ShowMessageBoxOnError = false;
} }
// Write a minidump on Windows, check core dump limits on Linux/Solaris
os::check_or_create_dump(_siginfo, _context, buffer, sizeof(buffer));
// reset signal handlers or exception filter; make sure recursive crashes // reset signal handlers or exception filter; make sure recursive crashes
// are handled properly. // are handled properly.
reset_signal_handlers(); reset_signal_handlers();
@ -859,7 +882,7 @@ void VMError::report_and_die() {
bool copy_ok = bool copy_ok =
Arguments::copy_expand_pid(ErrorFile, strlen(ErrorFile), buffer, sizeof(buffer)); Arguments::copy_expand_pid(ErrorFile, strlen(ErrorFile), buffer, sizeof(buffer));
if (copy_ok) { 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 +893,7 @@ void VMError::report_and_die() {
// so use the default name in the current directory // so use the default name in the current directory
jio_snprintf(&buffer[len], sizeof(buffer)-len, "%shs_err_pid%u.log", jio_snprintf(&buffer[len], sizeof(buffer)-len, "%shs_err_pid%u.log",
os::file_separator(), os::current_process_id()); 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) { if (fd == -1) {
@ -879,7 +902,7 @@ void VMError::report_and_die() {
if (tmpdir != NULL && tmpdir[0] != '\0') { if (tmpdir != NULL && tmpdir[0] != '\0') {
jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log", jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log",
tmpdir, os::file_separator(), os::current_process_id()); 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 +915,9 @@ void VMError::report_and_die() {
} else { } else {
out.print_raw_cr("# Can not save log file, dump to screen.."); out.print_raw_cr("# Can not save log file, dump to screen..");
log.set_fd(defaultStream::output_fd()); log.set_fd(defaultStream::output_fd());
/* Error reporting currently needs dumpfile.
* Maybe implement direct streaming in the future.*/
transmit_report_done = true;
} }
} }
@ -900,6 +926,16 @@ void VMError::report_and_die() {
first_error->_current_step = 0; // reset current_step first_error->_current_step = 0; // reset current_step
first_error->_current_step_info = ""; // reset current_step string 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()) { if (log.fd() != defaultStream::output_fd()) {
close(log.fd()); close(log.fd());
} }

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -67,6 +67,14 @@ class VMError : public StackObj {
static VMError* volatile first_error; static VMError* volatile first_error;
static volatile jlong first_error_tid; static volatile jlong first_error_tid;
// Core dump status, false if we have been unable to write a core/minidump for some reason
static bool coredump_status;
// When coredump_status is set to true this will contain the name/path to the core/minidump,
// if coredump_status if false, this will (hopefully) contain a useful error explaining why
// no core/minidump has been written to disk
static char coredump_message[O_BUFLEN];
// used by reporting about OOM // used by reporting about OOM
size_t _size; size_t _size;
@ -106,6 +114,9 @@ public:
// return a string to describe the error // return a string to describe the error
char *error_string(char* buf, int buflen); char *error_string(char* buf, int buflen);
// Report status of core/minidump
static void report_coredump_status(const char* message, bool status);
// main error reporting function // main error reporting function
void report_and_die(); void report_and_die();