提交 b6caf6bd 编写于 作者: C coleenp

Merge

......@@ -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/%
......
......@@ -22,38 +22,71 @@
#
#
# 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
# 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))
#
# 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
......
#
# 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 $@ ...
......
#
# 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
......
......@@ -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)/%)
......
......@@ -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)
......
......@@ -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
......
......@@ -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 $@ ...
......
......@@ -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
......
......@@ -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)/%)
......
......@@ -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.
......
......@@ -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.
......
......@@ -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::
......
......@@ -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, \
......
......@@ -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) |
......
......@@ -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; }
......
/*
* 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) {
}
/*
* 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
......@@ -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);
......
......@@ -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();
};
......
......@@ -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());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册