This commit is contained in:
Albert Noll 2014-12-12 08:40:19 -08:00
commit 7613da167b
1975 changed files with 109660 additions and 18698 deletions

View File

@ -282,3 +282,6 @@ a137992d750c72f6f944f341aa19b0d0d96afe0c jdk9-b35
b409bc51bc23cfd51f2bd04ea919ec83535af9d0 jdk9-b37
948cceef81ba4cb34bc233e7cc5952951ff04e88 jdk9-b38
4e7c4d692e934cb9023af8201e7c2b510e9c4ee1 jdk9-b39
82f4cb44b2d7af2352f48568a64b7b6a5ae960cd jdk9-b40
9fffb959eb4197ff806e4ac12244761815b4deee jdk9-b41
3107be2ba9c6e208a0b86bc7100a141abbc5b5fb jdk9-b42

View File

@ -282,3 +282,6 @@ c173ba994245380fb11ef077d1e59823386840eb jdk9-b35
723a67b0c442391447b1d8aad8b249d06d1032e8 jdk9-b37
d42c0a90afc3c66ca87543076ec9aafd4b4680de jdk9-b38
512dbbeb1730edcebfec873fc3f1455660b32000 jdk9-b39
cf136458ee747e151a27aa9ea0c1492ea55ef3e7 jdk9-b40
67395f7ca2db3b52e3a62a84888487de5cb9210a jdk9-b41
f7c11da0b0481d49cc7a65a453336c108191e821 jdk9-b42

View File

@ -33,7 +33,7 @@ default:
# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
# /usr/ccs/bin/make lacks basically every other flow control mechanism.
TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
.TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
# Assume we have GNU make, but check version.
ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
@ -46,7 +46,17 @@ ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
else
makefile_path:=$(lastword $(MAKEFILE_LIST))
endif
root_dir:=$(dir $(makefile_path))
root_dir:=$(patsubst %/,%,$(dir $(makefile_path)))
ifneq ($(findstring qp,$(MAKEFLAGS)),)
# When called with -qp, assume an external part (e.g. bash completion) is trying
# to understand our targets.
# Duplication of global targets, needed before ParseConfAndSpec in case we have
# no configurations.
help:
# If CONF is not set, look for all available configurations
CONF?=
endif
# ... and then we can include our helper functions
include $(root_dir)/make/MakeHelpers.gmk
@ -89,6 +99,7 @@ else
# The wrapper target was called so we now have a single configuration. Load the spec file
# and call the real Main.gmk.
include $(SPEC)
include $(SRC_ROOT)/make/common/MakeBase.gmk
### Clean up from previous run
# Remove any build.log from a previous run, if they exist
@ -143,31 +154,37 @@ help:
$(info . make [default] # Compile all modules in langtools, hotspot, jaxp, jaxws,)
$(info . # corba and jdk and create a runnable "exploded" image)
$(info . make all # Compile everything, all repos, docs and images)
$(info . make images # Create complete j2sdk and j2re images)
$(info . make images # Create complete jdk and jre images)
$(info . make <phase> # Compile the specified phase and everything it depends on)
$(info . # (gensrc, java, copy, libs, launchers, gendata, rmic))
$(info . make *-only # Applies to most targets and disables compling the)
$(info . # dependencies for the target. This is faster but may)
$(info . # result in incorrect build results!)
$(info . make docs # Create all docs)
$(info . make docs-javadoc # Create just javadocs, depends on less than full docs)
$(info . make profiles # Create complete j2re compact profile images)
$(info . make profiles # Create complete jre compact profile images)
$(info . make bootcycle-images # Build images twice, second time with newly built JDK)
$(info . make install # Install the generated images locally)
$(info . make reconfigure # Rerun configure with the same arguments as last time)
$(info . make clean # Remove all files generated by make, but not those)
$(info . # generated by configure)
$(info . make dist-clean # Remove all files, including configuration)
$(info . make help # Give some help on using make)
$(info . make test # Run tests, default is all tests (see TEST below))
$(info )
$(info Targets for cleaning)
$(info . make clean # Remove all files generated by make, but not those)
$(info . # generated by configure)
$(info . make dist-clean # Remove all files, including configuration)
$(info . make clean-<outputdir> # Remove the subdir in the output dir with the name)
$(info . make clean-<phase> # Remove all build results related to a certain build)
$(info . # phase (gensrc, java, libs, launchers))
$(info . make clean-<module> # Remove all build results related to a certain module)
$(info . make clean-<module>-<phase> # Remove all build results related to a certain)
$(info . # module and phase)
$(info )
$(info Targets for specific modules)
$(info . make <module> # Build <module> and everything it depends on. )
$(info . make <module>-only # Build <module> only, without dependencies. This)
$(info . # is faster but can result in incorrect build results!)
$(info . make <module>-java # Compile java classes for <module> and everything it)
$(info . # depends on)
$(info . make <module>-libs # Build native libraries for <module> and everything it)
$(info . # depends on)
$(info . make <module>-launchers# Build native executables for <module> and everything it)
$(info . # depends on)
$(info . make <module>-gensrc # Execute the gensrc step for <module> and everything it)
$(info . # depends on)
$(info . make <module>-<phase> # Compile the specified phase for the specified module)
$(info . # and everything it depends on)
$(info . # (gensrc, java, copy, libs, launchers, gendata, rmic))
$(info )
$(info Useful make variables)
$(info . make CONF= # Build all configurations (note, assignment is empty))

View File

@ -69,7 +69,7 @@ AC_DEFUN([BASIC_PREPEND_TO_PATH],
# This will make sure the given variable points to a full and proper
# path. This means:
# 1) There will be no spaces in the path. On posix platforms,
# 1) There will be no spaces in the path. On unix platforms,
# spaces in the path will result in an error. On Windows,
# the path will be rewritten using short-style to be space-free.
# 2) The path will be absolute, and it will be in unix-style (on
@ -82,7 +82,7 @@ AC_DEFUN([BASIC_FIXUP_PATH],
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
BASIC_FIXUP_PATH_MSYS($1)
else
# We're on a posix platform. Hooray! :)
# We're on a unix platform. Hooray! :)
path="[$]$1"
has_space=`$ECHO "$path" | $GREP " "`
if test "x$has_space" != x; then
@ -102,7 +102,7 @@ AC_DEFUN([BASIC_FIXUP_PATH],
# This will make sure the given variable points to a executable
# with a full and proper path. This means:
# 1) There will be no spaces in the path. On posix platforms,
# 1) There will be no spaces in the path. On unix platforms,
# spaces in the path will result in an error. On Windows,
# the path will be rewritten using short-style to be space-free.
# 2) The path will be absolute, and it will be in unix-style (on
@ -118,7 +118,7 @@ AC_DEFUN([BASIC_FIXUP_EXECUTABLE],
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
BASIC_FIXUP_EXECUTABLE_MSYS($1)
else
# We're on a posix platform. Hooray! :)
# We're on a unix platform. Hooray! :)
# First separate the path from the arguments. This will split at the first
# space.
complete="[$]$1"
@ -268,7 +268,7 @@ AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN],
fi
])
# Setup a tool for the given variable. If correctly specified by the user,
# Setup a tool for the given variable. If correctly specified by the user,
# use that value, otherwise search for the tool using the supplied code snippet.
# $1: variable to set
# $2: code snippet to call to look for the tool
@ -546,7 +546,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
XCODEBUILD=
AC_SUBST(XCODEBUILD)
fi
AC_MSG_CHECKING([for sdk name])
AC_ARG_WITH([sdk-name], [AS_HELP_STRING([--with-sdk-name],
[use the platform SDK of the given name. @<:@macosx@:>@])],

View File

@ -24,31 +24,31 @@
#
########################################################################
# This file handles detection of the Boot JDK. The Boot JDK detection
# process has been developed as a response to solve a complex real-world
# problem. Initially, it was simple, but it has grown as platform after
# This file handles detection of the Boot JDK. The Boot JDK detection
# process has been developed as a response to solve a complex real-world
# problem. Initially, it was simple, but it has grown as platform after
# platform, idiosyncracy after idiosyncracy has been supported.
#
# The basic idea is this:
# 1) You need an acceptable *) JDK to use as a Boot JDK
# 2) There are several ways to locate a JDK, that are mostly platform
# 2) There are several ways to locate a JDK, that are mostly platform
# dependent **)
# 3) You can have multiple JDKs installed
# 4) If possible, configure should try to dig out an acceptable JDK
# 4) If possible, configure should try to dig out an acceptable JDK
# automatically, without having to resort to command-line options
#
# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with
# javac) and not a JRE, etc.
# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with
# javac) and not a JRE, etc.
#
# **) On Windows we typically use a well-known path.
# **) On Windows we typically use a well-known path.
# On MacOSX we typically use the tool java_home.
# On Linux we typically find javac in the $PATH, and then follow a
# chain of symlinks that often ends up in a real JDK.
# On Linux we typically find javac in the $PATH, and then follow a
# chain of symlinks that often ends up in a real JDK.
#
# This leads to the code where we check in different ways to locate a
# JDK, and if one is found, check if it is acceptable. If not, we print
# our reasons for rejecting it (useful when debugging non-working
# configure situations) and continue checking the next one.
# This leads to the code where we check in different ways to locate a
# JDK, and if one is found, check if it is acceptable. If not, we print
# our reasons for rejecting it (useful when debugging non-working
# configure situations) and continue checking the next one.
########################################################################
# Execute the check given as argument, and verify the result
@ -73,31 +73,25 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
AC_MSG_NOTICE([(This might be an JRE instead of an JDK)])
BOOT_JDK_FOUND=no
else
# Do we have an rt.jar? (On MacOSX it is called classes.jar)
if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring])
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
[FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`]
if test "x$FOUND_CORRECT_VERSION" = x; then
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)])
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
[FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`]
if test "x$FOUND_CORRECT_VERSION" = x; then
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)])
BOOT_JDK_FOUND=no
else
# We're done! :-)
BOOT_JDK_FOUND=yes
BASIC_FIXUP_PATH(BOOT_JDK)
AC_MSG_CHECKING([for Boot JDK])
AC_MSG_RESULT([$BOOT_JDK])
AC_MSG_CHECKING([Boot JDK version])
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
AC_MSG_RESULT([$BOOT_JDK_VERSION])
fi # end check jdk version
fi # end check rt.jar
# We're done! :-)
BOOT_JDK_FOUND=yes
BASIC_FIXUP_PATH(BOOT_JDK)
AC_MSG_CHECKING([for Boot JDK])
AC_MSG_RESULT([$BOOT_JDK])
AC_MSG_CHECKING([Boot JDK version])
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
AC_MSG_RESULT([$BOOT_JDK_VERSION])
fi # end check jdk version
fi # end check javac
fi # end check java
fi # end check boot jdk found
@ -244,7 +238,7 @@ AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS],
AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK],
[
# Use user overridden value if available, otherwise locate tool in the Boot JDK.
BASIC_SETUP_TOOL($1,
BASIC_SETUP_TOOL($1,
[
AC_MSG_CHECKING([for $2 in Boot JDK])
$1=$BOOT_JDK/bin/$2
@ -305,20 +299,6 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
AC_MSG_ERROR([Cannot continue])
fi
# Setup proper paths for what we found
BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
if test ! -f "$BOOT_RTJAR"; then
# On MacOSX it is called classes.jar
BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
if test -f "$BOOT_RTJAR"; then
# Remove the ..
BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
fi
fi
BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
BOOT_JDK="$BOOT_JDK"
AC_SUBST(BOOT_RTJAR)
AC_SUBST(BOOT_TOOLSJAR)
AC_SUBST(BOOT_JDK)
# Setup tools from the Boot JDK.

View File

@ -42,13 +42,12 @@ endif
# Override specific values to do a boot cycle build
# Use a different Boot JDK
BOOT_JDK := $(JDK_IMAGE_DIR)
# The bootcycle build has a different output directory
BUILD_OUTPUT:=@BUILD_OUTPUT@/bootcycle-build
# Use a different Boot JDK
OLD_BOOT_JDK:=$(BOOT_JDK)
BOOT_JDK:=@BUILD_OUTPUT@/images/j2sdk-image
BOOT_RTJAR:=$(BOOT_JDK)/jre/lib/rt.jar
SJAVAC_SERVER_DIR:=$(subst @BUILD_OUTPUT@,$(BUILD_OUTPUT),$(SJAVAC_SERVER_DIR))
JAVA_CMD:=$(BOOT_JDK)/bin/java
JAVAC_CMD:=$(BOOT_JDK)/bin/javac
@ -57,4 +56,3 @@ JAR_CMD:=$(BOOT_JDK)/bin/jar
NATIVE2ASCII_CMD:=$(BOOT_JDK)/bin/native2ascii
JARSIGNER_CMD:=$(BOOT_JDK)/bin/jarsigner
SJAVAC_SERVER_JAVA_CMD:=$(JAVA_CMD)

View File

@ -77,7 +77,7 @@ if test $? = 0; then
fi
# Test and fix little endian PowerPC64.
# TODO: should be handled by autoconf-config.guess.
# TODO: should be handled by autoconf-config.guess.
if [ "x$OUT" = x ]; then
if [ `uname -m` = ppc64le ]; then
if [ `uname -s` = Linux ]; then

View File

@ -1,5 +1,5 @@
#!/bin/sh
echo >&2 "No suitable 'install' command found.'"
echo >&2 "If automake is installed, running 'automake -fa'"
echo >&2 "(and ignoring the errors) might produce one."
exit 1
#!/bin/sh
echo >&2 "No suitable 'install' command found.'"
echo >&2 "If automake is installed, running 'automake -fa'"
echo >&2 "(and ignoring the errors) might produce one."
exit 1

View File

@ -46,7 +46,9 @@ FILE="@FILE@"
FIND="@FIND@"
GREP="@GREP@"
JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
JIMAGE="@FIXPATH@ @BUILD_OUTPUT@/jdk/bin/jimage"
LDD="@LDD@"
LN="@LN@"
MKDIR="@MKDIR@"
NAWK="@NAWK@"
NM="@GNM@"

View File

@ -275,3 +275,4 @@ $CHMOD +x $OUTPUT_ROOT/compare.sh
# Finally output some useful information to the user
HELP_PRINT_SUMMARY_AND_WARNINGS
CUSTOM_SUMMARY_AND_WARNINGS_HOOK
HELP_REPEAT_WARNINGS

View File

@ -94,9 +94,9 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
# On Windows, we need to set RC flags.
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
RC_FLAGS="-nologo -l 0x409 -r"
RC_FLAGS="-nologo -l0x409"
if test "x$VARIANT" = xOPT; then
RC_FLAGS="$RC_FLAGS -d NDEBUG"
RC_FLAGS="$RC_FLAGS -DNDEBUG"
fi
# The version variables used to create RC_FLAGS may be overridden
@ -105,13 +105,13 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
# The \$ are escaped to the shell, and the $(...) variables
# are evaluated by make.
RC_FLAGS="$RC_FLAGS \
-d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \
-d \"JDK_COMPANY=\$(COMPANY_NAME)\" \
-d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
-d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \
-d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
-d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
-d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\""
-D\"JDK_BUILD_ID=\$(FULL_VERSION)\" \
-D\"JDK_COMPANY=\$(COMPANY_NAME)\" \
-D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
-D\"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \
-D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
-D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
-D\"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\""
fi
AC_SUBST(RC_FLAGS)
@ -348,10 +348,6 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
# Add runtime stack smashing and undefined behavior checks
CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then
CFLAGS_DEBUG_OPTIONS="$CFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG"
CXXFLAGS_DEBUG_OPTIONS="$CXXFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIsOR_FLAG"
fi
;;
esac
fi
@ -668,7 +664,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
-I${JDK_TOPDIR}/src/java.base/share/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_API_DIR/native/include"
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include"
# The shared libraries are compiled using the picflag.
CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
@ -746,25 +742,6 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
fi
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# If undefined behaviour detection is enabled then we need to tell linker.
case $DEBUG_LEVEL in
release | fastdebug )
;;
slowdebug )
AC_MSG_WARN([$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR])
if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then
# enable undefined behaviour checking
LDFLAGS_JDK="$LDFLAGS_JDK `$ECHO -n $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG | sed -e "s/[ ]*\([^ ]\+\)/ -Xlinker \1/g"`"
LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK `$ECHO -n $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG | sed -e "s/[ ]*\([^ ]\+\)/ -Xlinker \1/g"`"
fi
;;
* )
AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
;;
esac
fi
# Customize LDFLAGS for executables
LDFLAGS_JDKEXE="${LDFLAGS_JDK}"
@ -784,24 +761,24 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
LDFLAGS_JDKLIB_SUFFIX=""
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS} \
-L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
-L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
# On some platforms (mac) the linker warns about non existing -L dirs.
# Add server first if available. Linking aginst client does not always produce the same results.
# Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
# Default to server for other variants.
if test "x$JVM_VARIANT_SERVER" = xtrue; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
fi
LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"

File diff suppressed because it is too large Load Diff

View File

@ -178,15 +178,15 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
printf "====================================================\n"
if test "x$no_create" != "xyes"; then
if test "x$IS_RECONFIGURE" != "xyes"; then
printf "A new configuration has been successfully created in\n %s\n" "$OUTPUT_ROOT"
printf "A new configuration has been successfully created in\n%s\n" "$OUTPUT_ROOT"
else
printf "The existing configuration has been successfully updated in\n %s\n" "$OUTPUT_ROOT"
printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUT_ROOT"
fi
else
if test "x$IS_RECONFIGURE" != "xyes"; then
printf "A configuration has been successfully checked but not created\n"
else
printf "The existing configuration has been successfully checked in\n %s\n" "$OUTPUT_ROOT"
printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUT_ROOT"
fi
fi
if test "x$CONFIGURE_COMMAND_LINE" != x; then
@ -257,3 +257,17 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
printf "\n"
fi
])
AC_DEFUN_ONCE([HELP_REPEAT_WARNINGS],
[
if test -e "$OUTPUT_ROOT/config.log"; then
$GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" > /dev/null 2>&1
if test $? -eq 0; then
printf "The following warnings were produced. Repeated here for convenience:\n"
# We must quote sed expression (using []) to stop m4 from eating the [].
$GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" | $SED -e [ 's/^configure:[0-9]*: //' ]
printf "\n"
fi
fi
])

View File

@ -549,7 +549,15 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VERSION_NUMBERS],
AC_SUBST(MACOSX_BUNDLE_NAME_BASE)
AC_SUBST(MACOSX_BUNDLE_ID_BASE)
COPYRIGHT_YEAR=`date +'%Y'`
AC_ARG_WITH(copyright-year, [AS_HELP_STRING([--with-copyright-year],
[Set copyright year value for build @<:@current year@:>@])])
if test "x$with_copyright_year" = xyes; then
AC_MSG_ERROR([Copyright year must have a value])
elif test "x$with_copyright_year" != x; then
COPYRIGHT_YEAR="$with_copyright_year"
else
COPYRIGHT_YEAR=`date +'%Y'`
fi
AC_SUBST(COPYRIGHT_YEAR)
if test "x$JDK_UPDATE_VERSION" != x; then

View File

@ -355,7 +355,7 @@ AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
FOUND_FREETYPE=no
fi
fi
if test "x$FOUND_FREETYPE" = xyes; then
# Include file found, let's continue the sanity check.
AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])

View File

@ -98,44 +98,37 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
# Converts autoconf style OS name to OpenJDK style, into
# VAR_OS and VAR_OS_API.
# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV.
AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
[
case "$1" in
*linux*)
VAR_OS=linux
VAR_OS_API=posix
VAR_OS_ENV=linux
VAR_OS_TYPE=unix
;;
*solaris*)
VAR_OS=solaris
VAR_OS_API=posix
VAR_OS_ENV=solaris
VAR_OS_TYPE=unix
;;
*darwin*)
VAR_OS=macosx
VAR_OS_API=posix
VAR_OS_ENV=macosx
VAR_OS_TYPE=unix
;;
*bsd*)
VAR_OS=bsd
VAR_OS_API=posix
VAR_OS_ENV=bsd
VAR_OS_TYPE=unix
;;
*cygwin*)
VAR_OS=windows
VAR_OS_API=winapi
VAR_OS_ENV=windows.cygwin
;;
*mingw*)
VAR_OS=windows
VAR_OS_API=winapi
VAR_OS_ENV=windows.msys
;;
*aix*)
VAR_OS=aix
VAR_OS_API=posix
VAR_OS_ENV=aix
VAR_OS_TYPE=unix
;;
*)
AC_MSG_ERROR([unsupported operating system $1])
@ -165,14 +158,22 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu)
# ..and setup our own variables. (Do this explicitely to facilitate searching)
OPENJDK_BUILD_OS="$VAR_OS"
OPENJDK_BUILD_OS_API="$VAR_OS_API"
OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV"
if test "x$VAR_OS_TYPE" != x; then
OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE"
else
OPENJDK_BUILD_OS_TYPE="$VAR_OS"
fi
if test "x$VAR_OS_ENV" != x; then
OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV"
else
OPENJDK_BUILD_OS_ENV="$VAR_OS"
fi
OPENJDK_BUILD_CPU="$VAR_CPU"
OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
AC_SUBST(OPENJDK_BUILD_OS)
AC_SUBST(OPENJDK_BUILD_OS_API)
AC_SUBST(OPENJDK_BUILD_OS_TYPE)
AC_SUBST(OPENJDK_BUILD_OS_ENV)
AC_SUBST(OPENJDK_BUILD_CPU)
AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
@ -187,14 +188,22 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
# ... and setup our own variables. (Do this explicitely to facilitate searching)
OPENJDK_TARGET_OS="$VAR_OS"
OPENJDK_TARGET_OS_API="$VAR_OS_API"
OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV"
if test "x$VAR_OS_TYPE" != x; then
OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE"
else
OPENJDK_TARGET_OS_TYPE="$VAR_OS"
fi
if test "x$VAR_OS_ENV" != x; then
OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV"
else
OPENJDK_TARGET_OS_ENV="$VAR_OS"
fi
OPENJDK_TARGET_CPU="$VAR_CPU"
OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
AC_SUBST(OPENJDK_TARGET_OS)
AC_SUBST(OPENJDK_TARGET_OS_API)
AC_SUBST(OPENJDK_TARGET_OS_TYPE)
AC_SUBST(OPENJDK_TARGET_OS_ENV)
AC_SUBST(OPENJDK_TARGET_CPU)
AC_SUBST(OPENJDK_TARGET_CPU_ARCH)
@ -331,19 +340,10 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
fi
AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS)
# Setup OPENJDK_TARGET_OS_API_DIR, used in source paths.
if test "x$OPENJDK_TARGET_OS_API" = xposix; then
OPENJDK_TARGET_OS_API_DIR="unix"
fi
if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then
OPENJDK_TARGET_OS_API_DIR="windows"
fi
AC_SUBST(OPENJDK_TARGET_OS_API_DIR)
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
OPENJDK_TARGET_OS_EXPORT_DIR=macosx
else
OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_API_DIR}
OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_TYPE}
fi
AC_SUBST(OPENJDK_TARGET_OS_EXPORT_DIR)
@ -472,8 +472,8 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
# And -q on AIX because otherwise the compiler produces 32-bit objects by default
PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
elif test "x$COMPILE_TYPE" = xreduced; then
if test "x$OPENJDK_TARGET_OS" != xwindows; then
# Specify -m if running reduced on other Posix platforms
if test "x$OPENJDK_TARGET_OS_TYPE" = xunix; then
# Specify -m if running reduced on unix platforms
PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
fi
fi

View File

@ -36,6 +36,7 @@
X:=
SPACE:=$(X) $(X)
COMMA:=,
DOLLAR:=$$
HASH:=\#
LEFT_PAREN:=(
RIGHT_PAREN:=)
@ -82,7 +83,7 @@ CONF_NAME:=@CONF_NAME@
# The built jdk will run in this target system.
OPENJDK_TARGET_OS:=@OPENJDK_TARGET_OS@
OPENJDK_TARGET_OS_API:=@OPENJDK_TARGET_OS_API@
OPENJDK_TARGET_OS_TYPE:=@OPENJDK_TARGET_OS_TYPE@
OPENJDK_TARGET_OS_ENV:=@OPENJDK_TARGET_OS_ENV@
OPENJDK_TARGET_CPU:=@OPENJDK_TARGET_CPU@
@ -99,13 +100,12 @@ OPENJDK_TARGET_CPU_LEGACY:=@OPENJDK_TARGET_CPU_LEGACY@
OPENJDK_TARGET_CPU_LEGACY_LIB:=@OPENJDK_TARGET_CPU_LEGACY_LIB@
OPENJDK_TARGET_CPU_OSARCH:=@OPENJDK_TARGET_CPU_OSARCH@
OPENJDK_TARGET_CPU_JLI_CFLAGS:=@OPENJDK_TARGET_CPU_JLI_CFLAGS@
OPENJDK_TARGET_OS_API_DIR:=@OPENJDK_TARGET_OS_API_DIR@
OPENJDK_TARGET_OS_EXPORT_DIR:=@OPENJDK_TARGET_OS_EXPORT_DIR@
# We are building on this build system.
# When not cross-compiling, it is the same as the target.
OPENJDK_BUILD_OS:=@OPENJDK_BUILD_OS@
OPENJDK_BUILD_OS_API:=@OPENJDK_BUILD_OS_API@
OPENJDK_BUILD_OS_TYPE:=@OPENJDK_BUILD_OS_TYPE@
OPENJDK_BUILD_OS_ENV:=@OPENJDK_BUILD_OS_ENV@
OPENJDK_BUILD_CPU:=@OPENJDK_BUILD_CPU@
@ -236,31 +236,23 @@ BUILD_VARIANT_RELEASE:=@BUILD_VARIANT_RELEASE@
BUILD_OUTPUT:=@BUILD_OUTPUT@
# Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
LANGTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/langtools
CORBA_OUTPUTDIR=$(BUILD_OUTPUT)/corba
JAXP_OUTPUTDIR=$(BUILD_OUTPUT)/jaxp
JAXWS_OUTPUTDIR=$(BUILD_OUTPUT)/jaxws
SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/makesupport
HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
NASHORN_OUTPUTDIR=$(BUILD_OUTPUT)/nashorn
IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/testmake
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
LANGTOOLS_DIST=$(LANGTOOLS_OUTPUTDIR)/dist
CORBA_DIST=$(CORBA_OUTPUTDIR)/dist
JAXP_DIST=$(JAXP_OUTPUTDIR)/dist
JAXWS_DIST=$(JAXWS_OUTPUTDIR)/dist
HOTSPOT_DIST=@HOTSPOT_DIST@
NASHORN_DIST=$(NASHORN_OUTPUTDIR)/dist
BUILD_HOTSPOT=@BUILD_HOTSPOT@
# The boot jdk to use. These are overridden in bootcycle-spec.gmk. Make sure to keep
# them in sync.
# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
# it in sync.
BOOT_JDK:=@BOOT_JDK@
BOOT_RTJAR:=@BOOT_RTJAR@
BOOT_TOOLSJAR=$(BOOT_JDK)/lib/tools.jar
# When compiling Java source to be run by the boot jdk
# use these extra flags, eg -source 6 -target 6
@ -351,7 +343,7 @@ OBJC:=@CCACHE@ @OBJC@
CPP:=@FIXPATH@ @CPP@
#CPPFLAGS:=@CPPFLAGS@
# The linker can be gcc or ld on posix systems, or link.exe on windows systems.
# The linker can be gcc or ld on unix systems, or link.exe on windows systems.
LD:=@FIXPATH@ @LD@
# Xcode SDK path
@ -392,7 +384,7 @@ BUILD_LD:=@FIXPATH@ @BUILD_LD@
AS:=@FIXPATH@ @AS@
# AR is used to create a static library (is ar in posix, lib.exe in windows)
# AR is used to create a static library (is ar in unix, lib.exe in windows)
AR:=@FIXPATH@ @AR@
ARFLAGS:=@ARFLAGS@
@ -456,7 +448,7 @@ JAVA_FLAGS_SMALL:=@JAVA_FLAGS_SMALL@
JAVA_TOOL_FLAGS_SMALL:=@JAVA_TOOL_FLAGS_SMALL@
SJAVAC_SERVER_JAVA_FLAGS:=@SJAVAC_SERVER_JAVA_FLAGS@
# The *_CMD variables are defined separately to be easily overridden in bootcycle-spec.gmk
# The *_CMD variables are defined separately to be easily overridden in bootcycle-spec.gmk
# for bootcycle-images build. Make sure to keep them in sync. Do not use the *_CMD
# versions of the variables directly.
JAVA_CMD:=@JAVA@
@ -484,13 +476,14 @@ SJAVAC_SERVER_JAVA=@FIXPATH@ $(SJAVAC_SERVER_JAVA_CMD) $(SJAVAC_SERVER_JAVA_FLAG
JAVAC_FLAGS?=@JAVAC_FLAGS@
# You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
INTERIM_LANGTOOLS_JAR := $(LANGTOOLS_OUTPUTDIR)/dist/interim_langtools.jar
INTERIM_LANGTOOLS_ARGS := "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
# Use = assignment to be able to override in bootcycle-spec.gmk
INTERIM_LANGTOOLS_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_langtools.jar
INTERIM_LANGTOOLS_ARGS = "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
NEW_JAVAC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javac.Main
NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javadoc.Main
# The interim corba jar is needed for running rmic
INTERIM_CORBA_JAR := $(CORBA_OUTPUTDIR)/dist/interim_corba.jar
INTERIM_CORBA_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_corba.jar
# Base flags for RC
# Guarding this against resetting value. Legacy make files include spec multiple
@ -569,10 +562,10 @@ FIXPATH:=@FIXPATH@
# Where the build output is stored for your convenience.
BUILD_LOG:=@BUILD_LOG@
BUILD_LOG_PREVIOUS:=@BUILD_LOG_PREVIOUS@
# Disable the build log wrapper on sjavac+winapi until
# Disable the build log wrapper on sjavac+windows until
# we have solved how to prevent the log wrapper to wait
# for the background sjavac server process.
ifeq (@ENABLE_SJAVAC@X@OPENJDK_BUILD_OS_API@,yesXwinapi)
ifeq (@ENABLE_SJAVAC@X@OPENJDK_BUILD_OS@,yesXwindows)
BUILD_LOG_WRAPPER:=
else
BUILD_LOG_WRAPPER:=@BUILD_LOG_WRAPPER@
@ -695,25 +688,21 @@ OS_VERSION_MINOR:=@OS_VERSION_MINOR@
OS_VERSION_MICRO:=@OS_VERSION_MICRO@
# Images directory definitions
JDK_IMAGE_SUBDIR:=j2sdk-image
JRE_IMAGE_SUBDIR:=j2re-image
JDK_OVERLAY_IMAGE_SUBDIR:=j2sdk-overlay-image
JRE_OVERLAY_IMAGE_SUBDIR:=j2re-overlay-image
JDK_IMAGE_SUBDIR:=jdk
JRE_IMAGE_SUBDIR:=jre
# Colon left out to be able to override output dir for bootcycle-images
JDK_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
JDK_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_OVERLAY_IMAGE_SUBDIR)
JRE_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_OVERLAY_IMAGE_SUBDIR)
# Macosx bundles directory definitions
JDK_BUNDLE_SUBDIR=j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
JRE_BUNDLE_SUBDIR=j2re-bundle/jre$(JDK_VERSION).jre/Contents
JDK_BUNDLE_SUBDIR=jdk-bundle/jdk$(JDK_VERSION).jdk/Contents
JRE_BUNDLE_SUBDIR=jre-bundle/jre$(JDK_VERSION).jre/Contents
JDK_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_BUNDLE_SUBDIR)
JRE_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_BUNDLE_SUBDIR)
# This macro is called to allow inclusion of closed source counterparts.
# Unless overridden in closed sources, it expands to nothing.
# Usage: This function is called in an open makefile, with the following
# Usage: This function is called in an open makefile, with the following
# arguments:
# $1 the name of the repo, or empty if the top-level repo.
# $2 the name of the makefile

View File

@ -712,12 +712,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
[HAS_CFLAG_OPTIMIZE_DEBUG=true],
[HAS_CFLAG_OPTIMIZE_DEBUG=false])
# "-fsanitize=undefined" supported for GCC 4.9 and later
CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG="-fsanitize=undefined -fsanitize-recover"
FLAGS_COMPILER_CHECK_ARGUMENTS([$CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG],
[HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=true],
[HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=false])
# "-z relro" supported in GNU binutils 2.17 and later
LINKER_RELRO_FLAG="-Xlinker -z -Xlinker relro"
FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_RELRO_FLAG],

View File

@ -248,7 +248,7 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
METHOD="$2"
if test -e "$POSSIBLE_MSVCR_DLL"; then
AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
# Need to check if the found msvcr is correct architecture
AC_MSG_CHECKING([found msvcr100.dll architecture])
MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
@ -291,7 +291,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
fi
fi
if test "x$MSVCR_DLL" = x; then
# Probe: Using well-known location from Visual Studio 10.0
if test "x$VCINSTALLDIR" != x; then
@ -311,9 +311,9 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
fi
if test "x$MSVCR_DLL" = x; then
# Probe: Look in the Windows system32 directory
# Probe: Look in the Windows system32 directory
CYGWIN_SYSTEMROOT="$SYSTEMROOT"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
@ -333,7 +333,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
fi
fi
if test "x$MSVCR_DLL" = x; then
# Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
# (This was the original behaviour; kept since it might turn up something)
@ -347,11 +347,11 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
fi
fi
TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
fi
fi
if test "x$MSVCR_DLL" = x; then
AC_MSG_CHECKING([for msvcr100.dll])
AC_MSG_RESULT([no])

View File

@ -103,8 +103,8 @@ diff_text() {
-e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
-e thePoint -e aPoint -e setItemsPtr \
-e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then
$JAVAP -c -constants -l -p ${OTHER_FILE} > ${OTHER_FILE}.javap
$JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
$JAVAP -c -constants -l -p "${OTHER_FILE}" > ${OTHER_FILE}.javap
$JAVAP -c -constants -l -p "${THIS_FILE}" > ${THIS_FILE}.javap
TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
@ -298,7 +298,7 @@ compare_general_files() {
WORK_DIR=$3
GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" ! -name "*.jimage" \
! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
@ -395,8 +395,14 @@ compare_zip_file() {
$RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
$MKDIR -p $THIS_UNZIPDIR
$MKDIR -p $OTHER_UNZIPDIR
(cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
(cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
if [ "$TYPE" = "jimage" ]
then
(cd $THIS_UNZIPDIR && $JIMAGE extract $THIS_ZIP)
(cd $OTHER_UNZIPDIR && $JIMAGE extract $OTHER_ZIP)
else
(cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
(cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
fi
# Find all archives inside and unzip them as well to compare the contents rather than
# the archives. pie.jar.pack.gz i app3.war is corrupt, skip it.
@ -525,7 +531,7 @@ compare_all_jar_files() {
# TODO filter?
ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" \
| $SORT | $FILTER)
-o -name "*.jimage" | $SORT | $FILTER)
if [ -n "$ZIPS" ]; then
echo Jar files...
@ -633,7 +639,7 @@ compare_bin_file() {
if cmp $OTHER_FILE $THIS_FILE > /dev/null; then
# The files were bytewise identical.
if [ -n "$VERBOSE" ]; then
echo " : : : : : $BIN_FILE"
echo " : : : : : : $BIN_FILE"
fi
return 0
fi
@ -1136,17 +1142,8 @@ fi
if [ "$SKIP_DEFAULT" != "true" ]; then
if [ -z "$OTHER" ]; then
OTHER="$THIS/../$LEGACY_BUILD_DIR"
if [ -d "$OTHER" ]; then
OTHER="$( cd "$OTHER" && pwd )"
else
echo "Default old build directory does not exist:"
echo "$OTHER"
exit 1
fi
echo "Comparing to default old build:"
echo "$OTHER"
echo
echo "Nothing to compare to, set with -o"
exit 1
else
if [ ! -d "$OTHER" ]; then
echo "Other build directory does not exist:"
@ -1160,90 +1157,36 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
fi
# Figure out the layout of the this build. Which kinds of images have been produced
if [ -d "$THIS/install/j2sdk-image" ]; then
THIS_J2SDK="$THIS/install/j2sdk-image"
THIS_J2RE="$THIS/install/j2re-image"
echo "Selecting install images in this build"
elif [ -d "$THIS/deploy/j2sdk-image" ]; then
THIS_J2SDK="$THIS/deploy/j2sdk-image"
THIS_J2RE="$THIS/deploy/j2re-image"
echo "Selecting deploy images in this build"
elif [ -d "$THIS/images/j2sdk-image" ]; then
THIS_J2SDK="$THIS/images/j2sdk-image"
THIS_J2RE="$THIS/images/j2re-image"
echo "Selecting jdk images in this build"
# Find the common images to compare, prioritizing later build stages
if [ -d "$THIS/install/jdk" ] && [ -d "$OTHER/install/jdk" ]; then
THIS_J2SDK="$THIS/install/jdk"
THIS_J2RE="$THIS/install/jre"
OTHER_J2SDK="$OTHER/install/jdk"
OTHER_J2RE="$OTHER/install/jre"
echo "Selecting install images for compare"
elif [ -d "$THIS/deploy/jdk" ] && [ -d "$OTHER/deploy/jdk" ]; then
THIS_J2SDK="$THIS/deploy/jdk"
THIS_J2RE="$THIS/deploy/jre"
OTHER_J2SDK="$OTHER/deploy/jdk"
OTHER_J2RE="$OTHER/deploy/jre"
echo "Selecting deploy images for compare"
elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then
THIS_J2SDK="$THIS/images/jdk"
THIS_J2RE="$THIS/images/jre"
OTHER_J2SDK="$OTHER/images/jdk"
OTHER_J2RE="$OTHER/images/jre"
echo "Selecting jdk images for compare"
else
echo "No common images found."
exit 1
fi
if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
if [ -d "$THIS/install/j2sdk-image" ]; then
# If there is an install image, prefer that, it's also overlay
THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
echo "Selecting install overlay images in this build"
else
THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
echo "Selecting jdk overlay images in this build"
fi
fi
if [ -d "$THIS/images/j2sdk-bundle" ]; then
THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
echo "Selecting bundles in this build"
fi
# Figure out the layout of the other build (old or new, normal or overlay image)
if [ -d "$OTHER/j2sdk-image" ]; then
if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
OTHER_J2SDK="$OTHER/j2sdk-image"
OTHER_J2RE="$OTHER/j2re-image"
echo "Selecting old-style images in other build"
else
OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
echo "Selecting overlay images in other build"
fi
elif [ -d "$OTHER/install/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/install/j2sdk-image"
OTHER_J2RE="$OTHER/install/j2re-image"
echo "Selecting install images in other build"
elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
OTHER_J2RE="$OTHER/deploy/j2re-image"
echo "Selecting deploy images in other build"
elif [ -d "$OTHER/images/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/images/j2sdk-image"
OTHER_J2RE="$OTHER/images/j2re-image"
echo "Selecting jdk images in other build"
fi
if [ -d "$OTHER/j2sdk-bundle" ]; then
OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
echo "Selecting bundles in other build"
elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
echo "Selecting jdk bundles in other build"
fi
if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
if [ -z "$THIS_J2SDK_OVERLAY" ]; then
echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
exit 1
fi
fi
if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
exit 1
fi
if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo "WARNING! OTHER build has bundles built while this build does not."
echo "Skipping bundle compare!"
if [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
THIS_J2SDK_BUNDLE="$THIS/images/jdk-bundle"
THIS_J2RE_BUNDLE="$THIS/images/jre-bundle"
OTHER_J2SDK_BUNDLE="$OTHER/images/jdk-bundle"
OTHER_J2RE_BUNDLE="$OTHER/images/jre-bundle"
echo "Also comparing macosx bundles"
fi
if [ -d "$OTHER/images" ]; then
@ -1266,22 +1209,13 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
fi
if [ -d "$THIS/docs" ]; then
if [ -d "$THIS/docs" ] && [ -d "$OTHER/docs" ]; then
THIS_DOCS="$THIS/docs"
fi
if [ -d "$OTHER/docs" ]; then
OTHER_DOCS="$OTHER/docs"
fi
if [ -z "$THIS_DOCS" ]; then
echo "Also comparing docs"
else
echo "WARNING! Docs haven't been built and won't be compared."
fi
if [ -z "$OTHER_DOCS" ]; then
echo "WARNING! Other build doesn't contain docs, skipping doc compare."
fi
fi
##########################################################################################
@ -1299,27 +1233,16 @@ if [ "$CMP_NAMES" = "true" ]; then
echo -n "J2RE "
compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "J2SDK Overlay "
compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
echo -n "J2RE Overlay "
compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
echo -n "J2SDK Overlay "
compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
echo -n "J2RE Overlay "
compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
echo -n "J2SDK Bundle "
compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
echo -n "Docs "
@ -1340,18 +1263,6 @@ if [ "$CMP_PERMS" = "true" ]; then
echo -n "J2RE "
compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "J2SDK Overlay "
compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
echo -n "J2RE Overlay "
compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
compare_permissions $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
echo -n "J2RE Bundle "
compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
@ -1364,17 +1275,11 @@ if [ "$CMP_TYPES" = "true" ]; then
echo -n "J2RE "
compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "J2SDK Overlay "
compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
echo -n "J2RE Overlay "
compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
@ -1388,17 +1293,11 @@ if [ "$CMP_GENERAL" = "true" ]; then
echo -n "J2RE "
compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "J2SDK Overlay "
compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
echo -n "J2RE Overlay "
compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
echo -n "Docs "
@ -1454,10 +1353,6 @@ if [ "$CMP_LIBS" = "true" ]; then
compare_all_libs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "Bundle "
compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
@ -1467,10 +1362,6 @@ if [ "$CMP_EXECS" = "true" ]; then
if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "Overlay "
compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi

View File

@ -84,7 +84,9 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@ -108,6 +110,7 @@ ACCEPTED_BIN_DIFF="
./bin/wsimport
./bin/xjc
./jre/bin/java
./jre/bin/jjs
./jre/bin/keytool
./jre/bin/orbd
./jre/bin/pack200
@ -171,7 +174,9 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@ -195,6 +200,7 @@ ACCEPTED_BIN_DIFF="
./bin/wsimport
./bin/xjc
./jre/bin/java
./jre/bin/jjs
./jre/bin/keytool
./jre/bin/orbd
./jre/bin/pack200
@ -314,7 +320,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@ -453,7 +461,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/amd64/jconsole
./bin/amd64/jdb
./bin/amd64/jhat
./bin/amd64/jimage
./bin/amd64/jinfo
./bin/amd64/jjs
./bin/amd64/jmap
./bin/amd64/jps
./bin/amd64/jrunscript
@ -611,7 +621,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@ -755,7 +767,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/sparcv9/jconsole
./bin/sparcv9/jdb
./bin/sparcv9/jhat
./bin/sparcv9/jimage
./bin/sparcv9/jinfo
./bin/sparcv9/jjs
./bin/sparcv9/jmap
./bin/sparcv9/jps
./bin/sparcv9/jrunscript
@ -836,7 +850,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole.exe
./bin/jdb.exe
./bin/jhat.exe
./bin/jimage.exe
./bin/jinfo.exe
./bin/jjs.exe
./bin/jmap.exe
./bin/jps.exe
./bin/jrunscript.exe
@ -910,11 +926,6 @@ ACCEPTED_JARZIP_CONTENTS="
/META-INF/INDEX.LIST
"
KNOWN_BIN_DIFF="
./jre/lib/libJObjC.dylib
./lib/libJObjC.dylib
"
ACCEPTED_BIN_DIFF="
./bin/appletviewer
./bin/idlj
@ -930,7 +941,9 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@ -964,34 +977,82 @@ ACCEPTED_BIN_DIFF="
./jre/bin/tnameserv
./jre/lib/libsaproc.dylib
./jre/lib/server/libjvm.dylib
./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.dylib
./demo/jvmti/gctest/lib/libgctest.dylib
./demo/jvmti/heapTracker/lib/libheapTracker.dylib
./demo/jvmti/heapViewer/lib/libheapViewer.dylib
./demo/jvmti/minst/lib/libminst.dylib
./demo/jvmti/mtrace/lib/libmtrace.dylib
./demo/jvmti/versionCheck/lib/libversionCheck.dylib
./demo/jvmti/waiters/lib/libwaiters.dylib
./Contents/Home/lib/libAppleScriptEngine.dylib
./Contents/Home/lib/libattach.dylib
./Contents/Home/lib/libawt_lwawt.dylib
./Contents/Home/lib/libdeploy.dylib
./Contents/Home/lib/libdt_socket.dylib
./Contents/Home/lib/libhprof.dylib
./Contents/Home/lib/libinstrument.dylib
./Contents/Home/lib/libjava_crw_demo.dylib
./Contents/Home/lib/libjdwp.dylib
./Contents/Home/lib/libjsdt.dylib
./Contents/Home/lib/libjsig.dylib
./Contents/Home/lib/libmanagement.dylib
./Contents/Home/lib/libnpjp2.dylib
./Contents/Home/lib/libosx.dylib
./Contents/Home/lib/libosxapp.dylib
./Contents/Home/lib/libsaproc.dylib
./Contents/Home/lib/libsplashscreen.dylib
./Contents/Home/lib/libverify.dylib
./Contents/Home/lib/server/libjsig.dylib
./Contents/Home/lib/server/libjvm.dylib
./jre/lib/libAppleScriptEngine.dylib
./jre/lib/libattach.dylib
./jre/lib/libawt_lwawt.dylib
./jre/lib/libdeploy.dylib
./jre/lib/libdt_socket.dylib
./jre/lib/libhprof.dylib
./jre/lib/libinstrument.dylib
./jre/lib/libjava_crw_demo.dylib
./jre/lib/libjdwp.dylib
./jre/lib/libjsdt.dylib
./jre/lib/libjsig.dylib
./jre/lib/libmanagement.dylib
./jre/lib/libosx.dylib
./jre/lib/libosxapp.dylib
./jre/lib/libsaproc.dylib
./jre/lib/libsplashscreen.dylib
./jre/lib/libverify.dylib
./jre/lib/server/libjvm.dylib
./lib/libAppleScriptEngine.dylib
./lib/libattach.dylib
./lib/libawt_lwawt.dylib
./lib/libdeploy.dylib
./lib/libdt_socket.dylib
./lib/libhprof.dylib
./lib/libinstrument.dylib
./lib/libjava_crw_demo.dylib
./lib/libjdwp.dylib
./lib/libjsdt.dylib
./lib/libjsig.dylib
./lib/libmanagement.dylib
./lib/libnpjp2.dylib
./lib/libosx.dylib
./lib/libosxapp.dylib
./lib/libverify.dylib
./lib/libsaproc.dylib
./lib/libsplashscreen.dylib
./lib/server/libjvm.dylib
./lib/deploy/JavaControlPanel.prefPane/Contents/MacOS/JavaControlPanel
"
KNOWN_SIZE_DIFF="
./jre/lib/libJObjC.dylib
./lib/libJObjC.dylib
"
SORT_SYMBOLS="
./jre/lib/libJObjC.dylib
./lib/libJObjC.dylib
./Contents/Home/lib/libsaproc.dylib
./jre/lib/libsaproc.dylib
./lib/libsaproc.dylib
"
KNOWN_SYM_DIFF="
./jre/lib/libJObjC.dylib
./lib/libJObjC.dylib
ACCEPTED_SMALL_SIZE_DIFF="
./bin/javaws
./Contents/Home/bin/_javaws
"
KNOWN_ELF_DIFF="
./jre/lib/libJObjC.dylib
./lib/libJObjC.dylib
"
KNOWN_DIS_DIFF="
./jre/lib/libJObjC.dylib
./lib/libJObjC.dylib
"
fi

View File

@ -22,10 +22,10 @@
# questions.
#
# Usage: ./logger.sh theloggfile acommand arg1 arg2
# Usage: ./logger.sh theloggfile acommand arg1 arg2
#
# Execute acommand with args, in such a way that
# both stdout and stderr from acommand are appended to
# both stdout and stderr from acommand are appended to
# theloggfile.
#
# Preserve stdout and stderr, so that the stdout

View File

@ -26,12 +26,12 @@
#
# This shell script is supposed to be set as a replacement for SHELL in make,
# causing it to be called whenever make wants to execute shell commands.
# The <shell command line> is suitable for passing on to the old shell,
# The <shell command line> is suitable for passing on to the old shell,
# typically beginning with -c.
#
# This script will make sure the shell command line is executed with
# This script will make sure the shell command line is executed with
# OLD_SHELL -x, and it will also store a simple log of the the time it takes to
# execute the command in the OUTPUT_FILE, using the "time" utility as pointed
# execute the command in the OUTPUT_FILE, using the "time" utility as pointed
# to by TIME_CMD. If TIME_CMD is "-", no timestamp will be stored.
TIME_CMD="$1"

View File

@ -171,7 +171,7 @@ checkErrors
) 2>&1 | tee ${t3}.build.txt
checkErrors
# Compare old build to build-infra build
# Compare old build to build-infra build
( \
sh ${t0}/common/bin/compareimage.sh \
${t3}/build/*/j2sdk-image \
@ -181,4 +181,3 @@ checkErrors
checkErrors
exit 0

View File

@ -1212,6 +1212,7 @@ jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp : jdk/src/share/classes/sun
jdk/src/java.rmi/share/doc/stub/java/rmi/activation : jdk/src/share/doc/stub/java/rmi/activation
jdk/src/java.rmi/unix/bin/java-rmi.cgi.sh : jdk/src/solaris/bin/java-rmi.cgi.sh
jdk/src/java.scripting/share/classes/javax/script : jdk/src/share/classes/javax/script
jdk/src/java.scripting/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
jdk/src/java.security.acl/share/classes/java/security/acl : jdk/src/share/classes/java/security/acl
jdk/src/java.security.acl/share/classes/sun/security/acl : jdk/src/share/classes/sun/security/acl
jdk/src/java.security.jgss/macosx/native/libosxkrb5/nativeccache.c : jdk/src/share/native/sun/security/krb5/nativeccache.c
@ -1301,7 +1302,6 @@ jdk/src/jdk.deploy.osx/macosx/native/libosx/JavaAppLauncher.m : jdk/src/macosx/n
jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m : jdk/src/macosx/native/apple/security/KeystoreImpl.m
jdk/src/jdk.dev/share/classes/com/sun/jarsigner : jdk/src/share/classes/com/sun/jarsigner
jdk/src/jdk.dev/share/classes/com/sun/tools/hat : jdk/src/share/classes/com/sun/tools/hat
jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner : jdk/src/share/classes/sun/security/tools/jarsigner
jdk/src/jdk.dev/share/classes/sun/tools/jar : jdk/src/share/classes/sun/tools/jar
jdk/src/jdk.dev/share/classes/sun/tools/native2ascii : jdk/src/share/classes/sun/tools/native2ascii

View File

@ -80,7 +80,7 @@ for r in $repos ; do
if [ $repo = "$r" ] ; then
found="true"
break;
fi
fi
done
if [ $found = "false" ] ; then
echo "ERROR: Unknown repo: $repo. Should be one of [$repos]." >&2
@ -200,4 +200,3 @@ do
printf "%s\n" "$line" >> $output
fi
done < "$input"

View File

@ -282,3 +282,6 @@ ffd90c81d4ef9d94d880fc852e2fc482ecd9b374 jdk9-b36
7e9add74ad50841fb39dae75db56374aefa1de4c jdk9-b37
8acf056126e819cf536eef02aee0f61f207a6b52 jdk9-b38
53bf36cb722db50815712258a77cb6bbe25a2f5f jdk9-b39
e27c725d6c9d155667b35255f442d4ceb8c3c084 jdk9-b40
1908b886ba1eda46fa725cf1160fe5d30fd1a7e5 jdk9-b41
078bb11af876fe528d4b516f33ad4dd9bb60549e jdk9-b42

View File

@ -1,53 +0,0 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# The Corba sources are old and generates a LOT of warnings.
# Disable these using Xlint, until someone cares to fix them.
DISABLE_CORBA_WARNINGS := -Xlint:all,-deprecation,-unchecked,-serial,-fallthrough,-cast,-rawtypes,-static,-dep-ann
# The "generate old bytecode" javac setup uses the new compiler to compile for the
# boot jdk to generate tools that need to be run with the boot jdk.
# Thus we force the target bytecode to the boot jdk bytecode.
$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := $(BOOT_JDK_SOURCETARGET) \
-bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(BOOT_TOOLSJAR)" \
$(DISABLE_CORBA_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
# The "generate new bytecode" uses the new compiler to generate bytecode
# for the new jdk that is being built. The code compiled by this setup
# cannot necessarily be run with the boot jdk.
$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -cp $(BOOT_TOOLSJAR) -XDignore.symbol.file=true $(DISABLE_CORBA_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
################################################################################

View File

@ -29,16 +29,16 @@ default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include CommonCorba.gmk
include SetupJavaCompilers.gmk
################################################################################
$(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes \
SRC := $(JDK_TOPDIR)/src/jdk.rmic/share/classes \
$(CORBA_TOPDIR)/src/java.corba/share/classes \
$(CORBA_TOPDIR)/src/jdk.rmic/share/classes \
$(CORBA_OUTPUTDIR)/gensrc/java.corba, \
$(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
EXCLUDES := com/sun/corba/se/PortableActivationIDL, \
EXCLUDE_FILES := com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
@ -47,16 +47,9 @@ $(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
com/sun/corba/se/impl/presentation/rmi/jndi.properties, \
COPY := .prp, \
CLEAN := .properties, \
BIN := $(CORBA_OUTPUTDIR)/interim_classes, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_interim_classes, \
JAR := $(INTERIM_CORBA_JAR)))
################################################################################
# Copy idl files straight to jdk/include.
$(JDK_OUTPUTDIR)/include/%: $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/%
$(install-file)
IDL_TARGET_FILES := $(JDK_OUTPUTDIR)/include/orb.idl $(JDK_OUTPUTDIR)/include/ir.idl
################################################################################
all: $(BUILD_INTERIM_CORBA) $(IDL_TARGET_FILES)
all: $(BUILD_INTERIM_CORBA)

View File

@ -23,13 +23,12 @@
# questions.
#
# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools
# and the interim javac, to be run by the boot jdk.
$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
JAVAC := $(JAVAC), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA), \
FLAGS := -XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror))
################################################################################
# Copy idl files to jdk/lib.
$(eval $(call SetupCopyFiles,COPY_IDL, \
SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl, \
DEST := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
FILES := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl \
$(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl))
# javax.tools.JavaCompilerTool isn't really a suffix but this gets the file copied.
RESOURCE_SUFFIXES := .gif .xml .css .js javax.tools.JavaCompilerTool
TARGETS := $(COPY_IDL)

View File

@ -29,35 +29,37 @@ include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include IdlCompilation.gmk
include CommonCorba.gmk
include SetupJavaCompilers.gmk
################################################################################
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_CORBA, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(CORBA_TOPDIR)/make/src/classes, \
BIN := $(CORBA_OUTPUTDIR)/tools_classes))
BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes))
TOOL_LOGUTIL_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/tools_classes \
TOOL_LOGUTIL_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes \
build.tools.logutil.MC
$(eval $(call SetupJavaCompilation,BUILD_IDLJ, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
BIN := $(CORBA_OUTPUTDIR)/idlj_classes, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/idlj_classes, \
COPY := .prp, \
INCLUDES := com/sun/tools/corba/se/idl, \
EXCLUDE_FILES := ResourceBundleUtil.java))
# Force the language to english for predictable source code generation.
TOOL_IDLJ_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/idlj_classes \
TOOL_IDLJ_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/idlj_classes \
-Duser.language=en com.sun.tools.corba.se.idl.toJavaPortable.Compile
################################################################################
EXCEPTION_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging
LOGWRAPPER_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/_logwrappers
# Generate LogWrapper classes
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/%SystemException.java: \
$(EXCEPTION_DIR)/%SystemException.java: \
$(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
$(BUILD_TOOLS_CORBA)
$(MKDIR) -p $(@D)
@ -66,21 +68,21 @@ $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/%SystemExcept
$(TOOL_LOGUTIL_CMD) make-class $< $(@D)
# Generate LogWrapper properties file by concatening resource files
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/LogStrings.properties: \
$(CORBA_OUTPUTDIR)/logwrappers/ActivationSystemException.resource \
$(CORBA_OUTPUTDIR)/logwrappers/IORSystemException.resource \
$(CORBA_OUTPUTDIR)/logwrappers/InterceptorsSystemException.resource \
$(CORBA_OUTPUTDIR)/logwrappers/NamingSystemException.resource \
$(CORBA_OUTPUTDIR)/logwrappers/OMGSystemException.resource \
$(CORBA_OUTPUTDIR)/logwrappers/ORBUtilSystemException.resource \
$(CORBA_OUTPUTDIR)/logwrappers/POASystemException.resource \
$(CORBA_OUTPUTDIR)/logwrappers/UtilSystemException.resource
$(EXCEPTION_DIR)/LogStrings.properties: \
$(LOGWRAPPER_DIR)/ActivationSystemException.resource \
$(LOGWRAPPER_DIR)/IORSystemException.resource \
$(LOGWRAPPER_DIR)/InterceptorsSystemException.resource \
$(LOGWRAPPER_DIR)/NamingSystemException.resource \
$(LOGWRAPPER_DIR)/OMGSystemException.resource \
$(LOGWRAPPER_DIR)/ORBUtilSystemException.resource \
$(LOGWRAPPER_DIR)/POASystemException.resource \
$(LOGWRAPPER_DIR)/UtilSystemException.resource
$(MKDIR) -p $(@D)
$(ECHO) $(LOG_INFO) Concatenating 8 resource files into $(@F)
$(CAT) $^ > $@
# The resources files are generated from lisp-like .mc files.
$(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource: \
$(LOGWRAPPER_DIR)/%SystemException.resource: \
$(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
$(BUILD_TOOLS_CORBA)
$(MKDIR) -p $(@D)
@ -90,15 +92,15 @@ $(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource: \
LOGWRAPPER_TARGETS := \
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/ActivationSystemException.java \
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/IORSystemException.java \
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/InterceptorsSystemException.java \
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/NamingSystemException.java \
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/OMGSystemException.java \
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/ORBUtilSystemException.java \
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/POASystemException.java \
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/UtilSystemException.java \
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/LogStrings.properties
$(EXCEPTION_DIR)/ActivationSystemException.java \
$(EXCEPTION_DIR)/IORSystemException.java \
$(EXCEPTION_DIR)/InterceptorsSystemException.java \
$(EXCEPTION_DIR)/NamingSystemException.java \
$(EXCEPTION_DIR)/OMGSystemException.java \
$(EXCEPTION_DIR)/ORBUtilSystemException.java \
$(EXCEPTION_DIR)/POASystemException.java \
$(EXCEPTION_DIR)/UtilSystemException.java \
$(EXCEPTION_DIR)/LogStrings.properties
################################################################################
# Build the IDLs.
@ -215,7 +217,7 @@ IDL_DELETES := \
$(eval $(call SetupIdlCompilation,BUILD_IDLS, \
IDLJ := $(TOOL_IDLJ_CMD), \
SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
BIN := $(CORBA_OUTPUTDIR)/gensrc/java.corba, \
BIN := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
EXCLUDES := com/sun/tools/corba/se/idl/% \
org/omg/CORBA/% \
com/sun/corba/se/GiopIDL/% \
@ -230,12 +232,12 @@ $(BUILD_IDLS): $(BUILD_IDLJ)
################################################################################
# zh_HK is just a copy of zh_TW
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
$(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
$(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
$(install-file)
################################################################################
all: $(BUILD_IDLS) $(LOGWRAPPER_TARGETS) \
$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
$(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties

View File

@ -352,7 +352,7 @@ public abstract class Generator implements sun.rmi.rmic.Generator,
env.output(Main.getText("rmic.generated", file.getPath(), Long.toString(duration)));
}
if (sourceFile) {
env.parseFile(new ClassFile(file));
env.parseFile(ClassFile.newClassFile(file));
}
} catch (IOException e) {
env.error(0, "cant.write", file.toString());

View File

@ -443,3 +443,5 @@ b1c2dd843f247a1db19e1e85eb62ca405f72dc26 jdk9-b37
c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38
9cb75e5e394827ccbaf2e15524108a412dc4ddc5 jdk9-b39
6b09b3193d731e3288e2a240c504a20d0a06c766 jdk9-b40
1d29b13e8a515a7ea3b882f140576d5d675bc11f jdk9-b41
38cb4fbd47e3472bd1b5ebac83bda96fe4869c4f jdk9-b42

View File

@ -65,6 +65,10 @@ else
SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH))
endif
ifneq ($(SA_CLASSPATH),)
SA_CLASSPATH_ARG := -classpath $(SA_CLASSPATH)
endif
# TODO: if it's a modules image, check if SA module is installed.
MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
@ -116,7 +120,7 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
# are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) $(SA_CLASSPATH_ARG) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js

View File

@ -531,15 +531,13 @@ void os::init_system_properties_values() {
#define DEFAULT_LIBPATH "/usr/lib:/lib"
#define EXTENSIONS_DIR "/lib/ext"
#define ENDORSED_DIR "/lib/endorsed"
// Buffer that fits several sprintfs.
// Note that the space for the trailing null is provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR), // extensions dir
(size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@ -590,15 +588,10 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
// Endorsed standards default directory.
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf);
#undef DEFAULT_LIBPATH
#undef EXTENSIONS_DIR
#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@ -2803,6 +2796,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return ::read(fd, buf, nBytes);
}
size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
return ::pread(fd, buf, nBytes, offset);
}
void os::naked_short_sleep(jlong ms) {
struct timespec req;
@ -4151,8 +4148,29 @@ int os::available(int fd, jlong *bytes) {
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
Unimplemented();
return NULL;
int prot;
int flags = MAP_PRIVATE;
if (read_only) {
prot = PROT_READ;
} else {
prot = PROT_READ | PROT_WRITE;
}
if (allow_exec) {
prot |= PROT_EXEC;
}
if (addr != NULL) {
flags |= MAP_FIXED;
}
char* mapped_address = (char*)mmap(addr, (size_t)bytes, prot, flags,
fd, file_offset);
if (mapped_address == MAP_FAILED) {
return NULL;
}
return mapped_address;
}
// Remap a block of memory.

View File

@ -353,7 +353,6 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
#define ENDORSED_DIR "/lib/endorsed"
#ifndef __APPLE__
@ -361,9 +360,8 @@ void os::init_system_properties_values() {
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
(size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@ -425,10 +423,6 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
// Endorsed standards default directory.
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf);
#else // __APPLE__
@ -445,9 +439,8 @@ void os::init_system_properties_values() {
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX3((size_t)MAXPATHLEN, // for dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size, // extensions dir
(size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
MAX2((size_t)MAXPATHLEN, // for dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@ -525,10 +518,6 @@ void os::init_system_properties_values() {
user_home_dir, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
// Endorsed standards default directory.
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf);
#undef SYS_EXTENSIONS_DIR
@ -538,7 +527,6 @@ void os::init_system_properties_values() {
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@ -2576,6 +2564,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes));
}
size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
RESTARTABLE_RETURN_INT(::pread(fd, buf, nBytes, offset));
}
void os::naked_short_sleep(jlong ms) {
struct timespec req;

View File

@ -338,15 +338,13 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
#define ENDORSED_DIR "/lib/endorsed"
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
(size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@ -411,16 +409,11 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
// Endorsed standards default directory.
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf);
#undef DEFAULT_LIBPATH
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@ -3784,6 +3777,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return ::read(fd, buf, nBytes);
}
size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
return ::pread(fd, buf, nBytes, offset);
}
// Short sleep, direct OS call.
//
// Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee

View File

@ -609,17 +609,15 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/jdk/packages"
#define EXTENSIONS_DIR "/lib/ext"
#define ENDORSED_DIR "/lib/endorsed"
char cpu_arch[12];
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX4((size_t)MAXPATHLEN, // For dll_dir & friends.
MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch), // invariant ld_library_path
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
(size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@ -765,15 +763,10 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
// Endorsed standards default directory.
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf);
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
#undef ENDORSED_DIR
}
void os::breakpoint() {
@ -3167,6 +3160,15 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return res;
}
size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
size_t res;
JavaThread* thread = (JavaThread*)Thread::current();
assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm");
ThreadBlockInVM tbiv(thread);
RESTARTABLE(::pread(fd, buf, (size_t) nBytes, offset), res);
return res;
}
size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
size_t res;
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,

View File

@ -292,19 +292,6 @@ void os::init_system_properties_values() {
#undef BIN_DIR
#undef PACKAGE_DIR
// Default endorsed standards directory.
{
#define ENDORSED_DIR "\\lib\\endorsed"
size_t len = strlen(Arguments::get_java_home()) + sizeof(ENDORSED_DIR);
char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal);
sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR);
Arguments::set_endorsed_dirs(buf);
// (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
// duplicates the input.)
FREE_C_HEAP_ARRAY(char, buf);
#undef ENDORSED_DIR
}
#ifndef _WIN64
// set our UnhandledExceptionFilter and save any previous one
prev_uef_handler = SetUnhandledExceptionFilter(Handle_FLT_Exception);
@ -3087,7 +3074,7 @@ char* os::reserve_memory_aligned(size_t size, size_t alignment) {
char* os::pd_reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
assert((size_t)addr % os::vm_allocation_granularity() == 0,
"reserve alignment");
assert(bytes % os::vm_allocation_granularity() == 0, "reserve block size");
assert(bytes % os::vm_page_size() == 0, "reserve page size");
char* res;
// note that if UseLargePages is on, all the areas that require interleaving
// will go thru reserve_memory_special rather than thru here.
@ -4391,6 +4378,23 @@ jlong os::lseek(int fd, jlong offset, int whence) {
return (jlong) ::_lseeki64(fd, offset, whence);
}
size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
OVERLAPPED ov;
DWORD nread;
BOOL result;
ZeroMemory(&ov, sizeof(ov));
ov.Offset = (DWORD)offset;
ov.OffsetHigh = (DWORD)(offset >> 32);
HANDLE h = (HANDLE)::_get_osfhandle(fd);
result = ReadFile(h, (LPVOID)buf, nBytes, &nread, &ov);
return result ? nread : 0;
}
// This method is a slightly reworked copy of JDK's sysNativePath
// from src/windows/hpi/src/path_md.c

View File

@ -3108,21 +3108,39 @@ void ClassFileParser::apply_parsed_class_attributes(instanceKlassHandle k) {
}
}
// Transfer ownership of metadata allocated to the InstanceKlass.
void ClassFileParser::apply_parsed_class_metadata(
instanceKlassHandle this_klass,
int java_fields_count, TRAPS) {
// Assign annotations if needed
if (_annotations != NULL || _type_annotations != NULL ||
_fields_annotations != NULL || _fields_type_annotations != NULL) {
// Create the Annotations object that will
// hold the annotations array for the Klass.
void ClassFileParser::create_combined_annotations(TRAPS) {
if (_annotations == NULL &&
_type_annotations == NULL &&
_fields_annotations == NULL &&
_fields_type_annotations == NULL) {
// Don't create the Annotations object unnecessarily.
return;
}
Annotations* annotations = Annotations::allocate(_loader_data, CHECK);
annotations->set_class_annotations(_annotations);
annotations->set_class_type_annotations(_type_annotations);
annotations->set_fields_annotations(_fields_annotations);
annotations->set_fields_type_annotations(_fields_type_annotations);
this_klass->set_annotations(annotations);
}
// This is the Annotations object that will be
// assigned to InstanceKlass being constructed.
_combined_annotations = annotations;
// The annotations arrays below has been transfered the
// _combined_annotations so these fields can now be cleared.
_annotations = NULL;
_type_annotations = NULL;
_fields_annotations = NULL;
_fields_type_annotations = NULL;
}
// Transfer ownership of metadata allocated to the InstanceKlass.
void ClassFileParser::apply_parsed_class_metadata(
instanceKlassHandle this_klass,
int java_fields_count, TRAPS) {
_cp->set_pool_holder(this_klass());
this_klass->set_constants(_cp);
this_klass->set_fields(_fields, java_fields_count);
@ -3130,6 +3148,7 @@ void ClassFileParser::apply_parsed_class_metadata(
this_klass->set_inner_classes(_inner_classes);
this_klass->set_local_interfaces(_local_interfaces);
this_klass->set_transitive_interfaces(_transitive_interfaces);
this_klass->set_annotations(_combined_annotations);
// Clear out these fields so they don't get deallocated by the destructor
clear_class_metadata();
@ -4002,6 +4021,10 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
ClassAnnotationCollector parsed_annotations;
parse_classfile_attributes(&parsed_annotations, CHECK_(nullHandle));
// Finalize the Annotations metadata object,
// now that all annotation arrays have been created.
create_combined_annotations(CHECK_(nullHandle));
// Make sure this is the end of class file stream
guarantee_property(cfs->at_eos(), "Extra bytes at the end of class file %s", CHECK_(nullHandle));
@ -4302,10 +4325,27 @@ ClassFileParser::~ClassFileParser() {
InstanceKlass::deallocate_interfaces(_loader_data, _super_klass(),
_local_interfaces, _transitive_interfaces);
MetadataFactory::free_array<u1>(_loader_data, _annotations);
MetadataFactory::free_array<u1>(_loader_data, _type_annotations);
Annotations::free_contents(_loader_data, _fields_annotations);
Annotations::free_contents(_loader_data, _fields_type_annotations);
if (_combined_annotations != NULL) {
// After all annotations arrays have been created, they are installed into the
// Annotations object that will be assigned to the InstanceKlass being created.
// Deallocate the Annotations object and the installed annotations arrays.
_combined_annotations->deallocate_contents(_loader_data);
// If the _combined_annotations pointer is non-NULL,
// then the other annotations fields should have been cleared.
assert(_annotations == NULL, "Should have been cleared");
assert(_type_annotations == NULL, "Should have been cleared");
assert(_fields_annotations == NULL, "Should have been cleared");
assert(_fields_type_annotations == NULL, "Should have been cleared");
} else {
// If the annotations arrays were not installed into the Annotations object,
// then they have to be deallocated explicitly.
MetadataFactory::free_array<u1>(_loader_data, _annotations);
MetadataFactory::free_array<u1>(_loader_data, _type_annotations);
Annotations::free_contents(_loader_data, _fields_annotations);
Annotations::free_contents(_loader_data, _fields_type_annotations);
}
clear_class_metadata();

View File

@ -75,6 +75,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
Array<u2>* _inner_classes;
Array<Klass*>* _local_interfaces;
Array<Klass*>* _transitive_interfaces;
Annotations* _combined_annotations;
AnnotationArray* _annotations;
AnnotationArray* _type_annotations;
Array<AnnotationArray*>* _fields_annotations;
@ -86,6 +87,8 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
void set_class_generic_signature_index(u2 x) { _generic_signature_index = x; }
void set_class_sde_buffer(char* x, int len) { _sde_buffer = x; _sde_length = len; }
void create_combined_annotations(TRAPS);
void init_parsed_class_attributes(ClassLoaderData* loader_data) {
_loader_data = loader_data;
_synthetic_flag = false;
@ -110,6 +113,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
_inner_classes = NULL;
_local_interfaces = NULL;
_transitive_interfaces = NULL;
_combined_annotations = NULL;
_annotations = _type_annotations = NULL;
_fields_annotations = _fields_type_annotations = NULL;
}

View File

@ -28,6 +28,7 @@
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/imageFile.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
@ -68,7 +69,7 @@
#endif
// Entry points in zip.dll for loading zip/jar file entries
// Entry points in zip.dll for loading zip/jar file entries and image file entries
typedef void * * (JNICALL *ZipOpen_t)(const char *name, char **pmsg);
typedef void (JNICALL *ZipClose_t)(jzfile *zip);
@ -76,6 +77,7 @@ typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *siz
typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
typedef jint (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
static ZipOpen_t ZipOpen = NULL;
@ -85,6 +87,7 @@ static ReadEntry_t ReadEntry = NULL;
static ReadMappedEntry_t ReadMappedEntry = NULL;
static GetNextEntry_t GetNextEntry = NULL;
static canonicalize_fn_t CanonicalizeEntry = NULL;
static ZipInflateFully_t ZipInflateFully = NULL;
static Crc32_t Crc32 = NULL;
// Globals
@ -323,6 +326,8 @@ LazyClassPathEntry::~LazyClassPathEntry() {
}
bool LazyClassPathEntry::is_jar_file() {
size_t len = strlen(_path);
if (len < 4 || strcmp(_path + len - 4, ".jar") != 0) return false;
return ((_st.st_mode & S_IFREG) == S_IFREG);
}
@ -386,6 +391,78 @@ u1* LazyClassPathEntry::open_entry(const char* name, jint* filesize, bool nul_te
}
}
ClassPathImageEntry::ClassPathImageEntry(char* name) : ClassPathEntry(), _image(new ImageFile(name)) {
bool opened = _image->open();
if (!opened) {
_image = NULL;
}
}
ClassPathImageEntry::~ClassPathImageEntry() {
if (_image) {
_image->close();
_image = NULL;
}
}
const char* ClassPathImageEntry::name() {
return _image ? _image->name() : "";
}
ClassFileStream* ClassPathImageEntry::open_stream(const char* name, TRAPS) {
u1* buffer;
u8 size;
_image->get_resource(name, buffer, size);
if (buffer) {
if (UsePerfData) {
ClassLoader::perf_sys_classfile_bytes_read()->inc(size);
}
return new ClassFileStream(buffer, (int)size, (char*)name); // Resource allocated
}
return NULL;
}
#ifndef PRODUCT
void ClassPathImageEntry::compile_the_world(Handle loader, TRAPS) {
tty->print_cr("CompileTheWorld : Compiling all classes in %s", name());
tty->cr();
const ImageStrings strings = _image->get_strings();
// Retrieve each path component string.
u4 count = _image->get_location_count();
for (u4 i = 0; i < count; i++) {
u1* location_data = _image->get_location_data(i);
if (location_data) {
ImageLocation location(location_data);
const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
assert((strlen(parent) + strlen(base) + strlen(extension)) < JVM_MAXPATHLEN, "path exceeds buffer");
char path[JVM_MAXPATHLEN];
strcpy(path, parent);
strcat(path, base);
strcat(path, extension);
ClassLoader::compile_the_world_in(path, loader, CHECK);
}
}
if (HAS_PENDING_EXCEPTION) {
if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
CLEAR_PENDING_EXCEPTION;
tty->print_cr("\nCompileTheWorld : Ran out of memory\n");
tty->print_cr("Increase class metadata storage if a limit was set");
} else {
tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n");
}
}
}
bool ClassPathImageEntry::is_jrt() {
return string_ends_with(name(), "bootmodules.jimage");
}
#endif
static void print_meta_index(LazyClassPathEntry* entry,
GrowableArray<char*>& meta_packages) {
tty->print("[Meta index for %s=", entry->name());
@ -635,7 +712,7 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
}
ClassPathEntry* new_entry = NULL;
if ((st->st_mode & S_IFREG) == S_IFREG) {
// Regular file, should be a zip file
// Regular file, should be a zip or image file
// Canonicalized filename
char canonical_path[JVM_MAXPATHLEN];
if (!get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
@ -646,6 +723,11 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
return NULL;
}
}
// TODO - add proper criteria for selecting image file
ClassPathImageEntry* entry = new ClassPathImageEntry(canonical_path);
if (entry->is_open()) {
new_entry = entry;
} else {
char* error_msg = NULL;
jzfile* zip;
{
@ -656,9 +738,6 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
}
if (zip != NULL && error_msg == NULL) {
new_entry = new ClassPathZipEntry(zip, path);
if (TraceClassLoading || TraceClassPaths) {
tty->print_cr("[Opened %s]", path);
}
} else {
ResourceMark rm(thread);
char *msg;
@ -676,10 +755,14 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
return NULL;
}
}
}
if (TraceClassLoading || TraceClassPaths) {
tty->print_cr("[Opened %s]", path);
}
} else {
// Directory
new_entry = new ClassPathDirEntry(path);
if (TraceClassLoading || TraceClassPaths) {
if (TraceClassLoading) {
tty->print_cr("[Path %s]", path);
}
}
@ -802,6 +885,7 @@ void ClassLoader::load_zip_library() {
ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
ZipInflateFully = CAST_TO_FN_PTR(ZipInflateFully_t, os::dll_lookup(handle, "ZIP_InflateFully"));
Crc32 = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
// ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
@ -810,12 +894,20 @@ void ClassLoader::load_zip_library() {
vm_exit_during_initialization("Corrupted ZIP library", path);
}
if (ZipInflateFully == NULL) {
vm_exit_during_initialization("Corrupted ZIP library ZIP_InflateFully missing", path);
}
// Lookup canonicalize entry in libjava.dll
void *javalib_handle = os::native_java_library();
CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, os::dll_lookup(javalib_handle, "Canonicalize"));
// This lookup only works on 1.3. Do not check for non-null here
}
jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {
return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
}
int ClassLoader::crc32(int crc, const char* buf, int len) {
assert(Crc32 != NULL, "ZIP_CRC32 is not found");
return (*Crc32)(crc, (const jbyte*)buf, len);
@ -1368,8 +1460,7 @@ void ClassPathDirEntry::compile_the_world(Handle loader, TRAPS) {
tty->cr();
}
bool ClassPathDirEntry::is_rt_jar() {
bool ClassPathDirEntry::is_jrt() {
return false;
}
@ -1394,13 +1485,13 @@ void ClassPathZipEntry::compile_the_world(Handle loader, TRAPS) {
}
}
bool ClassPathZipEntry::is_rt_jar() {
bool ClassPathZipEntry::is_jrt() {
real_jzfile* zip = (real_jzfile*) _zip;
int len = (int)strlen(zip->name);
// Check whether zip name ends in "rt.jar"
// This will match other archives named rt.jar as well, but this is
// only used for debugging.
return (len >= 6) && (strcasecmp(zip->name + len - 6, "rt.jar") == 0);
return string_ends_with(zip->name, "rt.jar");
}
void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
@ -1410,7 +1501,7 @@ void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
}
}
bool LazyClassPathEntry::is_rt_jar() {
bool LazyClassPathEntry::is_jrt() {
Thread* THREAD = Thread::current();
ClassPathEntry* cpe = resolve_entry(THREAD);
return (cpe != NULL) ? cpe->is_jar_file() : false;
@ -1429,7 +1520,7 @@ void ClassLoader::compile_the_world() {
jlong start = os::javaTimeMillis();
while (e != NULL) {
// We stop at rt.jar, unless it is the first bootstrap path entry
if (e->is_rt_jar() && e != _first_entry) break;
if (e->is_jrt() && e != _first_entry) break;
e->compile_the_world(system_class_loader, CATCH);
e = e->next();
}
@ -1477,9 +1568,9 @@ static bool can_be_compiled(methodHandle m, int comp_level) {
}
void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
int len = (int)strlen(name);
if (len > 6 && strcmp(".class", name + len - 6) == 0) {
if (string_ends_with(name, ".class")) {
// We have a .class file
int len = (int)strlen(name);
char buffer[2048];
strncpy(buffer, name, len - 6);
buffer[len-6] = 0;

View File

@ -67,7 +67,7 @@ class ClassPathEntry: public CHeapObj<mtClass> {
virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0;
// Debugging
NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;)
NOT_PRODUCT(virtual bool is_rt_jar() = 0;)
NOT_PRODUCT(virtual bool is_jrt() = 0;)
};
@ -81,7 +81,7 @@ class ClassPathDirEntry: public ClassPathEntry {
ClassFileStream* open_stream(const char* name, TRAPS);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
NOT_PRODUCT(bool is_rt_jar();)
NOT_PRODUCT(bool is_jrt();)
};
@ -113,7 +113,7 @@ class ClassPathZipEntry: public ClassPathEntry {
void contents_do(void f(const char* name, void* context), void* context);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
NOT_PRODUCT(bool is_rt_jar();)
NOT_PRODUCT(bool is_jrt();)
};
@ -139,7 +139,25 @@ class LazyClassPathEntry: public ClassPathEntry {
virtual bool is_lazy();
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
NOT_PRODUCT(bool is_rt_jar();)
NOT_PRODUCT(bool is_jrt();)
};
// For java image files
class ImageFile;
class ClassPathImageEntry: public ClassPathEntry {
private:
ImageFile *_image;
public:
bool is_jar_file() { return false; }
bool is_open() { return _image != NULL; }
const char* name();
ClassPathImageEntry(char* name);
~ClassPathImageEntry();
ClassFileStream* open_stream(const char* name, TRAPS);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
NOT_PRODUCT(bool is_jrt();)
};
class PackageHashtable;
@ -227,6 +245,7 @@ class ClassLoader: AllStatic {
// to avoid confusing the zip library
static bool get_canonical_path(const char* orig, char* out, int len);
public:
static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
static int crc32(int crc, const char* buf, int len);
static bool update_class_path_entry_list(const char *path,
bool check_for_duplicates,

View File

@ -0,0 +1,286 @@
/*
* Copyright (c) 2014, 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 "classfile/imageFile.hpp"
#include "runtime/os.inline.hpp"
#include "utilities/bytes.hpp"
// Compute the Perfect Hashing hash code for the supplied string.
u4 ImageStrings::hash_code(const char* string, u4 seed) {
u1* bytes = (u1*)string;
// Compute hash code.
for (u1 byte = *bytes++; byte; byte = *bytes++) {
seed = (seed * HASH_MULTIPLIER) ^ byte;
}
// Ensure the result is unsigned.
return seed & 0x7FFFFFFF;
}
// Test to see if string begins with start. If so returns remaining portion
// of string. Otherwise, NULL.
const char* ImageStrings::starts_with(const char* string, const char* start) {
char ch1, ch2;
// Match up the strings the best we can.
while ((ch1 = *string) && (ch2 = *start)) {
if (ch1 != ch2) {
// Mismatch, return NULL.
return NULL;
}
string++, start++;
}
// Return remainder of string.
return string;
}
ImageLocation::ImageLocation(u1* data) {
// Deflate the attribute stream into an array of attributes.
memset(_attributes, 0, sizeof(_attributes));
u1 byte;
while ((byte = *data) != ATTRIBUTE_END) {
u1 kind = attribute_kind(byte);
u1 n = attribute_length(byte);
assert(kind < ATTRIBUTE_COUNT, "invalid image location attribute");
_attributes[kind] = attribute_value(data + 1, n);
data += n + 1;
}
}
ImageFile::ImageFile(const char* name) {
// Copy the image file name.
_name = NEW_C_HEAP_ARRAY(char, strlen(name)+1, mtClass);
strcpy(_name, name);
// Initialize for a closed file.
_fd = -1;
_memory_mapped = true;
_index_data = NULL;
}
ImageFile::~ImageFile() {
// Ensure file is closed.
close();
// Free up name.
FREE_C_HEAP_ARRAY(char, _name);
}
bool ImageFile::open() {
// If file exists open for reading.
struct stat st;
if (os::stat(_name, &st) != 0 ||
(st.st_mode & S_IFREG) != S_IFREG ||
(_fd = os::open(_name, 0, O_RDONLY)) == -1) {
return false;
}
// Read image file header and verify.
u8 header_size = sizeof(ImageHeader);
if (os::read(_fd, &_header, header_size) != header_size ||
_header._magic != IMAGE_MAGIC ||
_header._major_version != MAJOR_VERSION ||
_header._minor_version != MINOR_VERSION) {
close();
return false;
}
// Memory map index.
_index_size = index_size();
_index_data = (u1*)os::map_memory(_fd, _name, 0, NULL, _index_size, true, false);
// Failing that, read index into C memory.
if (_index_data == NULL) {
_memory_mapped = false;
_index_data = NEW_RESOURCE_ARRAY(u1, _index_size);
if (os::seek_to_file_offset(_fd, 0) == -1) {
close();
return false;
}
if (os::read(_fd, _index_data, _index_size) != _index_size) {
close();
return false;
}
return true;
}
// Used to advance a pointer, unstructured.
#undef nextPtr
#define nextPtr(base, fromType, count, toType) (toType*)((fromType*)(base) + (count))
// Pull tables out from the index.
_redirect_table = nextPtr(_index_data, u1, header_size, s4);
_offsets_table = nextPtr(_redirect_table, s4, _header._location_count, u4);
_location_bytes = nextPtr(_offsets_table, u4, _header._location_count, u1);
_string_bytes = nextPtr(_location_bytes, u1, _header._locations_size, u1);
#undef nextPtr
// Successful open.
return true;
}
void ImageFile::close() {
// Dealllocate the index.
if (_index_data) {
if (_memory_mapped) {
os::unmap_memory((char*)_index_data, _index_size);
} else {
FREE_RESOURCE_ARRAY(u1, _index_data, _index_size);
}
_index_data = NULL;
}
// close file.
if (_fd != -1) {
os::close(_fd);
_fd = -1;
}
}
// Return the attribute stream for a named resourced.
u1* ImageFile::find_location_data(const char* path) const {
// Compute hash.
u4 hash = ImageStrings::hash_code(path) % _header._location_count;
s4 redirect = _redirect_table[hash];
if (!redirect) {
return NULL;
}
u4 index;
if (redirect < 0) {
// If no collision.
index = -redirect - 1;
} else {
// If collision, recompute hash code.
index = ImageStrings::hash_code(path, redirect) % _header._location_count;
}
assert(index < _header._location_count, "index exceeds location count");
u4 offset = _offsets_table[index];
assert(offset < _header._locations_size, "offset exceeds location attributes size");
if (offset == 0) {
return NULL;
}
return _location_bytes + offset;
}
// Verify that a found location matches the supplied path.
bool ImageFile::verify_location(ImageLocation& location, const char* path) const {
// Retrieve each path component string.
ImageStrings strings(_string_bytes, _header._strings_size);
// Match a path with each subcomponent without concatenation (copy).
// Match up path parent.
const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
const char* next = ImageStrings::starts_with(path, parent);
// Continue only if a complete match.
if (!next) return false;
// Match up path base.
const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
next = ImageStrings::starts_with(next, base);
// Continue only if a complete match.
if (!next) return false;
// Match up path extension.
const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
next = ImageStrings::starts_with(next, extension);
// True only if complete match and no more characters.
return next && *next == '\0';
}
// Return the resource for the supplied location.
u1* ImageFile::get_resource(ImageLocation& location) const {
// Retrieve the byte offset and size of the resource.
u8 offset = _index_size + location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
u8 size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
u8 read_size = compressed_size ? compressed_size : size;
// Allocate space for the resource.
u1* data = NEW_RESOURCE_ARRAY(u1, read_size);
bool is_read = os::read_at(_fd, data, read_size, offset) == read_size;
guarantee(is_read, "error reading from image or short read");
// If not compressed, just return the data.
if (!compressed_size) {
return data;
}
u1* uncompressed = NEW_RESOURCE_ARRAY(u1, size);
char* msg = NULL;
jboolean res = ClassLoader::decompress(data, compressed_size, uncompressed, size, &msg);
if (!res) warning("decompression failed due to %s\n", msg);
guarantee(res, "decompression failed");
return uncompressed;
}
void ImageFile::get_resource(const char* path, u1*& buffer, u8& size) const {
buffer = NULL;
size = 0;
u1* data = find_location_data(path);
if (data) {
ImageLocation location(data);
if (verify_location(location, path)) {
size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
buffer = get_resource(location);
}
}
}
GrowableArray<const char*>* ImageFile::packages(const char* name) {
char entry[JVM_MAXPATHLEN];
bool overflow = jio_snprintf(entry, sizeof(entry), "%s/packages.offsets", name) == -1;
guarantee(!overflow, "package name overflow");
u1* buffer;
u8 size;
get_resource(entry, buffer, size);
guarantee(buffer, "missing module packages reource");
ImageStrings strings(_string_bytes, _header._strings_size);
GrowableArray<const char*>* pkgs = new GrowableArray<const char*>();
int count = size / 4;
for (int i = 0; i < count; i++) {
u4 offset = Bytes::get_Java_u4(buffer + (i*4));
const char* p = strings.get(offset);
pkgs->append(p);
}
return pkgs;
}

View File

@ -0,0 +1,343 @@
/*
* Copyright (c) 2014, 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_CLASSFILE_IMAGEFILE_HPP
#define SHARE_VM_CLASSFILE_IMAGEFILE_HPP
#include "classfile/classLoader.hpp"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "utilities/globalDefinitions.hpp"
// Image files are an alternate file format for storing classes and resources. The
// goal is to supply file access which is faster and smaller that the jar format.
// It should be noted that unlike jars information stored in an image is in native
// endian format. This allows the image to be memory mapped into memory without
// endian translation. This also means that images are platform dependent.
//
// Image files are structured as three sections;
//
// +-----------+
// | Header |
// +-----------+
// | |
// | Directory |
// | |
// +-----------+
// | |
// | |
// | Resources |
// | |
// | |
// +-----------+
//
// The header contains information related to identification and description of
// contents.
//
// +-------------------------+
// | Magic (0xCAFEDADA) |
// +------------+------------+
// | Major Vers | Minor Vers |
// +------------+------------+
// | Location Count |
// +-------------------------+
// | Attributes Size |
// +-------------------------+
// | Strings Size |
// +-------------------------+
//
// Magic - means of identifying validity of the file. This avoids requiring a
// special file extension.
// Major vers, minor vers - differences in version numbers indicate structural
// changes in the image.
// Location count - number of locations/resources in the file. This count is also
// the length of lookup tables used in the directory.
// Attributes size - number of bytes in the region used to store location attribute
// streams.
// Strings size - the size of the region used to store strings used by the
// directory and meta data.
//
// The directory contains information related to resource lookup. The algorithm
// used for lookup is "A Practical Minimal Perfect Hashing Method"
// (http://homepages.dcc.ufmg.br/~nivio/papers/wea05.pdf). Given a path string
// in the form <package>/<base>.<extension> return the resource location
// information;
//
// redirectIndex = hash(path, DEFAULT_SEED) % count;
// redirect = redirectTable[redirectIndex];
// if (redirect == 0) return not found;
// locationIndex = redirect < 0 ? -1 - redirect : hash(path, redirect) % count;
// location = locationTable[locationIndex];
// if (!verify(location, path)) return not found;
// return location;
//
// Note: The hash function takes an initial seed value. A different seed value
// usually returns a different result for strings that would otherwise collide with
// other seeds. The verify function guarantees the found resource location is
// indeed the resource we are looking for.
//
// The following is the format of the directory;
//
// +-------------------+
// | Redirect Table |
// +-------------------+
// | Attribute Offsets |
// +-------------------+
// | Attribute Data |
// +-------------------+
// | Strings |
// +-------------------+
//
// Redirect Table - Array of 32-bit signed values representing actions that
// should take place for hashed strings that map to that
// value. Negative values indicate no hash collision and can be
// quickly converted to indices into attribute offsets. Positive
// values represent a new seed for hashing an index into attribute
// offsets. Zero indicates not found.
// Attribute Offsets - Array of 32-bit unsigned values representing offsets into
// attribute data. Attribute offsets can be iterated to do a
// full survey of resources in the image.
// Attribute Data - Bytes representing compact attribute data for locations. (See
// comments in ImageLocation.)
// Strings - Collection of zero terminated UTF-8 strings used by the directory and
// image meta data. Each string is accessed by offset. Each string is
// unique. Offset zero is reserved for the empty string.
//
// Note that the memory mapped directory assumes 32 bit alignment of the image
// header, the redirect table and the attribute offsets.
//
// Manage image file string table.
class ImageStrings {
private:
// Data bytes for strings.
u1* _data;
// Number of bytes in the string table.
u4 _size;
public:
// Prime used to generate hash for Perfect Hashing.
static const u4 HASH_MULTIPLIER = 0x01000193;
ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
// Return the UTF-8 string beginning at offset.
inline const char* get(u4 offset) const {
assert(offset < _size, "offset exceeds string table size");
return (const char*)(_data + offset);
}
// Compute the Perfect Hashing hash code for the supplied string.
inline static u4 hash_code(const char* string) {
return hash_code(string, HASH_MULTIPLIER);
}
// Compute the Perfect Hashing hash code for the supplied string, starting at seed.
static u4 hash_code(const char* string, u4 seed);
// Test to see if string begins with start. If so returns remaining portion
// of string. Otherwise, NULL. Used to test sections of a path without
// copying.
static const char* starts_with(const char* string, const char* start);
};
// Manage image file location attribute streams. Within an image, a location's
// attributes are compressed into a stream of bytes. An attribute stream is
// composed of individual attribute sequences. Each attribute sequence begins with
// a header byte containing the attribute 'kind' (upper 5 bits of header) and the
// 'length' less 1 (lower 3 bits of header) of bytes that follow containing the
// attribute value. Attribute values present as most significant byte first.
//
// Ex. Container offset (ATTRIBUTE_OFFSET) 0x33562 would be represented as 0x22
// (kind = 4, length = 3), 0x03, 0x35, 0x62.
//
// An attribute stream is terminated with a header kind of ATTRIBUTE_END (header
// byte of zero.)
//
// ImageLocation inflates the stream into individual values stored in the long
// array _attributes. This allows an attribute value can be quickly accessed by
// direct indexing. Unspecified values default to zero.
//
// Notes:
// - Even though ATTRIBUTE_END is used to mark the end of the attribute stream,
// streams will contain zero byte values to represent lesser significant bits.
// Thus, detecting a zero byte is not sufficient to detect the end of an attribute
// stream.
// - ATTRIBUTE_OFFSET represents the number of bytes from the beginning of the region
// storing the resources. Thus, in an image this represents the number of bytes
// after the directory.
// - Currently, compressed resources are represented by having a non-zero
// ATTRIBUTE_COMPRESSED value. This represents the number of bytes stored in the
// image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
// inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
// of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
// in memory. In the future, additional compression techniques will be used and
// represented differently.
// - Package strings include trailing slash and extensions include prefix period.
//
class ImageLocation {
public:
// Attribute kind enumeration.
static const u1 ATTRIBUTE_END = 0; // End of attribute stream marker
static const u1 ATTRIBUTE_BASE = 1; // String table offset of resource path base
static const u1 ATTRIBUTE_PARENT = 2; // String table offset of resource path parent
static const u1 ATTRIBUTE_EXTENSION = 3; // String table offset of resource path extension
static const u1 ATTRIBUTE_OFFSET = 4; // Container byte offset of resource
static const u1 ATTRIBUTE_COMPRESSED = 5; // In image byte size of the compressed resource
static const u1 ATTRIBUTE_UNCOMPRESSED = 6; // In memory byte size of the uncompressed resource
static const u1 ATTRIBUTE_COUNT = 7; // Number of attribute kinds
private:
// Values of inflated attributes.
u8 _attributes[ATTRIBUTE_COUNT];
// Return the attribute value number of bytes.
inline static u1 attribute_length(u1 data) {
return (data & 0x7) + 1;
}
// Return the attribute kind.
inline static u1 attribute_kind(u1 data) {
u1 kind = data >> 3;
assert(kind < ATTRIBUTE_COUNT, "invalid attribute kind");
return kind;
}
// Return the attribute length.
inline static u8 attribute_value(u1* data, u1 n) {
assert(0 < n && n <= 8, "invalid attribute value length");
u8 value = 0;
// Most significant bytes first.
for (u1 i = 0; i < n; i++) {
value <<= 8;
value |= data[i];
}
return value;
}
public:
ImageLocation(u1* data);
// Retrieve an attribute value from the inflated array.
inline u8 get_attribute(u1 kind) const {
assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT, "invalid attribute kind");
return _attributes[kind];
}
// Retrieve an attribute string value from the inflated array.
inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
return strings.get((u4)get_attribute(kind));
}
};
// Manage the image file.
class ImageFile: public CHeapObj<mtClass> {
private:
// Image file marker.
static const u4 IMAGE_MAGIC = 0xCAFEDADA;
// Image file major version number.
static const u2 MAJOR_VERSION = 0;
// Image file minor version number.
static const u2 MINOR_VERSION = 1;
struct ImageHeader {
u4 _magic; // Image file marker
u2 _major_version; // Image file major version number
u2 _minor_version; // Image file minor version number
u4 _location_count; // Number of locations managed in index.
u4 _locations_size; // Number of bytes in attribute table.
u4 _strings_size; // Number of bytes in string table.
};
char* _name; // Name of image
int _fd; // File descriptor
bool _memory_mapped; // Is file memory mapped
ImageHeader _header; // Image header
u8 _index_size; // Total size of index
u1* _index_data; // Raw index data
s4* _redirect_table; // Perfect hash redirect table
u4* _offsets_table; // Location offset table
u1* _location_bytes; // Location attributes
u1* _string_bytes; // String table
// Compute number of bytes in image file index.
inline u8 index_size() {
return sizeof(ImageHeader) +
_header._location_count * sizeof(u4) * 2 +
_header._locations_size +
_header._strings_size;
}
public:
ImageFile(const char* name);
~ImageFile();
// Open image file for access.
bool open();
// Close image file.
void close();
// Retrieve name of image file.
inline const char* name() const {
return _name;
}
// Return a string table accessor.
inline const ImageStrings get_strings() const {
return ImageStrings(_string_bytes, _header._strings_size);
}
// Return number of locations in image file index.
inline u4 get_location_count() const {
return _header._location_count;
}
// Return location attribute stream for location i.
inline u1* get_location_data(u4 i) const {
u4 offset = _offsets_table[i];
return offset != 0 ? _location_bytes + offset : NULL;
}
// Return the attribute stream for a named resourced.
u1* find_location_data(const char* path) const;
// Verify that a found location matches the supplied path.
bool verify_location(ImageLocation& location, const char* path) const;
// Return the resource for the supplied location info.
u1* get_resource(ImageLocation& location) const;
// Return the resource associated with the path else NULL if not found.
void get_resource(const char* path, u1*& buffer, u8& size) const;
// Return an array of packages for a given module
GrowableArray<const char*>* packages(const char* name);
};
#endif // SHARE_VM_CLASSFILE_IMAGEFILE_HPP

View File

@ -110,7 +110,7 @@ bool SharedPathsMiscInfo::check() {
bool SharedPathsMiscInfo::check(jint type, const char* path) {
switch (type) {
case BOOT:
if (strcmp(path, Arguments::get_sysclasspath()) != 0) {
if (os::file_name_strcmp(path, Arguments::get_sysclasspath()) != 0) {
return fail("[BOOT classpath mismatch, actual: -Dsun.boot.class.path=", Arguments::get_sysclasspath());
}
break;

View File

@ -793,11 +793,6 @@ void ConcurrentMarkSweepGeneration::promotion_failure_occurred() {
}
}
CompactibleSpace*
ConcurrentMarkSweepGeneration::first_compaction_space() const {
return _cmsSpace;
}
void ConcurrentMarkSweepGeneration::reset_after_compaction() {
// Clear the promotion information. These pointers can be adjusted
// along with all the other pointers into the heap but
@ -808,10 +803,6 @@ void ConcurrentMarkSweepGeneration::reset_after_compaction() {
}
}
void ConcurrentMarkSweepGeneration::space_iterate(SpaceClosure* blk, bool usedOnly) {
blk->do_space(_cmsSpace);
}
void ConcurrentMarkSweepGeneration::compute_new_size() {
assert_locked_or_safepoint(Heap_lock);
@ -882,7 +873,7 @@ void ConcurrentMarkSweepGeneration::compute_new_size_free_list() {
expand_bytes);
}
// safe if expansion fails
expand(expand_bytes, 0, CMSExpansionCause::_satisfy_free_ratio);
expand_for_gc_cause(expand_bytes, 0, CMSExpansionCause::_satisfy_free_ratio);
if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr(" Expanded free fraction %f",
((double) free()) / capacity());
@ -1048,8 +1039,7 @@ oop ConcurrentMarkSweepGeneration::promote(oop obj, size_t obj_size) {
if (res == NULL) {
// expand and retry
size_t s = _cmsSpace->expansionSpaceRequired(obj_size); // HeapWords
expand(s*HeapWordSize, MinHeapDeltaBytes,
CMSExpansionCause::_satisfy_promotion);
expand_for_gc_cause(s*HeapWordSize, MinHeapDeltaBytes, CMSExpansionCause::_satisfy_promotion);
// Since there's currently no next generation, we don't try to promote
// into a more senior generation.
assert(next_gen() == NULL, "assumption, based upon which no attempt "
@ -2624,13 +2614,6 @@ oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl) { \
ALL_SINCE_SAVE_MARKS_CLOSURES(CMS_SINCE_SAVE_MARKS_DEFN)
void
ConcurrentMarkSweepGeneration::younger_refs_iterate(OopsInGenClosure* cl) {
cl->set_generation(this);
younger_refs_in_space_iterate(_cmsSpace, cl);
cl->reset_generation();
}
void
ConcurrentMarkSweepGeneration::oop_iterate(ExtendedOopClosure* cl) {
if (freelistLock()->owned_by_self()) {
@ -2803,23 +2786,17 @@ ConcurrentMarkSweepGeneration::expand_and_allocate(size_t word_size,
CMSSynchronousYieldRequest yr;
assert(!tlab, "Can't deal with TLAB allocation");
MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
expand(word_size*HeapWordSize, MinHeapDeltaBytes,
CMSExpansionCause::_satisfy_allocation);
expand_for_gc_cause(word_size*HeapWordSize, MinHeapDeltaBytes, CMSExpansionCause::_satisfy_allocation);
if (GCExpandToAllocateDelayMillis > 0) {
os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
}
return have_lock_and_allocate(word_size, tlab);
}
// YSR: All of this generation expansion/shrinking stuff is an exact copy of
// TenuredGeneration, which makes me wonder if we should move this
// to CardGeneration and share it...
bool ConcurrentMarkSweepGeneration::expand(size_t bytes, size_t expand_bytes) {
return CardGeneration::expand(bytes, expand_bytes);
}
void ConcurrentMarkSweepGeneration::expand(size_t bytes, size_t expand_bytes,
CMSExpansionCause::Cause cause)
void ConcurrentMarkSweepGeneration::expand_for_gc_cause(
size_t bytes,
size_t expand_bytes,
CMSExpansionCause::Cause cause)
{
bool success = expand(bytes, expand_bytes);
@ -2848,8 +2825,7 @@ HeapWord* ConcurrentMarkSweepGeneration::expand_and_par_lab_allocate(CMSParGCThr
return NULL;
}
// Otherwise, we try expansion.
expand(word_sz*HeapWordSize, MinHeapDeltaBytes,
CMSExpansionCause::_allocate_par_lab);
expand_for_gc_cause(word_sz*HeapWordSize, MinHeapDeltaBytes, CMSExpansionCause::_allocate_par_lab);
// Now go around the loop and try alloc again;
// A competing par_promote might beat us to the expansion space,
// so we may go around the loop again if promotion fails again.
@ -2876,8 +2852,7 @@ bool ConcurrentMarkSweepGeneration::expand_and_ensure_spooling_space(
return false;
}
// Otherwise, we try expansion.
expand(refill_size_bytes, MinHeapDeltaBytes,
CMSExpansionCause::_allocate_par_spooling_space);
expand_for_gc_cause(refill_size_bytes, MinHeapDeltaBytes, CMSExpansionCause::_allocate_par_spooling_space);
// Now go around the loop and try alloc again;
// A competing allocation might beat us to the expansion space,
// so we may go around the loop again if allocation fails again.
@ -2887,77 +2862,16 @@ bool ConcurrentMarkSweepGeneration::expand_and_ensure_spooling_space(
}
}
void ConcurrentMarkSweepGeneration::shrink_by(size_t bytes) {
assert_locked_or_safepoint(ExpandHeap_lock);
// Shrink committed space
_virtual_space.shrink_by(bytes);
// Shrink space; this also shrinks the space's BOT
_cmsSpace->set_end((HeapWord*) _virtual_space.high());
size_t new_word_size = heap_word_size(_cmsSpace->capacity());
// Shrink the shared block offset array
_bts->resize(new_word_size);
MemRegion mr(_cmsSpace->bottom(), new_word_size);
// Shrink the card table
Universe::heap()->barrier_set()->resize_covered_region(mr);
if (Verbose && PrintGC) {
size_t new_mem_size = _virtual_space.committed_size();
size_t old_mem_size = new_mem_size + bytes;
gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
name(), old_mem_size/K, new_mem_size/K);
}
}
void ConcurrentMarkSweepGeneration::shrink(size_t bytes) {
assert_locked_or_safepoint(Heap_lock);
size_t size = ReservedSpace::page_align_size_down(bytes);
// Only shrink if a compaction was done so that all the free space
// in the generation is in a contiguous block at the end.
if (size > 0 && did_compact()) {
shrink_by(size);
if (did_compact()) {
CardGeneration::shrink(bytes);
}
}
bool ConcurrentMarkSweepGeneration::grow_by(size_t bytes) {
void ConcurrentMarkSweepGeneration::assert_correct_size_change_locking() {
assert_locked_or_safepoint(Heap_lock);
bool result = _virtual_space.expand_by(bytes);
if (result) {
size_t new_word_size =
heap_word_size(_virtual_space.committed_size());
MemRegion mr(_cmsSpace->bottom(), new_word_size);
_bts->resize(new_word_size); // resize the block offset shared array
Universe::heap()->barrier_set()->resize_covered_region(mr);
// Hmmmm... why doesn't CFLS::set_end verify locking?
// This is quite ugly; FIX ME XXX
_cmsSpace->assert_locked(freelistLock());
_cmsSpace->set_end((HeapWord*)_virtual_space.high());
// update the space and generation capacity counters
if (UsePerfData) {
_space_counters->update_capacity();
_gen_counters->update_all();
}
if (Verbose && PrintGC) {
size_t new_mem_size = _virtual_space.committed_size();
size_t old_mem_size = new_mem_size - bytes;
gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K",
name(), old_mem_size/K, bytes/K, new_mem_size/K);
}
}
return result;
}
bool ConcurrentMarkSweepGeneration::grow_to_reserved() {
assert_locked_or_safepoint(Heap_lock);
bool success = true;
const size_t remaining_bytes = _virtual_space.uncommitted_size();
if (remaining_bytes > 0) {
success = grow_by(remaining_bytes);
DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
}
return success;
}
void ConcurrentMarkSweepGeneration::shrink_free_list_by(size_t bytes) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2014, 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
@ -30,9 +30,10 @@
#include "gc_implementation/shared/gcStats.hpp"
#include "gc_implementation/shared/gcWhen.hpp"
#include "gc_implementation/shared/generationCounters.hpp"
#include "memory/cardGeneration.hpp"
#include "memory/freeBlockDictionary.hpp"
#include "memory/generation.hpp"
#include "memory/iterator.hpp"
#include "memory/space.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/virtualspace.hpp"
#include "services/memoryService.hpp"
@ -171,9 +172,7 @@ class CMSBitMap VALUE_OBJ_CLASS_SPEC {
// Represents a marking stack used by the CMS collector.
// Ideally this should be GrowableArray<> just like MSC's marking stack(s).
class CMSMarkStack: public CHeapObj<mtGC> {
//
friend class CMSCollector; // To get at expansion stats further below.
//
VirtualSpace _virtual_space; // Space for the stack
oop* _base; // Bottom of stack
@ -1031,6 +1030,9 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
void set_expansion_cause(CMSExpansionCause::Cause v) { _expansion_cause = v;}
CMSExpansionCause::Cause expansion_cause() const { return _expansion_cause; }
// Accessing spaces
CompactibleSpace* space() const { return (CompactibleSpace*)_cmsSpace; }
private:
// For parallel young-gen GC support.
CMSParGCThreadState** _par_gc_thread_states;
@ -1064,6 +1066,10 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
double initiating_occupancy() const { return _initiating_occupancy; }
void init_initiating_occupancy(intx io, uintx tr);
void expand_for_gc_cause(size_t bytes, size_t expand_bytes, CMSExpansionCause::Cause cause);
void assert_correct_size_change_locking();
public:
ConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size,
int level, CardTableRS* ct,
@ -1100,23 +1106,14 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
// Override
virtual void ref_processor_init();
// Grow generation by specified size (returns false if unable to grow)
bool grow_by(size_t bytes);
// Grow generation to reserved size.
bool grow_to_reserved();
void clear_expansion_cause() { _expansion_cause = CMSExpansionCause::_no_expansion; }
// Space enquiries
size_t capacity() const;
size_t used() const;
size_t free() const;
double occupancy() const { return ((double)used())/((double)capacity()); }
size_t contiguous_available() const;
size_t unsafe_max_alloc_nogc() const;
// over-rides
MemRegion used_region() const;
MemRegion used_region_at_save_marks() const;
// Does a "full" (forced) collection invoked on this generation collect
@ -1127,10 +1124,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
return !ScavengeBeforeFullGC;
}
void space_iterate(SpaceClosure* blk, bool usedOnly = false);
// Support for compaction
CompactibleSpace* first_compaction_space() const;
// Adjust quantities in the generation affected by
// the compaction.
void reset_after_compaction();
@ -1190,18 +1183,13 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
}
// Allocation failure
void expand(size_t bytes, size_t expand_bytes,
CMSExpansionCause::Cause cause);
virtual bool expand(size_t bytes, size_t expand_bytes);
void shrink(size_t bytes);
void shrink_by(size_t bytes);
HeapWord* expand_and_par_lab_allocate(CMSParGCThreadState* ps, size_t word_sz);
bool expand_and_ensure_spooling_space(PromotionInfo* promo);
// Iteration support and related enquiries
void save_marks();
bool no_allocs_since_save_marks();
void younger_refs_iterate(OopsInGenClosure* cl);
// Iteration support specific to CMS generations
void save_sweep_limit();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2014, 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
@ -369,22 +369,6 @@ inline void ConcurrentMarkSweepGeneration::save_sweep_limit() {
cmsSpace()->save_sweep_limit();
}
inline size_t ConcurrentMarkSweepGeneration::capacity() const {
return _cmsSpace->capacity();
}
inline size_t ConcurrentMarkSweepGeneration::used() const {
return _cmsSpace->used();
}
inline size_t ConcurrentMarkSweepGeneration::free() const {
return _cmsSpace->free();
}
inline MemRegion ConcurrentMarkSweepGeneration::used_region() const {
return _cmsSpace->used_region();
}
inline MemRegion ConcurrentMarkSweepGeneration::used_region_at_save_marks() const {
return _cmsSpace->used_region_at_save_marks();
}

View File

@ -352,7 +352,7 @@ void YoungList::print() {
}
void G1RegionMappingChangedListener::reset_from_card_cache(uint start_idx, size_t num_regions) {
OtherRegionsTable::invalidate(start_idx, num_regions);
HeapRegionRemSet::invalidate_from_card_cache(start_idx, num_regions);
}
void G1RegionMappingChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) {

View File

@ -407,20 +407,8 @@ void FromCardCache::clear(uint region_idx) {
}
}
void OtherRegionsTable::initialize(uint max_regions) {
FromCardCache::initialize(HeapRegionRemSet::num_par_rem_sets(), max_regions);
}
void OtherRegionsTable::invalidate(uint start_idx, size_t num_regions) {
FromCardCache::invalidate(start_idx, num_regions);
}
void OtherRegionsTable::print_from_card_cache() {
FromCardCache::print();
}
void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) {
uint cur_hrm_ind = hr()->hrm_index();
uint cur_hrm_ind = _hr->hrm_index();
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
@ -434,7 +422,7 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr("Table for [" PTR_FORMAT "...): card %d (cache = %d)",
hr()->bottom(), from_card,
_hr->bottom(), from_card,
FromCardCache::at(tid, cur_hrm_ind));
}
@ -477,13 +465,13 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) {
if (G1HRRSUseSparseTable &&
_sparse_table.add_card(from_hrm_ind, card_index)) {
if (G1RecordHRRSOops) {
HeapRegionRemSet::record(hr(), from);
HeapRegionRemSet::record(_hr, from);
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print(" Added card " PTR_FORMAT " to region "
"[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n",
align_size_down(uintptr_t(from),
CardTableModRefBS::card_size),
hr()->bottom(), from);
_hr->bottom(), from);
}
}
if (G1TraceHeapRegionRememberedSet) {
@ -539,13 +527,13 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) {
prt->add_reference(from);
if (G1RecordHRRSOops) {
HeapRegionRemSet::record(hr(), from);
HeapRegionRemSet::record(_hr, from);
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print("Added card " PTR_FORMAT " to region "
"[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n",
align_size_down(uintptr_t(from),
CardTableModRefBS::card_size),
hr()->bottom(), from);
_hr->bottom(), from);
}
}
assert(contains_reference(from), "We just added it!");
@ -614,7 +602,7 @@ PerRegionTable* OtherRegionsTable::delete_region_table() {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] "
"for region [" PTR_FORMAT "...] (" SIZE_FORMAT " coarse entries).\n",
hr()->bottom(),
_hr->bottom(),
max->hr()->bottom(),
_n_coarse_entries);
}
@ -627,13 +615,11 @@ PerRegionTable* OtherRegionsTable::delete_region_table() {
return max;
}
// At present, this must be called stop-world single-threaded.
void OtherRegionsTable::scrub(CardTableModRefBS* ctbs,
BitMap* region_bm, BitMap* card_bm) {
// First eliminated garbage regions from the coarse map.
if (G1RSScrubVerbose) {
gclog_or_tty->print_cr("Scrubbing region %u:", hr()->hrm_index());
gclog_or_tty->print_cr("Scrubbing region %u:", _hr->hrm_index());
}
assert(_coarse_map.size() == region_bm->size(), "Precondition");
@ -752,7 +738,7 @@ size_t OtherRegionsTable::fl_mem_size() {
}
void OtherRegionsTable::clear_fcc() {
FromCardCache::clear(hr()->hrm_index());
FromCardCache::clear(_hr->hrm_index());
}
void OtherRegionsTable::clear() {
@ -774,27 +760,6 @@ void OtherRegionsTable::clear() {
clear_fcc();
}
bool OtherRegionsTable::del_single_region_table(size_t ind,
HeapRegion* hr) {
assert(0 <= ind && ind < _max_fine_entries, "Preconditions.");
PerRegionTable** prev_addr = &_fine_grain_regions[ind];
PerRegionTable* prt = *prev_addr;
while (prt != NULL && prt->hr() != hr) {
prev_addr = prt->collision_list_next_addr();
prt = prt->collision_list_next();
}
if (prt != NULL) {
assert(prt->hr() == hr, "Loop postcondition.");
*prev_addr = prt->collision_list_next();
unlink_from_all(prt);
PerRegionTable::free(prt);
_n_fine_entries--;
return true;
} else {
return false;
}
}
bool OtherRegionsTable::contains_reference(OopOrNarrowOopStar from) const {
// Cast away const in this case.
MutexLockerEx x((Mutex*)_m, Mutex::_no_safepoint_check_flag);
@ -975,7 +940,7 @@ HeapRegionRemSetIterator:: HeapRegionRemSetIterator(HeapRegionRemSet* hrrs) :
_hrrs(hrrs),
_g1h(G1CollectedHeap::heap()),
_coarse_map(&hrrs->_other_regions._coarse_map),
_bosa(hrrs->bosa()),
_bosa(hrrs->_bosa),
_is(Sparse),
// Set these values so that we increment to the first region.
_coarse_cur_region_index(-1),

View File

@ -162,32 +162,36 @@ class OtherRegionsTable VALUE_OBJ_CLASS_SPEC {
// to hold _m, and the fine-grain table to be full.
PerRegionTable* delete_region_table();
// If a PRT for "hr" is in the bucket list indicated by "ind" (which must
// be the correct index for "hr"), delete it and return true; else return
// false.
bool del_single_region_table(size_t ind, HeapRegion* hr);
// link/add the given fine grain remembered set into the "all" list
void link_to_all(PerRegionTable * prt);
// unlink/remove the given fine grain remembered set into the "all" list
void unlink_from_all(PerRegionTable * prt);
public:
OtherRegionsTable(HeapRegion* hr, Mutex* m);
bool contains_reference_locked(OopOrNarrowOopStar from) const;
HeapRegion* hr() const { return _hr; }
// Clear the from_card_cache entries for this region.
void clear_fcc();
public:
// Create a new remembered set for the given heap region. The given mutex should
// be used to ensure consistency.
OtherRegionsTable(HeapRegion* hr, Mutex* m);
// For now. Could "expand" some tables in the future, so that this made
// sense.
void add_reference(OopOrNarrowOopStar from, uint tid);
// Returns whether the remembered set contains the given reference.
bool contains_reference(OopOrNarrowOopStar from) const;
// Removes any entries shown by the given bitmaps to contain only dead
// objects.
// objects. Not thread safe.
// Set bits in the bitmaps indicate that the given region or card is live.
void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm);
// Returns whether this remembered set (and all sub-sets) contain no entries.
// Returns whether this remembered set (and all sub-sets) does not contain any entry.
bool is_empty() const;
// Returns the number of cards contained in this remembered set.
size_t occupied() const;
size_t occ_fine() const;
size_t occ_coarse() const;
@ -195,31 +199,17 @@ public:
static jint n_coarsenings() { return _n_coarsenings; }
// Returns size in bytes.
// Not const because it takes a lock.
// Returns size of the actual remembered set containers in bytes.
size_t mem_size() const;
// Returns the size of static data in bytes.
static size_t static_mem_size();
// Returns the size of the free list content in bytes.
static size_t fl_mem_size();
bool contains_reference(OopOrNarrowOopStar from) const;
bool contains_reference_locked(OopOrNarrowOopStar from) const;
// Clear the entire contents of this remembered set.
void clear();
// Specifically clear the from_card_cache.
void clear_fcc();
void do_cleanup_work(HRRSCleanupTask* hrrs_cleanup_task);
// Declare the heap size (in # of regions) to the OtherRegionsTable.
// (Uses it to initialize from_card_cache).
static void initialize(uint max_regions);
// Declares that regions between start_idx <= i < start_idx + num_regions are
// not in use. Make sure that any entries for these regions are invalid.
static void invalidate(uint start_idx, size_t num_regions);
static void print_from_card_cache();
};
class HeapRegionRemSet : public CHeapObj<mtGC> {
@ -233,7 +223,6 @@ public:
private:
G1BlockOffsetSharedArray* _bosa;
G1BlockOffsetSharedArray* bosa() const { return _bosa; }
// A set of code blobs (nmethods) whose code contains pointers into
// the region that owns this RSet.
@ -268,10 +257,6 @@ public:
static uint num_par_rem_sets();
static void setup_remset_size();
HeapRegion* hr() const {
return _other_regions.hr();
}
bool is_empty() const {
return (strong_code_roots_list_length() == 0) && _other_regions.is_empty();
}
@ -305,8 +290,9 @@ public:
_other_regions.add_reference(from, tid);
}
// Removes any entries shown by the given bitmaps to contain only dead
// objects.
// Removes any entries in the remembered set shown by the given bitmaps to
// contain only dead objects. Not thread safe.
// One bits in the bitmaps indicate that the given region or card is live.
void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm);
// The region is being reclaimed; clear its remset, and any mention of
@ -397,16 +383,16 @@ public:
// Declare the heap size (in # of regions) to the HeapRegionRemSet(s).
// (Uses it to initialize from_card_cache).
static void init_heap(uint max_regions) {
OtherRegionsTable::initialize(max_regions);
FromCardCache::initialize(num_par_rem_sets(), max_regions);
}
static void invalidate(uint start_idx, uint num_regions) {
OtherRegionsTable::invalidate(start_idx, num_regions);
static void invalidate_from_card_cache(uint start_idx, size_t num_regions) {
FromCardCache::invalidate(start_idx, num_regions);
}
#ifndef PRODUCT
static void print_from_card_cache() {
OtherRegionsTable::print_from_card_cache();
FromCardCache::print();
}
#endif

View File

@ -172,6 +172,27 @@ void YoungGCTracer::report_tenuring_threshold(const uint tenuring_threshold) {
_tenuring_threshold = tenuring_threshold;
}
bool YoungGCTracer::should_report_promotion_in_new_plab_event() const {
return should_send_promotion_in_new_plab_event();
}
bool YoungGCTracer::should_report_promotion_outside_plab_event() const {
return should_send_promotion_outside_plab_event();
}
void YoungGCTracer::report_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
uint age, bool tenured,
size_t plab_size) const {
assert_set_gc_id();
send_promotion_in_new_plab_event(klass, obj_size, age, tenured, plab_size);
}
void YoungGCTracer::report_promotion_outside_plab_event(Klass* klass, size_t obj_size,
uint age, bool tenured) const {
assert_set_gc_id();
send_promotion_outside_plab_event(klass, obj_size, age, tenured);
}
void OldGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
assert_set_gc_id();

View File

@ -156,9 +156,38 @@ class YoungGCTracer : public GCTracer {
void report_promotion_failed(const PromotionFailedInfo& pf_info);
void report_tenuring_threshold(const uint tenuring_threshold);
/*
* Methods for reporting Promotion in new or outside PLAB Events.
*
* The object age is always required as it is not certain that the mark word
* of the oop can be trusted at this stage.
*
* obj_size is the size of the promoted object in bytes.
*
* tenured should be true if the object has been promoted to the old
* space during this GC, if the object is copied to survivor space
* from young space or survivor space (aging) tenured should be false.
*
* plab_size is the size of the newly allocated PLAB in bytes.
*/
bool should_report_promotion_in_new_plab_event() const;
bool should_report_promotion_outside_plab_event() const;
void report_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
uint age, bool tenured,
size_t plab_size) const;
void report_promotion_outside_plab_event(Klass* klass, size_t obj_size,
uint age, bool tenured) const;
private:
void send_young_gc_event() const;
void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
bool should_send_promotion_in_new_plab_event() const;
bool should_send_promotion_outside_plab_event() const;
void send_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
uint age, bool tenured,
size_t plab_size) const;
void send_promotion_outside_plab_event(Klass* klass, size_t obj_size,
uint age, bool tenured) const;
};
class OldGCTracer : public GCTracer {

View File

@ -111,6 +111,44 @@ void YoungGCTracer::send_young_gc_event() const {
}
}
bool YoungGCTracer::should_send_promotion_in_new_plab_event() const {
return EventPromoteObjectInNewPLAB::is_enabled();
}
bool YoungGCTracer::should_send_promotion_outside_plab_event() const {
return EventPromoteObjectOutsidePLAB::is_enabled();
}
void YoungGCTracer::send_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
uint age, bool tenured,
size_t plab_size) const {
EventPromoteObjectInNewPLAB event;
if (event.should_commit()) {
event.set_gcId(_shared_gc_info.gc_id().id());
event.set_class(klass);
event.set_objectSize(obj_size);
event.set_tenured(tenured);
event.set_tenuringAge(age);
event.set_plabSize(plab_size);
event.commit();
}
}
void YoungGCTracer::send_promotion_outside_plab_event(Klass* klass, size_t obj_size,
uint age, bool tenured) const {
EventPromoteObjectOutsidePLAB event;
if (event.should_commit()) {
event.set_gcId(_shared_gc_info.gc_id().id());
event.set_class(klass);
event.set_objectSize(obj_size);
event.set_tenured(tenured);
event.set_tenuringAge(age);
event.commit();
}
}
void OldGCTracer::send_old_gc_event() const {
EventGCOldGarbageCollection e(UNTIMED);
if (e.should_commit()) {

View File

@ -0,0 +1,360 @@
/*
* Copyright (c) 2014, 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 "memory/blockOffsetTable.inline.hpp"
#include "memory/cardGeneration.inline.hpp"
#include "memory/gcLocker.hpp"
#include "memory/generationSpec.hpp"
#include "memory/genOopClosures.inline.hpp"
#include "memory/genRemSet.hpp"
#include "memory/iterator.hpp"
#include "memory/memRegion.hpp"
#include "memory/space.inline.hpp"
#include "runtime/java.hpp"
CardGeneration::CardGeneration(ReservedSpace rs, size_t initial_byte_size,
int level,
GenRemSet* remset) :
Generation(rs, initial_byte_size, level), _rs(remset),
_shrink_factor(0), _min_heap_delta_bytes(), _capacity_at_prologue(),
_used_at_prologue()
{
HeapWord* start = (HeapWord*)rs.base();
size_t reserved_byte_size = rs.size();
assert((uintptr_t(start) & 3) == 0, "bad alignment");
assert((reserved_byte_size & 3) == 0, "bad alignment");
MemRegion reserved_mr(start, heap_word_size(reserved_byte_size));
_bts = new BlockOffsetSharedArray(reserved_mr,
heap_word_size(initial_byte_size));
MemRegion committed_mr(start, heap_word_size(initial_byte_size));
_rs->resize_covered_region(committed_mr);
if (_bts == NULL) {
vm_exit_during_initialization("Could not allocate a BlockOffsetArray");
}
// Verify that the start and end of this generation is the start of a card.
// If this wasn't true, a single card could span more than on generation,
// which would cause problems when we commit/uncommit memory, and when we
// clear and dirty cards.
guarantee(_rs->is_aligned(reserved_mr.start()), "generation must be card aligned");
if (reserved_mr.end() != Universe::heap()->reserved_region().end()) {
// Don't check at the very end of the heap as we'll assert that we're probing off
// the end if we try.
guarantee(_rs->is_aligned(reserved_mr.end()), "generation must be card aligned");
}
_min_heap_delta_bytes = MinHeapDeltaBytes;
_capacity_at_prologue = initial_byte_size;
_used_at_prologue = 0;
}
bool CardGeneration::grow_by(size_t bytes) {
assert_correct_size_change_locking();
bool result = _virtual_space.expand_by(bytes);
if (result) {
size_t new_word_size =
heap_word_size(_virtual_space.committed_size());
MemRegion mr(space()->bottom(), new_word_size);
// Expand card table
Universe::heap()->barrier_set()->resize_covered_region(mr);
// Expand shared block offset array
_bts->resize(new_word_size);
// Fix for bug #4668531
if (ZapUnusedHeapArea) {
MemRegion mangle_region(space()->end(),
(HeapWord*)_virtual_space.high());
SpaceMangler::mangle_region(mangle_region);
}
// Expand space -- also expands space's BOT
// (which uses (part of) shared array above)
space()->set_end((HeapWord*)_virtual_space.high());
// update the space and generation capacity counters
update_counters();
if (Verbose && PrintGC) {
size_t new_mem_size = _virtual_space.committed_size();
size_t old_mem_size = new_mem_size - bytes;
gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by "
SIZE_FORMAT "K to " SIZE_FORMAT "K",
name(), old_mem_size/K, bytes/K, new_mem_size/K);
}
}
return result;
}
bool CardGeneration::expand(size_t bytes, size_t expand_bytes) {
assert_locked_or_safepoint(Heap_lock);
if (bytes == 0) {
return true; // That's what grow_by(0) would return
}
size_t aligned_bytes = ReservedSpace::page_align_size_up(bytes);
if (aligned_bytes == 0){
// The alignment caused the number of bytes to wrap. An expand_by(0) will
// return true with the implication that an expansion was done when it
// was not. A call to expand implies a best effort to expand by "bytes"
// but not a guarantee. Align down to give a best effort. This is likely
// the most that the generation can expand since it has some capacity to
// start with.
aligned_bytes = ReservedSpace::page_align_size_down(bytes);
}
size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes);
bool success = false;
if (aligned_expand_bytes > aligned_bytes) {
success = grow_by(aligned_expand_bytes);
}
if (!success) {
success = grow_by(aligned_bytes);
}
if (!success) {
success = grow_to_reserved();
}
if (PrintGC && Verbose) {
if (success && GC_locker::is_active_and_needs_gc()) {
gclog_or_tty->print_cr("Garbage collection disabled, expanded heap instead");
}
}
return success;
}
bool CardGeneration::grow_to_reserved() {
assert_correct_size_change_locking();
bool success = true;
const size_t remaining_bytes = _virtual_space.uncommitted_size();
if (remaining_bytes > 0) {
success = grow_by(remaining_bytes);
DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
}
return success;
}
void CardGeneration::shrink(size_t bytes) {
assert_correct_size_change_locking();
size_t size = ReservedSpace::page_align_size_down(bytes);
if (size == 0) {
return;
}
// Shrink committed space
_virtual_space.shrink_by(size);
// Shrink space; this also shrinks the space's BOT
space()->set_end((HeapWord*) _virtual_space.high());
size_t new_word_size = heap_word_size(space()->capacity());
// Shrink the shared block offset array
_bts->resize(new_word_size);
MemRegion mr(space()->bottom(), new_word_size);
// Shrink the card table
Universe::heap()->barrier_set()->resize_covered_region(mr);
if (Verbose && PrintGC) {
size_t new_mem_size = _virtual_space.committed_size();
size_t old_mem_size = new_mem_size + size;
gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
name(), old_mem_size/K, new_mem_size/K);
}
}
// No young generation references, clear this generation's cards.
void CardGeneration::clear_remembered_set() {
_rs->clear(reserved());
}
// Objects in this generation may have moved, invalidate this
// generation's cards.
void CardGeneration::invalidate_remembered_set() {
_rs->invalidate(used_region());
}
void CardGeneration::compute_new_size() {
assert(_shrink_factor <= 100, "invalid shrink factor");
size_t current_shrink_factor = _shrink_factor;
_shrink_factor = 0;
// We don't have floating point command-line arguments
// Note: argument processing ensures that MinHeapFreeRatio < 100.
const double minimum_free_percentage = MinHeapFreeRatio / 100.0;
const double maximum_used_percentage = 1.0 - minimum_free_percentage;
// Compute some numbers about the state of the heap.
const size_t used_after_gc = used();
const size_t capacity_after_gc = capacity();
const double min_tmp = used_after_gc / maximum_used_percentage;
size_t minimum_desired_capacity = (size_t)MIN2(min_tmp, double(max_uintx));
// Don't shrink less than the initial generation size
minimum_desired_capacity = MAX2(minimum_desired_capacity,
spec()->init_size());
assert(used_after_gc <= minimum_desired_capacity, "sanity check");
if (PrintGC && Verbose) {
const size_t free_after_gc = free();
const double free_percentage = ((double)free_after_gc) / capacity_after_gc;
gclog_or_tty->print_cr("TenuredGeneration::compute_new_size: ");
gclog_or_tty->print_cr(" "
" minimum_free_percentage: %6.2f"
" maximum_used_percentage: %6.2f",
minimum_free_percentage,
maximum_used_percentage);
gclog_or_tty->print_cr(" "
" free_after_gc : %6.1fK"
" used_after_gc : %6.1fK"
" capacity_after_gc : %6.1fK",
free_after_gc / (double) K,
used_after_gc / (double) K,
capacity_after_gc / (double) K);
gclog_or_tty->print_cr(" "
" free_percentage: %6.2f",
free_percentage);
}
if (capacity_after_gc < minimum_desired_capacity) {
// If we have less free space than we want then expand
size_t expand_bytes = minimum_desired_capacity - capacity_after_gc;
// Don't expand unless it's significant
if (expand_bytes >= _min_heap_delta_bytes) {
expand(expand_bytes, 0); // safe if expansion fails
}
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" expanding:"
" minimum_desired_capacity: %6.1fK"
" expand_bytes: %6.1fK"
" _min_heap_delta_bytes: %6.1fK",
minimum_desired_capacity / (double) K,
expand_bytes / (double) K,
_min_heap_delta_bytes / (double) K);
}
return;
}
// No expansion, now see if we want to shrink
size_t shrink_bytes = 0;
// We would never want to shrink more than this
size_t max_shrink_bytes = capacity_after_gc - minimum_desired_capacity;
if (MaxHeapFreeRatio < 100) {
const double maximum_free_percentage = MaxHeapFreeRatio / 100.0;
const double minimum_used_percentage = 1.0 - maximum_free_percentage;
const double max_tmp = used_after_gc / minimum_used_percentage;
size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx));
maximum_desired_capacity = MAX2(maximum_desired_capacity,
spec()->init_size());
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" maximum_free_percentage: %6.2f"
" minimum_used_percentage: %6.2f",
maximum_free_percentage,
minimum_used_percentage);
gclog_or_tty->print_cr(" "
" _capacity_at_prologue: %6.1fK"
" minimum_desired_capacity: %6.1fK"
" maximum_desired_capacity: %6.1fK",
_capacity_at_prologue / (double) K,
minimum_desired_capacity / (double) K,
maximum_desired_capacity / (double) K);
}
assert(minimum_desired_capacity <= maximum_desired_capacity,
"sanity check");
if (capacity_after_gc > maximum_desired_capacity) {
// Capacity too large, compute shrinking size
shrink_bytes = capacity_after_gc - maximum_desired_capacity;
// We don't want shrink all the way back to initSize if people call
// System.gc(), because some programs do that between "phases" and then
// we'd just have to grow the heap up again for the next phase. So we
// damp the shrinking: 0% on the first call, 10% on the second call, 40%
// on the third call, and 100% by the fourth call. But if we recompute
// size without shrinking, it goes back to 0%.
shrink_bytes = shrink_bytes / 100 * current_shrink_factor;
assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size");
if (current_shrink_factor == 0) {
_shrink_factor = 10;
} else {
_shrink_factor = MIN2(current_shrink_factor * 4, (size_t) 100);
}
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" shrinking:"
" initSize: %.1fK"
" maximum_desired_capacity: %.1fK",
spec()->init_size() / (double) K,
maximum_desired_capacity / (double) K);
gclog_or_tty->print_cr(" "
" shrink_bytes: %.1fK"
" current_shrink_factor: " SIZE_FORMAT
" new shrink factor: " SIZE_FORMAT
" _min_heap_delta_bytes: %.1fK",
shrink_bytes / (double) K,
current_shrink_factor,
_shrink_factor,
_min_heap_delta_bytes / (double) K);
}
}
}
if (capacity_after_gc > _capacity_at_prologue) {
// We might have expanded for promotions, in which case we might want to
// take back that expansion if there's room after GC. That keeps us from
// stretching the heap with promotions when there's plenty of room.
size_t expansion_for_promotion = capacity_after_gc - _capacity_at_prologue;
expansion_for_promotion = MIN2(expansion_for_promotion, max_shrink_bytes);
// We have two shrinking computations, take the largest
shrink_bytes = MAX2(shrink_bytes, expansion_for_promotion);
assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size");
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" aggressive shrinking:"
" _capacity_at_prologue: %.1fK"
" capacity_after_gc: %.1fK"
" expansion_for_promotion: %.1fK"
" shrink_bytes: %.1fK",
capacity_after_gc / (double) K,
_capacity_at_prologue / (double) K,
expansion_for_promotion / (double) K,
shrink_bytes / (double) K);
}
}
// Don't shrink unless it's significant
if (shrink_bytes >= _min_heap_delta_bytes) {
shrink(shrink_bytes);
}
}
// Currently nothing to do.
void CardGeneration::prepare_for_verify() {}
void CardGeneration::space_iterate(SpaceClosure* blk,
bool usedOnly) {
blk->do_space(space());
}
void CardGeneration::younger_refs_iterate(OopsInGenClosure* blk) {
blk->set_generation(this);
younger_refs_in_space_iterate(space(), blk);
blk->reset_generation();
}

View File

@ -0,0 +1,99 @@
/*
* Copyright (c) 2014, 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_MEMORY_CARDGENERATION_HPP
#define SHARE_VM_MEMORY_CARDGENERATION_HPP
// Class CardGeneration is a generation that is covered by a card table,
// and uses a card-size block-offset array to implement block_start.
#include "memory/generation.hpp"
class BlockOffsetSharedArray;
class CompactibleSpace;
class CardGeneration: public Generation {
friend class VMStructs;
protected:
// This is shared with other generations.
GenRemSet* _rs;
// This is local to this generation.
BlockOffsetSharedArray* _bts;
// Current shrinking effect: this damps shrinking when the heap gets empty.
size_t _shrink_factor;
size_t _min_heap_delta_bytes; // Minimum amount to expand.
// Some statistics from before gc started.
// These are gathered in the gc_prologue (and should_collect)
// to control growing/shrinking policy in spite of promotions.
size_t _capacity_at_prologue;
size_t _used_at_prologue;
CardGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
GenRemSet* remset);
virtual void assert_correct_size_change_locking() = 0;
virtual CompactibleSpace* space() const = 0;
public:
// Attempt to expand the generation by "bytes". Expand by at a
// minimum "expand_bytes". Return true if some amount (not
// necessarily the full "bytes") was done.
virtual bool expand(size_t bytes, size_t expand_bytes);
// Shrink generation with specified size
virtual void shrink(size_t bytes);
virtual void compute_new_size();
virtual void clear_remembered_set();
virtual void invalidate_remembered_set();
virtual void prepare_for_verify();
// Grow generation with specified size (returns false if unable to grow)
bool grow_by(size_t bytes);
// Grow generation to reserved size.
bool grow_to_reserved();
size_t capacity() const;
size_t used() const;
size_t free() const;
MemRegion used_region() const;
void space_iterate(SpaceClosure* blk, bool usedOnly = false);
void younger_refs_iterate(OopsInGenClosure* blk);
bool is_in(const void* p) const;
CompactibleSpace* first_compaction_space() const;
};
#endif // SHARE_VM_MEMORY_CARDGENERATION_HPP

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2014, 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_MEMORY_CARDGENERATION_INLINE_HPP
#define SHARE_VM_MEMORY_CARDGENERATION_INLINE_HPP
#include "memory/cardGeneration.hpp"
#include "memory/space.hpp"
inline size_t CardGeneration::capacity() const {
return space()->capacity();
}
inline size_t CardGeneration::used() const {
return space()->used();
}
inline size_t CardGeneration::free() const {
return space()->free();
}
inline MemRegion CardGeneration::used_region() const {
return space()->used_region();
}
inline bool CardGeneration::is_in(const void* p) const {
return space()->is_in(p);
}
inline CompactibleSpace* CardGeneration::first_compaction_space() const {
return space();
}
#endif // SHARE_VM_MEMORY_CARDGENERATION_INLINE_HPP

View File

@ -275,29 +275,26 @@ void CardTableModRefBS::resize_covered_region(MemRegion new_region) {
// the new_end_aligned does not intrude onto the committed
// space of another region.
int ri = 0;
for (ri = 0; ri < _cur_covered_regions; ri++) {
if (ri != ind) {
if (_committed[ri].contains(new_end_aligned)) {
// The prior check included in the assert
// (new_end_aligned >= _committed[ri].start())
// is redundant with the "contains" test.
// Any region containing the new end
// should start at or beyond the region found (ind)
// for the new end (committed regions are not expected to
// be proper subsets of other committed regions).
assert(_committed[ri].start() >= _committed[ind].start(),
"New end of committed region is inconsistent");
new_end_aligned = _committed[ri].start();
// new_end_aligned can be equal to the start of its
// committed region (i.e., of "ind") if a second
// region following "ind" also start at the same location
// as "ind".
assert(new_end_aligned >= _committed[ind].start(),
"New end of committed region is before start");
debug_only(collided = true;)
// Should only collide with 1 region
break;
}
for (ri = ind + 1; ri < _cur_covered_regions; ri++) {
if (new_end_aligned > _committed[ri].start()) {
assert(new_end_aligned <= _committed[ri].end(),
"An earlier committed region can't cover a later committed region");
// Any region containing the new end
// should start at or beyond the region found (ind)
// for the new end (committed regions are not expected to
// be proper subsets of other committed regions).
assert(_committed[ri].start() >= _committed[ind].start(),
"New end of committed region is inconsistent");
new_end_aligned = _committed[ri].start();
// new_end_aligned can be equal to the start of its
// committed region (i.e., of "ind") if a second
// region following "ind" also start at the same location
// as "ind".
assert(new_end_aligned >= _committed[ind].start(),
"New end of committed region is before start");
debug_only(collided = true;)
// Should only collide with 1 region
break;
}
}
#ifdef ASSERT

View File

@ -98,11 +98,11 @@ void FileMapInfo::fail_continue(const char *msg, ...) {
tty->print_cr("UseSharedSpaces: %s", msg);
}
}
UseSharedSpaces = false;
assert(current_info() != NULL, "singleton must be registered");
current_info()->close();
}
va_end(ap);
UseSharedSpaces = false;
assert(current_info() != NULL, "singleton must be registered");
current_info()->close();
}
// Fill in the fileMapInfo structure with data about this VM instance.
@ -217,9 +217,14 @@ void FileMapInfo::allocate_classpath_entry_table() {
EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
SharedClassUtil::update_shared_classpath(cpe, ent, st.st_mtime, st.st_size, THREAD);
} else {
ent->_filesize = -1;
if (!os::dir_is_empty(name)) {
ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
struct stat st;
if ((os::stat(name, &st) == 0) && ((st.st_mode & S_IFDIR) == S_IFDIR)) {
if (!os::dir_is_empty(name)) {
ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
}
ent->_filesize = -1;
} else {
ent->_filesize = -2;
}
}
ent->_name = strptr;
@ -271,7 +276,7 @@ bool FileMapInfo::validate_classpath_entry_table() {
fail_continue("directory is not empty: %s", name);
ok = false;
}
} else {
} else if (ent->is_jar()) {
if (ent->_timestamp != st.st_mtime ||
ent->_filesize != st.st_size) {
ok = false;

View File

@ -44,8 +44,11 @@ class Metaspace;
class SharedClassPathEntry VALUE_OBJ_CLASS_SPEC {
public:
const char *_name;
time_t _timestamp; // jar timestamp, 0 if is directory
long _filesize; // jar file size, -1 if is directory
time_t _timestamp; // jar timestamp, 0 if is directory or other
long _filesize; // jar file size, -1 if is directory, -2 if other
bool is_jar() {
return _timestamp != 0;
}
bool is_dir() {
return _filesize == -1;
}

View File

@ -361,244 +361,3 @@ void Generation::compact() {
sp = sp->next_compaction_space();
}
}
CardGeneration::CardGeneration(ReservedSpace rs, size_t initial_byte_size,
int level,
GenRemSet* remset) :
Generation(rs, initial_byte_size, level), _rs(remset),
_shrink_factor(0), _min_heap_delta_bytes(), _capacity_at_prologue(),
_used_at_prologue()
{
HeapWord* start = (HeapWord*)rs.base();
size_t reserved_byte_size = rs.size();
assert((uintptr_t(start) & 3) == 0, "bad alignment");
assert((reserved_byte_size & 3) == 0, "bad alignment");
MemRegion reserved_mr(start, heap_word_size(reserved_byte_size));
_bts = new BlockOffsetSharedArray(reserved_mr,
heap_word_size(initial_byte_size));
MemRegion committed_mr(start, heap_word_size(initial_byte_size));
_rs->resize_covered_region(committed_mr);
if (_bts == NULL)
vm_exit_during_initialization("Could not allocate a BlockOffsetArray");
// Verify that the start and end of this generation is the start of a card.
// If this wasn't true, a single card could span more than on generation,
// which would cause problems when we commit/uncommit memory, and when we
// clear and dirty cards.
guarantee(_rs->is_aligned(reserved_mr.start()), "generation must be card aligned");
if (reserved_mr.end() != Universe::heap()->reserved_region().end()) {
// Don't check at the very end of the heap as we'll assert that we're probing off
// the end if we try.
guarantee(_rs->is_aligned(reserved_mr.end()), "generation must be card aligned");
}
_min_heap_delta_bytes = MinHeapDeltaBytes;
_capacity_at_prologue = initial_byte_size;
_used_at_prologue = 0;
}
bool CardGeneration::expand(size_t bytes, size_t expand_bytes) {
assert_locked_or_safepoint(Heap_lock);
if (bytes == 0) {
return true; // That's what grow_by(0) would return
}
size_t aligned_bytes = ReservedSpace::page_align_size_up(bytes);
if (aligned_bytes == 0){
// The alignment caused the number of bytes to wrap. An expand_by(0) will
// return true with the implication that an expansion was done when it
// was not. A call to expand implies a best effort to expand by "bytes"
// but not a guarantee. Align down to give a best effort. This is likely
// the most that the generation can expand since it has some capacity to
// start with.
aligned_bytes = ReservedSpace::page_align_size_down(bytes);
}
size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes);
bool success = false;
if (aligned_expand_bytes > aligned_bytes) {
success = grow_by(aligned_expand_bytes);
}
if (!success) {
success = grow_by(aligned_bytes);
}
if (!success) {
success = grow_to_reserved();
}
if (PrintGC && Verbose) {
if (success && GC_locker::is_active_and_needs_gc()) {
gclog_or_tty->print_cr("Garbage collection disabled, expanded heap instead");
}
}
return success;
}
// No young generation references, clear this generation's cards.
void CardGeneration::clear_remembered_set() {
_rs->clear(reserved());
}
// Objects in this generation may have moved, invalidate this
// generation's cards.
void CardGeneration::invalidate_remembered_set() {
_rs->invalidate(used_region());
}
void CardGeneration::compute_new_size() {
assert(_shrink_factor <= 100, "invalid shrink factor");
size_t current_shrink_factor = _shrink_factor;
_shrink_factor = 0;
// We don't have floating point command-line arguments
// Note: argument processing ensures that MinHeapFreeRatio < 100.
const double minimum_free_percentage = MinHeapFreeRatio / 100.0;
const double maximum_used_percentage = 1.0 - minimum_free_percentage;
// Compute some numbers about the state of the heap.
const size_t used_after_gc = used();
const size_t capacity_after_gc = capacity();
const double min_tmp = used_after_gc / maximum_used_percentage;
size_t minimum_desired_capacity = (size_t)MIN2(min_tmp, double(max_uintx));
// Don't shrink less than the initial generation size
minimum_desired_capacity = MAX2(minimum_desired_capacity,
spec()->init_size());
assert(used_after_gc <= minimum_desired_capacity, "sanity check");
if (PrintGC && Verbose) {
const size_t free_after_gc = free();
const double free_percentage = ((double)free_after_gc) / capacity_after_gc;
gclog_or_tty->print_cr("TenuredGeneration::compute_new_size: ");
gclog_or_tty->print_cr(" "
" minimum_free_percentage: %6.2f"
" maximum_used_percentage: %6.2f",
minimum_free_percentage,
maximum_used_percentage);
gclog_or_tty->print_cr(" "
" free_after_gc : %6.1fK"
" used_after_gc : %6.1fK"
" capacity_after_gc : %6.1fK",
free_after_gc / (double) K,
used_after_gc / (double) K,
capacity_after_gc / (double) K);
gclog_or_tty->print_cr(" "
" free_percentage: %6.2f",
free_percentage);
}
if (capacity_after_gc < minimum_desired_capacity) {
// If we have less free space than we want then expand
size_t expand_bytes = minimum_desired_capacity - capacity_after_gc;
// Don't expand unless it's significant
if (expand_bytes >= _min_heap_delta_bytes) {
expand(expand_bytes, 0); // safe if expansion fails
}
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" expanding:"
" minimum_desired_capacity: %6.1fK"
" expand_bytes: %6.1fK"
" _min_heap_delta_bytes: %6.1fK",
minimum_desired_capacity / (double) K,
expand_bytes / (double) K,
_min_heap_delta_bytes / (double) K);
}
return;
}
// No expansion, now see if we want to shrink
size_t shrink_bytes = 0;
// We would never want to shrink more than this
size_t max_shrink_bytes = capacity_after_gc - minimum_desired_capacity;
if (MaxHeapFreeRatio < 100) {
const double maximum_free_percentage = MaxHeapFreeRatio / 100.0;
const double minimum_used_percentage = 1.0 - maximum_free_percentage;
const double max_tmp = used_after_gc / minimum_used_percentage;
size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx));
maximum_desired_capacity = MAX2(maximum_desired_capacity,
spec()->init_size());
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" maximum_free_percentage: %6.2f"
" minimum_used_percentage: %6.2f",
maximum_free_percentage,
minimum_used_percentage);
gclog_or_tty->print_cr(" "
" _capacity_at_prologue: %6.1fK"
" minimum_desired_capacity: %6.1fK"
" maximum_desired_capacity: %6.1fK",
_capacity_at_prologue / (double) K,
minimum_desired_capacity / (double) K,
maximum_desired_capacity / (double) K);
}
assert(minimum_desired_capacity <= maximum_desired_capacity,
"sanity check");
if (capacity_after_gc > maximum_desired_capacity) {
// Capacity too large, compute shrinking size
shrink_bytes = capacity_after_gc - maximum_desired_capacity;
// We don't want shrink all the way back to initSize if people call
// System.gc(), because some programs do that between "phases" and then
// we'd just have to grow the heap up again for the next phase. So we
// damp the shrinking: 0% on the first call, 10% on the second call, 40%
// on the third call, and 100% by the fourth call. But if we recompute
// size without shrinking, it goes back to 0%.
shrink_bytes = shrink_bytes / 100 * current_shrink_factor;
assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size");
if (current_shrink_factor == 0) {
_shrink_factor = 10;
} else {
_shrink_factor = MIN2(current_shrink_factor * 4, (size_t) 100);
}
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" shrinking:"
" initSize: %.1fK"
" maximum_desired_capacity: %.1fK",
spec()->init_size() / (double) K,
maximum_desired_capacity / (double) K);
gclog_or_tty->print_cr(" "
" shrink_bytes: %.1fK"
" current_shrink_factor: " SIZE_FORMAT
" new shrink factor: " SIZE_FORMAT
" _min_heap_delta_bytes: %.1fK",
shrink_bytes / (double) K,
current_shrink_factor,
_shrink_factor,
_min_heap_delta_bytes / (double) K);
}
}
}
if (capacity_after_gc > _capacity_at_prologue) {
// We might have expanded for promotions, in which case we might want to
// take back that expansion if there's room after GC. That keeps us from
// stretching the heap with promotions when there's plenty of room.
size_t expansion_for_promotion = capacity_after_gc - _capacity_at_prologue;
expansion_for_promotion = MIN2(expansion_for_promotion, max_shrink_bytes);
// We have two shrinking computations, take the largest
shrink_bytes = MAX2(shrink_bytes, expansion_for_promotion);
assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size");
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" aggressive shrinking:"
" _capacity_at_prologue: %.1fK"
" capacity_after_gc: %.1fK"
" expansion_for_promotion: %.1fK"
" shrink_bytes: %.1fK",
capacity_after_gc / (double) K,
_capacity_at_prologue / (double) K,
expansion_for_promotion / (double) K,
shrink_bytes / (double) K);
}
}
// Don't shrink unless it's significant
if (shrink_bytes >= _min_heap_delta_bytes) {
shrink(shrink_bytes);
}
}
// Currently nothing to do.
void CardGeneration::prepare_for_verify() {}

View File

@ -584,57 +584,4 @@ public:
virtual CollectorCounters* counters() { return _gc_counters; }
};
// Class CardGeneration is a generation that is covered by a card table,
// and uses a card-size block-offset array to implement block_start.
// class BlockOffsetArray;
// class BlockOffsetArrayContigSpace;
class BlockOffsetSharedArray;
class CardGeneration: public Generation {
friend class VMStructs;
protected:
// This is shared with other generations.
GenRemSet* _rs;
// This is local to this generation.
BlockOffsetSharedArray* _bts;
// current shrinking effect: this damps shrinking when the heap gets empty.
size_t _shrink_factor;
size_t _min_heap_delta_bytes; // Minimum amount to expand.
// Some statistics from before gc started.
// These are gathered in the gc_prologue (and should_collect)
// to control growing/shrinking policy in spite of promotions.
size_t _capacity_at_prologue;
size_t _used_at_prologue;
CardGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
GenRemSet* remset);
public:
// Attempt to expand the generation by "bytes". Expand by at a
// minimum "expand_bytes". Return true if some amount (not
// necessarily the full "bytes") was done.
virtual bool expand(size_t bytes, size_t expand_bytes);
// Shrink generation with specified size (returns false if unable to shrink)
virtual void shrink(size_t bytes) = 0;
virtual void compute_new_size();
virtual void clear_remembered_set();
virtual void invalidate_remembered_set();
virtual void prepare_for_verify();
// Grow generation with specified size (returns false if unable to grow)
virtual bool grow_by(size_t bytes) = 0;
// Grow generation to reserved size.
virtual bool grow_to_reserved() = 0;
};
#endif // SHARE_VM_MEMORY_GENERATION_HPP

View File

@ -3158,7 +3158,25 @@ void Metaspace::global_initialize() {
SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment);
SharedMiscCodeSize = align_size_up(SharedMiscCodeSize, max_alignment);
// the min_misc_code_size estimate is based on MetaspaceShared::generate_vtable_methods()
// make sure SharedReadOnlySize and SharedReadWriteSize are not less than
// the minimum values.
if (SharedReadOnlySize < MetaspaceShared::min_ro_size){
report_out_of_shared_space(SharedReadOnly);
}
if (SharedReadWriteSize < MetaspaceShared::min_rw_size){
report_out_of_shared_space(SharedReadWrite);
}
// the min_misc_data_size and min_misc_code_size estimates are based on
// MetaspaceShared::generate_vtable_methods()
uint min_misc_data_size = align_size_up(
MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size * sizeof(void*), max_alignment);
if (SharedMiscDataSize < min_misc_data_size) {
report_out_of_shared_space(SharedMiscData);
}
uintx min_misc_code_size = align_size_up(
(MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size) *
(sizeof(void*) + MetaspaceShared::vtbl_method_size) + MetaspaceShared::vtbl_common_code_size,

View File

@ -969,7 +969,7 @@ bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) {
#endif
// If -Xshare:on is specified, print out the error message and exit VM,
// otherwise, set UseSharedSpaces to false and continue.
if (RequireSharedSpaces) {
if (RequireSharedSpaces || PrintSharedArchiveAndExit) {
vm_exit_during_initialization("Unable to use shared archive.", "Failed map_region for using -Xshare:on.");
} else {
FLAG_SET_DEFAULT(UseSharedSpaces, false);

View File

@ -69,6 +69,11 @@ class MetaspaceShared : AllStatic {
vtbl_common_code_size = (1*K) // conservative size of the "common_code" for the x64 platform
};
enum {
min_ro_size = NOT_LP64(8*M) LP64_ONLY(9*M), // minimum ro and rw regions sizes based on dumping
min_rw_size = NOT_LP64(7*M) LP64_ONLY(12*M) // of a shared archive using the default classlist
};
enum {
ro = 0, // read-only shared space in the heap
rw = 1, // read-write shared space in the heap

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2014, 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
@ -235,34 +235,6 @@ bool TenuredGeneration::expand(size_t bytes, size_t expand_bytes) {
return CardGeneration::expand(bytes, expand_bytes);
}
void TenuredGeneration::shrink(size_t bytes) {
assert_locked_or_safepoint(ExpandHeap_lock);
size_t size = ReservedSpace::page_align_size_down(bytes);
if (size > 0) {
shrink_by(size);
}
}
size_t TenuredGeneration::capacity() const {
return _the_space->capacity();
}
size_t TenuredGeneration::used() const {
return _the_space->used();
}
size_t TenuredGeneration::free() const {
return _the_space->free();
}
MemRegion TenuredGeneration::used_region() const {
return the_space()->used_region();
}
size_t TenuredGeneration::unsafe_max_alloc_nogc() const {
return _the_space->free();
}
@ -271,74 +243,8 @@ size_t TenuredGeneration::contiguous_available() const {
return _the_space->free() + _virtual_space.uncommitted_size();
}
bool TenuredGeneration::grow_by(size_t bytes) {
void TenuredGeneration::assert_correct_size_change_locking() {
assert_locked_or_safepoint(ExpandHeap_lock);
bool result = _virtual_space.expand_by(bytes);
if (result) {
size_t new_word_size =
heap_word_size(_virtual_space.committed_size());
MemRegion mr(_the_space->bottom(), new_word_size);
// Expand card table
Universe::heap()->barrier_set()->resize_covered_region(mr);
// Expand shared block offset array
_bts->resize(new_word_size);
// Fix for bug #4668531
if (ZapUnusedHeapArea) {
MemRegion mangle_region(_the_space->end(),
(HeapWord*)_virtual_space.high());
SpaceMangler::mangle_region(mangle_region);
}
// Expand space -- also expands space's BOT
// (which uses (part of) shared array above)
_the_space->set_end((HeapWord*)_virtual_space.high());
// update the space and generation capacity counters
update_counters();
if (Verbose && PrintGC) {
size_t new_mem_size = _virtual_space.committed_size();
size_t old_mem_size = new_mem_size - bytes;
gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by "
SIZE_FORMAT "K to " SIZE_FORMAT "K",
name(), old_mem_size/K, bytes/K, new_mem_size/K);
}
}
return result;
}
bool TenuredGeneration::grow_to_reserved() {
assert_locked_or_safepoint(ExpandHeap_lock);
bool success = true;
const size_t remaining_bytes = _virtual_space.uncommitted_size();
if (remaining_bytes > 0) {
success = grow_by(remaining_bytes);
DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
}
return success;
}
void TenuredGeneration::shrink_by(size_t bytes) {
assert_locked_or_safepoint(ExpandHeap_lock);
// Shrink committed space
_virtual_space.shrink_by(bytes);
// Shrink space; this also shrinks the space's BOT
_the_space->set_end((HeapWord*) _virtual_space.high());
size_t new_word_size = heap_word_size(_the_space->capacity());
// Shrink the shared block offset array
_bts->resize(new_word_size);
MemRegion mr(_the_space->bottom(), new_word_size);
// Shrink the card table
Universe::heap()->barrier_set()->resize_covered_region(mr);
if (Verbose && PrintGC) {
size_t new_mem_size = _virtual_space.committed_size();
size_t old_mem_size = new_mem_size + bytes;
gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
name(), old_mem_size/K, new_mem_size/K);
}
}
// Currently nothing to do.
@ -348,27 +254,14 @@ void TenuredGeneration::object_iterate(ObjectClosure* blk) {
_the_space->object_iterate(blk);
}
void TenuredGeneration::space_iterate(SpaceClosure* blk,
bool usedOnly) {
blk->do_space(_the_space);
}
void TenuredGeneration::younger_refs_iterate(OopsInGenClosure* blk) {
blk->set_generation(this);
younger_refs_in_space_iterate(_the_space, blk);
blk->reset_generation();
}
void TenuredGeneration::save_marks() {
_the_space->set_saved_mark();
}
void TenuredGeneration::reset_saved_marks() {
_the_space->reset_saved_mark();
}
bool TenuredGeneration::no_allocs_since_save_marks() {
return _the_space->saved_mark_at_top();
}
@ -387,28 +280,25 @@ ALL_SINCE_SAVE_MARKS_CLOSURES(TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN)
#undef TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN
void TenuredGeneration::gc_epilogue(bool full) {
_last_gc = WaterMark(the_space(), the_space()->top());
// update the generation and space performance counters
update_counters();
if (ZapUnusedHeapArea) {
the_space()->check_mangled_unused_area_complete();
_the_space->check_mangled_unused_area_complete();
}
}
void TenuredGeneration::record_spaces_top() {
assert(ZapUnusedHeapArea, "Not mangling unused space");
the_space()->set_top_for_allocations();
_the_space->set_top_for_allocations();
}
void TenuredGeneration::verify() {
the_space()->verify();
_the_space->verify();
}
void TenuredGeneration::print_on(outputStream* st) const {
Generation::print_on(st);
st->print(" the");
the_space()->print_on(st);
_the_space->print_on(st);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2014, 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
@ -28,7 +28,7 @@
#include "gc_implementation/shared/cSpaceCounters.hpp"
#include "gc_implementation/shared/gcStats.hpp"
#include "gc_implementation/shared/generationCounters.hpp"
#include "memory/generation.hpp"
#include "memory/cardGeneration.hpp"
#include "utilities/macros.hpp"
// TenuredGeneration models the heap containing old (promoted/tenured) objects
@ -42,27 +42,18 @@ class TenuredGeneration: public CardGeneration {
friend class VM_PopulateDumpSharedSpace;
protected:
ContiguousSpace* _the_space; // actual space holding objects
WaterMark _last_gc; // watermark between objects allocated before
// and after last GC.
ContiguousSpace* _the_space; // Actual space holding objects
GenerationCounters* _gen_counters;
CSpaceCounters* _space_counters;
// Grow generation with specified size (returns false if unable to grow)
virtual bool grow_by(size_t bytes);
// Grow generation to reserved size.
virtual bool grow_to_reserved();
// Shrink generation with specified size (returns false if unable to shrink)
void shrink_by(size_t bytes);
// Allocation failure
virtual bool expand(size_t bytes, size_t expand_bytes);
void shrink(size_t bytes);
// Accessing spaces
ContiguousSpace* the_space() const { return _the_space; }
ContiguousSpace* space() const { return _the_space; }
void assert_correct_size_change_locking();
public:
TenuredGeneration(ReservedSpace rs, size_t initial_byte_size,
int level, GenRemSet* remset);
@ -81,33 +72,15 @@ class TenuredGeneration: public CardGeneration {
return !ScavengeBeforeFullGC;
}
inline bool is_in(const void* p) const;
// Space enquiries
size_t capacity() const;
size_t used() const;
size_t free() const;
MemRegion used_region() const;
size_t unsafe_max_alloc_nogc() const;
size_t contiguous_available() const;
// Iteration
void object_iterate(ObjectClosure* blk);
void space_iterate(SpaceClosure* blk, bool usedOnly = false);
void younger_refs_iterate(OopsInGenClosure* blk);
inline CompactibleSpace* first_compaction_space() const;
virtual inline HeapWord* allocate(size_t word_size, bool is_tlab);
virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab);
// Accessing marks
inline WaterMark top_mark();
inline WaterMark bottom_mark();
#define TenuredGen_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \
void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
TenuredGen_SINCE_SAVE_MARKS_DECL(OopsInGenClosure,_v)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
@ -22,53 +22,35 @@
*
*/
#ifndef SHARE_VM_MEMORY_GENERATION_INLINE_HPP
#define SHARE_VM_MEMORY_GENERATION_INLINE_HPP
#ifndef SHARE_VM_MEMORY_TENUREDGENERATION_INLINE_HPP
#define SHARE_VM_MEMORY_TENUREDGENERATION_INLINE_HPP
#include "memory/genCollectedHeap.hpp"
#include "memory/space.hpp"
#include "memory/tenuredGeneration.hpp"
bool TenuredGeneration::is_in(const void* p) const {
return the_space()->is_in(p);
}
WaterMark TenuredGeneration::top_mark() {
return the_space()->top_mark();
}
CompactibleSpace*
TenuredGeneration::first_compaction_space() const {
return the_space();
}
HeapWord* TenuredGeneration::allocate(size_t word_size,
bool is_tlab) {
assert(!is_tlab, "TenuredGeneration does not support TLAB allocation");
return the_space()->allocate(word_size);
return _the_space->allocate(word_size);
}
HeapWord* TenuredGeneration::par_allocate(size_t word_size,
bool is_tlab) {
assert(!is_tlab, "TenuredGeneration does not support TLAB allocation");
return the_space()->par_allocate(word_size);
}
WaterMark TenuredGeneration::bottom_mark() {
return the_space()->bottom_mark();
return _the_space->par_allocate(word_size);
}
size_t TenuredGeneration::block_size(const HeapWord* addr) const {
if (addr < the_space()->top()) return oop(addr)->size();
else {
assert(addr == the_space()->top(), "non-block head arg to block_size");
return the_space()->end() - the_space()->top();
if (addr < _the_space->top()) {
return oop(addr)->size();
} else {
assert(addr == _the_space->top(), "non-block head arg to block_size");
return _the_space->end() - _the_space->top();
}
}
bool TenuredGeneration::block_is_obj(const HeapWord* addr) const {
return addr < the_space()->top();
return addr < _the_space ->top();
}
#endif // SHARE_VM_MEMORY_GENERATION_INLINE_HPP
#endif // SHARE_VM_MEMORY_TENUREDGENERATION_INLINE_HPP

View File

@ -287,9 +287,13 @@ void ConstantPoolCacheEntry::set_method_handle_common(constantPoolHandle cpool,
// the lock, so that when the losing writer returns, he can use the linked
// cache entry.
// Use the lock from the metaspace for this, which cannot stop for safepoint.
Mutex* metaspace_lock = cpool->pool_holder()->class_loader_data()->metaspace_lock();
MutexLockerEx ml(metaspace_lock, Mutex::_no_safepoint_check_flag);
objArrayHandle resolved_references = cpool->resolved_references();
// Use the resolved_references() lock for this cpCache entry.
// resolved_references are created for all classes with Invokedynamic, MethodHandle
// or MethodType constant pool cache entries.
assert(resolved_references() != NULL,
"a resolved_references array should have been created for this class");
ObjectLocker ol(resolved_references, Thread::current());
if (!is_f1_null()) {
return;
}
@ -336,7 +340,6 @@ void ConstantPoolCacheEntry::set_method_handle_common(constantPoolHandle cpool,
// This allows us to create fewer Methods, while keeping type safety.
//
objArrayHandle resolved_references = cpool->resolved_references();
// Store appendix, if any.
if (has_appendix) {
const int appendix_index = f2_as_index() + _indy_resolved_references_appendix_offset;

View File

@ -115,8 +115,6 @@ exit_hook_t Arguments::_exit_hook = NULL;
vfprintf_hook_t Arguments::_vfprintf_hook = NULL;
SystemProperty *Arguments::_java_ext_dirs = NULL;
SystemProperty *Arguments::_java_endorsed_dirs = NULL;
SystemProperty *Arguments::_sun_boot_library_path = NULL;
SystemProperty *Arguments::_java_library_path = NULL;
SystemProperty *Arguments::_java_home = NULL;
@ -125,9 +123,10 @@ SystemProperty *Arguments::_sun_boot_class_path = NULL;
char* Arguments::_meta_index_path = NULL;
char* Arguments::_meta_index_dir = NULL;
char* Arguments::_ext_dirs = NULL;
// Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string
// Check if head of 'option' matches 'name', and sets 'tail' to the remaining
// part of the option string.
static bool match_option(const JavaVMOption *option, const char* name,
const char** tail) {
int len = (int)strlen(name);
@ -139,6 +138,32 @@ static bool match_option(const JavaVMOption *option, const char* name,
}
}
// Check if 'option' matches 'name'. No "tail" is allowed.
static bool match_option(const JavaVMOption *option, const char* name) {
const char* tail = NULL;
bool result = match_option(option, name, &tail);
if (tail != NULL && *tail == '\0') {
return result;
} else {
return false;
}
}
// Return true if any of the strings in null-terminated array 'names' matches.
// If tail_allowed is true, then the tail must begin with a colon; otherwise,
// the option must match exactly.
static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
bool tail_allowed) {
for (/* empty */; *names != NULL; ++names) {
if (match_option(option, *names, tail)) {
if (**tail == '\0' || tail_allowed && **tail == ':') {
return true;
}
}
}
return false;
}
static void logOption(const char* opt) {
if (PrintVMOptions) {
jio_fprintf(defaultStream::output_stream(), "VM option '%s'\n", opt);
@ -184,8 +209,6 @@ void Arguments::init_system_properties() {
// Following are JVMTI agent writable properties.
// Properties values are set to NULL and they are
// os specific they are initialized in os::init_system_properties_values().
_java_ext_dirs = new SystemProperty("java.ext.dirs", NULL, true);
_java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL, true);
_sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL, true);
_java_library_path = new SystemProperty("java.library.path", NULL, true);
_java_home = new SystemProperty("java.home", NULL, true);
@ -194,8 +217,6 @@ void Arguments::init_system_properties() {
_java_class_path = new SystemProperty("java.class.path", "", true);
// Add to System Property list.
PropertyList_add(&_system_properties, _java_ext_dirs);
PropertyList_add(&_system_properties, _java_endorsed_dirs);
PropertyList_add(&_system_properties, _sun_boot_library_path);
PropertyList_add(&_system_properties, _java_library_path);
PropertyList_add(&_system_properties, _java_home);
@ -348,13 +369,9 @@ bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
// components, in order:
//
// prefix // from -Xbootclasspath/p:...
// endorsed // the expansion of -Djava.endorsed.dirs=...
// base // from os::get_system_properties() or -Xbootclasspath=
// suffix // from -Xbootclasspath/a:...
//
// java.endorsed.dirs is a list of directories; any jar or zip files in the
// directories are added to the sysclasspath just before the base.
//
// This could be AllStatic, but it isn't needed after argument processing is
// complete.
class SysClassPath: public StackObj {
@ -368,16 +385,9 @@ public:
inline void add_suffix(const char* suffix);
inline void reset_path(const char* base);
// Expand the jar/zip files in each directory listed by the java.endorsed.dirs
// property. Must be called after all command-line arguments have been
// processed (in particular, -Djava.endorsed.dirs=...) and before calling
// combined_path().
void expand_endorsed();
inline const char* get_base() const { return _items[_scp_base]; }
inline const char* get_prefix() const { return _items[_scp_prefix]; }
inline const char* get_suffix() const { return _items[_scp_suffix]; }
inline const char* get_endorsed() const { return _items[_scp_endorsed]; }
// Combine all the components into a single c-heap-allocated string; caller
// must free the string if/when no longer needed.
@ -394,20 +404,17 @@ private:
// base are allocated in the C heap and freed by this class.
enum {
_scp_prefix, // from -Xbootclasspath/p:...
_scp_endorsed, // the expansion of -Djava.endorsed.dirs=...
_scp_base, // the default sysclasspath
_scp_suffix, // from -Xbootclasspath/a:...
_scp_nitems // the number of items, must be last.
};
const char* _items[_scp_nitems];
DEBUG_ONLY(bool _expansion_done;)
};
SysClassPath::SysClassPath(const char* base) {
memset(_items, 0, sizeof(_items));
_items[_scp_base] = base;
DEBUG_ONLY(_expansion_done = false;)
}
SysClassPath::~SysClassPath() {
@ -415,7 +422,6 @@ SysClassPath::~SysClassPath() {
for (int i = 0; i < _scp_nitems; ++i) {
if (i != _scp_base) reset_item_at(i);
}
DEBUG_ONLY(_expansion_done = false;)
}
inline void SysClassPath::set_base(const char* base) {
@ -451,41 +457,11 @@ inline void SysClassPath::reset_path(const char* base) {
//------------------------------------------------------------------------------
void SysClassPath::expand_endorsed() {
assert(_items[_scp_endorsed] == NULL, "can only be called once.");
const char* path = Arguments::get_property("java.endorsed.dirs");
if (path == NULL) {
path = Arguments::get_endorsed_dir();
assert(path != NULL, "no default for java.endorsed.dirs");
}
char* expanded_path = NULL;
const char separator = *os::path_separator();
const char* const end = path + strlen(path);
while (path < end) {
const char* tmp_end = strchr(path, separator);
if (tmp_end == NULL) {
expanded_path = add_jars_to_path(expanded_path, path);
path = end;
} else {
char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
memcpy(dirpath, path, tmp_end - path);
dirpath[tmp_end - path] = '\0';
expanded_path = add_jars_to_path(expanded_path, dirpath);
FREE_C_HEAP_ARRAY(char, dirpath);
path = tmp_end + 1;
}
}
_items[_scp_endorsed] = expanded_path;
DEBUG_ONLY(_expansion_done = true;)
}
// Combine the bootclasspath elements, some of which may be null, into a single
// c-heap-allocated string.
char* SysClassPath::combined_path() {
assert(_items[_scp_base] != NULL, "empty default sysclasspath");
assert(_expansion_done, "must call expand_endorsed() first.");
size_t lengths[_scp_nitems];
size_t total_len = 0;
@ -2576,21 +2552,6 @@ static const char* system_assertion_options[] = {
"-dsa", "-esa", "-disablesystemassertions", "-enablesystemassertions", 0
};
// Return true if any of the strings in null-terminated array 'names' matches.
// If tail_allowed is true, then the tail must begin with a colon; otherwise,
// the option must match exactly.
static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
bool tail_allowed) {
for (/* empty */; *names != NULL; ++names) {
if (match_option(option, *names, tail)) {
if (**tail == '\0' || tail_allowed && **tail == ':') {
return true;
}
}
}
return false;
}
bool Arguments::parse_uintx(const char* value,
uintx* uintx_arg,
uintx min_size) {
@ -2832,16 +2793,16 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
}
#endif // !INCLUDE_JVMTI
// -Xnoclassgc
} else if (match_option(option, "-Xnoclassgc", &tail)) {
} else if (match_option(option, "-Xnoclassgc")) {
FLAG_SET_CMDLINE(bool, ClassUnloading, false);
// -Xconcgc
} else if (match_option(option, "-Xconcgc", &tail)) {
} else if (match_option(option, "-Xconcgc")) {
FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);
// -Xnoconcgc
} else if (match_option(option, "-Xnoconcgc", &tail)) {
} else if (match_option(option, "-Xnoconcgc")) {
FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false);
// -Xbatch
} else if (match_option(option, "-Xbatch", &tail)) {
} else if (match_option(option, "-Xbatch")) {
FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
// -Xmn for compatibility with other JVM vendors
} else if (match_option(option, "-Xmn", &tail)) {
@ -2986,28 +2947,28 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
}
FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
// -green
} else if (match_option(option, "-green", &tail)) {
} else if (match_option(option, "-green")) {
jio_fprintf(defaultStream::error_stream(),
"Green threads support not available\n");
return JNI_EINVAL;
// -native
} else if (match_option(option, "-native", &tail)) {
} else if (match_option(option, "-native")) {
// HotSpot always uses native threads, ignore silently for compatibility
// -Xsqnopause
} else if (match_option(option, "-Xsqnopause", &tail)) {
} else if (match_option(option, "-Xsqnopause")) {
// EVM option, ignore silently for compatibility
// -Xrs
} else if (match_option(option, "-Xrs", &tail)) {
} else if (match_option(option, "-Xrs")) {
// Classic/EVM option, new functionality
FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true);
} else if (match_option(option, "-Xusealtsigs", &tail)) {
} else if (match_option(option, "-Xusealtsigs")) {
// change default internal VM signals used - lower case for back compat
FLAG_SET_CMDLINE(bool, UseAltSigs, true);
// -Xoptimize
} else if (match_option(option, "-Xoptimize", &tail)) {
} else if (match_option(option, "-Xoptimize")) {
// EVM option, ignore silently for compatibility
// -Xprof
} else if (match_option(option, "-Xprof", &tail)) {
} else if (match_option(option, "-Xprof")) {
#if INCLUDE_FPROF
_has_profile = true;
#else // INCLUDE_FPROF
@ -3016,7 +2977,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
return JNI_ERR;
#endif // INCLUDE_FPROF
// -Xconcurrentio
} else if (match_option(option, "-Xconcurrentio", &tail)) {
} else if (match_option(option, "-Xconcurrentio")) {
FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true);
FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1);
@ -3024,18 +2985,32 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
FLAG_SET_CMDLINE(uintx, NewSizeThreadIncrease, 16 * K); // 20Kb per thread added to new generation
// -Xinternalversion
} else if (match_option(option, "-Xinternalversion", &tail)) {
} else if (match_option(option, "-Xinternalversion")) {
jio_fprintf(defaultStream::output_stream(), "%s\n",
VM_Version::internal_vm_info_string());
vm_exit(0);
#ifndef PRODUCT
// -Xprintflags
} else if (match_option(option, "-Xprintflags", &tail)) {
} else if (match_option(option, "-Xprintflags")) {
CommandLineFlags::printFlags(tty, false);
vm_exit(0);
#endif
// -D
} else if (match_option(option, "-D", &tail)) {
if (match_option(option, "-Djava.endorsed.dirs=", &tail)) {
// abort if -Djava.endorsed.dirs is set
jio_fprintf(defaultStream::output_stream(),
"-Djava.endorsed.dirs is not supported. Endorsed standards and standalone APIs\n"
"in modular form will be supported via the concept of upgradeable modules.\n");
return JNI_EINVAL;
}
if (match_option(option, "-Djava.ext.dirs=", &tail)) {
// abort if -Djava.ext.dirs is set
jio_fprintf(defaultStream::output_stream(),
"-Djava.ext.dirs is not supported. Use -classpath instead.\n");
return JNI_EINVAL;
}
if (!add_property(tail)) {
return JNI_ENOMEM;
}
@ -3050,29 +3025,29 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
#endif
}
// -Xint
} else if (match_option(option, "-Xint", &tail)) {
} else if (match_option(option, "-Xint")) {
set_mode_flags(_int);
// -Xmixed
} else if (match_option(option, "-Xmixed", &tail)) {
} else if (match_option(option, "-Xmixed")) {
set_mode_flags(_mixed);
// -Xcomp
} else if (match_option(option, "-Xcomp", &tail)) {
} else if (match_option(option, "-Xcomp")) {
// for testing the compiler; turn off all flags that inhibit compilation
set_mode_flags(_comp);
// -Xshare:dump
} else if (match_option(option, "-Xshare:dump", &tail)) {
} else if (match_option(option, "-Xshare:dump")) {
FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
set_mode_flags(_int); // Prevent compilation, which creates objects
// -Xshare:on
} else if (match_option(option, "-Xshare:on", &tail)) {
} else if (match_option(option, "-Xshare:on")) {
FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
// -Xshare:auto
} else if (match_option(option, "-Xshare:auto", &tail)) {
} else if (match_option(option, "-Xshare:auto")) {
FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
// -Xshare:off
} else if (match_option(option, "-Xshare:off", &tail)) {
} else if (match_option(option, "-Xshare:off")) {
FLAG_SET_CMDLINE(bool, UseSharedSpaces, false);
FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
// -Xverify
@ -3090,13 +3065,13 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
return JNI_EINVAL;
}
// -Xdebug
} else if (match_option(option, "-Xdebug", &tail)) {
} else if (match_option(option, "-Xdebug")) {
// note this flag has been used, then ignore
set_xdebug_mode(true);
// -Xnoagent
} else if (match_option(option, "-Xnoagent", &tail)) {
} else if (match_option(option, "-Xnoagent")) {
// For compatibility with classic. HotSpot refuses to load the old style agent.dll.
} else if (match_option(option, "-Xboundthreads", &tail)) {
} else if (match_option(option, "-Xboundthreads")) {
// Bind user level threads to kernel threads (Solaris only)
FLAG_SET_CMDLINE(bool, UseBoundThreads, true);
} else if (match_option(option, "-Xloggc:", &tail)) {
@ -3126,14 +3101,14 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
"check")) {
return JNI_EINVAL;
}
} else if (match_option(option, "vfprintf", &tail)) {
} else if (match_option(option, "vfprintf")) {
_vfprintf_hook = CAST_TO_FN_PTR(vfprintf_hook_t, option->extraInfo);
} else if (match_option(option, "exit", &tail)) {
} else if (match_option(option, "exit")) {
_exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo);
} else if (match_option(option, "abort", &tail)) {
} else if (match_option(option, "abort")) {
_abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo);
// -XX:+AggressiveHeap
} else if (match_option(option, "-XX:+AggressiveHeap", &tail)) {
} else if (match_option(option, "-XX:+AggressiveHeap")) {
// This option inspects the machine and attempts to set various
// parameters to be optimal for long-running, memory allocation
@ -3224,11 +3199,11 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
// Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure;
// and the last option wins.
} else if (match_option(option, "-XX:+NeverTenure", &tail)) {
} else if (match_option(option, "-XX:+NeverTenure")) {
FLAG_SET_CMDLINE(bool, NeverTenure, true);
FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1);
} else if (match_option(option, "-XX:+AlwaysTenure", &tail)) {
} else if (match_option(option, "-XX:+AlwaysTenure")) {
FLAG_SET_CMDLINE(bool, NeverTenure, false);
FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
@ -3247,17 +3222,17 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
FLAG_SET_CMDLINE(bool, NeverTenure, false);
FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
}
} else if (match_option(option, "-XX:+CMSPermGenSweepingEnabled", &tail) ||
match_option(option, "-XX:-CMSPermGenSweepingEnabled", &tail)) {
} else if (match_option(option, "-XX:+CMSPermGenSweepingEnabled") ||
match_option(option, "-XX:-CMSPermGenSweepingEnabled")) {
jio_fprintf(defaultStream::error_stream(),
"Please use CMSClassUnloadingEnabled in place of "
"CMSPermGenSweepingEnabled in the future\n");
} else if (match_option(option, "-XX:+UseGCTimeLimit", &tail)) {
} else if (match_option(option, "-XX:+UseGCTimeLimit")) {
FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, true);
jio_fprintf(defaultStream::error_stream(),
"Please use -XX:+UseGCOverheadLimit in place of "
"-XX:+UseGCTimeLimit in the future\n");
} else if (match_option(option, "-XX:-UseGCTimeLimit", &tail)) {
} else if (match_option(option, "-XX:-UseGCTimeLimit")) {
FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, false);
jio_fprintf(defaultStream::error_stream(),
"Please use -XX:-UseGCOverheadLimit in place of "
@ -3267,13 +3242,13 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
// are not to be documented.
} else if (match_option(option, "-XX:MaxTLERatio=", &tail)) {
// No longer used.
} else if (match_option(option, "-XX:+ResizeTLE", &tail)) {
} else if (match_option(option, "-XX:+ResizeTLE")) {
FLAG_SET_CMDLINE(bool, ResizeTLAB, true);
} else if (match_option(option, "-XX:-ResizeTLE", &tail)) {
} else if (match_option(option, "-XX:-ResizeTLE")) {
FLAG_SET_CMDLINE(bool, ResizeTLAB, false);
} else if (match_option(option, "-XX:+PrintTLE", &tail)) {
} else if (match_option(option, "-XX:+PrintTLE")) {
FLAG_SET_CMDLINE(bool, PrintTLAB, true);
} else if (match_option(option, "-XX:-PrintTLE", &tail)) {
} else if (match_option(option, "-XX:-PrintTLE")) {
FLAG_SET_CMDLINE(bool, PrintTLAB, false);
} else if (match_option(option, "-XX:TLEFragmentationRatio=", &tail)) {
// No longer used.
@ -3289,17 +3264,17 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
FLAG_SET_CMDLINE(uintx, TLABSize, long_tlab_size);
} else if (match_option(option, "-XX:TLEThreadRatio=", &tail)) {
// No longer used.
} else if (match_option(option, "-XX:+UseTLE", &tail)) {
} else if (match_option(option, "-XX:+UseTLE")) {
FLAG_SET_CMDLINE(bool, UseTLAB, true);
} else if (match_option(option, "-XX:-UseTLE", &tail)) {
} else if (match_option(option, "-XX:-UseTLE")) {
FLAG_SET_CMDLINE(bool, UseTLAB, false);
} else if (match_option(option, "-XX:+DisplayVMOutputToStderr", &tail)) {
} else if (match_option(option, "-XX:+DisplayVMOutputToStderr")) {
FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false);
FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true);
} else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) {
} else if (match_option(option, "-XX:+DisplayVMOutputToStdout")) {
FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false);
FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true);
} else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) {
} else if (match_option(option, "-XX:+ExtendedDTraceProbes")) {
#if defined(DTRACE_ENABLED)
FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true);
FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true);
@ -3311,7 +3286,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
return JNI_EINVAL;
#endif // defined(DTRACE_ENABLED)
#ifdef ASSERT
} else if (match_option(option, "-XX:+FullGCALot", &tail)) {
} else if (match_option(option, "-XX:+FullGCALot")) {
FLAG_SET_CMDLINE(bool, FullGCALot, true);
// disable scavenge before parallel mark-compact
FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
@ -3397,7 +3372,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
}
FLAG_SET_CMDLINE(uintx, MaxDirectMemorySize, max_direct_memory_size);
#if !INCLUDE_MANAGEMENT
} else if (match_option(option, "-XX:+ManagementServer", &tail)) {
} else if (match_option(option, "-XX:+ManagementServer")) {
jio_fprintf(defaultStream::error_stream(),
"ManagementServer is not supported in this VM.\n");
return JNI_ERR;
@ -3481,11 +3456,89 @@ void Arguments::fix_appclasspath() {
}
}
jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
// This must be done after all -D arguments have been processed.
scp_p->expand_endorsed();
static bool has_jar_files(const char* directory) {
DIR* dir = os::opendir(directory);
if (dir == NULL) return false;
if (scp_assembly_required || scp_p->get_endorsed() != NULL) {
struct dirent *entry;
char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
bool hasJarFile = false;
while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
const char* name = entry->d_name;
const char* ext = name + strlen(name) - 4;
hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
}
FREE_C_HEAP_ARRAY(char, dbuf);
os::closedir(dir);
return hasJarFile ;
}
static int check_non_empty_dirs(const char* path) {
const char separator = *os::path_separator();
const char* const end = path + strlen(path);
int nonEmptyDirs = 0;
while (path < end) {
const char* tmp_end = strchr(path, separator);
if (tmp_end == NULL) {
if (has_jar_files(path)) {
nonEmptyDirs++;
jio_fprintf(defaultStream::output_stream(),
"Non-empty directory: %s\n", path);
}
path = end;
} else {
char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
memcpy(dirpath, path, tmp_end - path);
dirpath[tmp_end - path] = '\0';
if (has_jar_files(dirpath)) {
nonEmptyDirs++;
jio_fprintf(defaultStream::output_stream(),
"Non-empty directory: %s\n", dirpath);
}
FREE_C_HEAP_ARRAY(char, dirpath);
path = tmp_end + 1;
}
}
return nonEmptyDirs;
}
jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
// check if the default lib/endorsed directory exists; if so, error
char path[JVM_MAXPATHLEN];
const char* fileSep = os::file_separator();
sprintf(path, "%s%slib%sendorsed", Arguments::get_java_home(), fileSep, fileSep);
if (CheckEndorsedAndExtDirs) {
int nonEmptyDirs = 0;
// check endorsed directory
nonEmptyDirs += check_non_empty_dirs(path);
// check the extension directories
nonEmptyDirs += check_non_empty_dirs(Arguments::get_ext_dirs());
if (nonEmptyDirs > 0) {
return JNI_ERR;
}
}
DIR* dir = os::opendir(path);
if (dir != NULL) {
jio_fprintf(defaultStream::output_stream(),
"<JAVA_HOME>/lib/endorsed is not supported. Endorsed standards and standalone APIs\n"
"in modular form will be supported via the concept of upgradeable modules.\n");
os::closedir(dir);
return JNI_ERR;
}
sprintf(path, "%s%slib%sext", Arguments::get_java_home(), fileSep, fileSep);
dir = os::opendir(path);
if (dir != NULL) {
jio_fprintf(defaultStream::output_stream(),
"<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; "
"Use -classpath instead.\n.");
os::closedir(dir);
return JNI_ERR;
}
if (scp_assembly_required) {
// Assemble the bootclasspath elements into the final path.
Arguments::set_sysclasspath(scp_p->combined_path());
}
@ -3754,23 +3807,23 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
settings_file_specified = true;
continue;
}
if (match_option(option, "-XX:+PrintVMOptions", &tail)) {
if (match_option(option, "-XX:+PrintVMOptions")) {
PrintVMOptions = true;
continue;
}
if (match_option(option, "-XX:-PrintVMOptions", &tail)) {
if (match_option(option, "-XX:-PrintVMOptions")) {
PrintVMOptions = false;
continue;
}
if (match_option(option, "-XX:+IgnoreUnrecognizedVMOptions", &tail)) {
if (match_option(option, "-XX:+IgnoreUnrecognizedVMOptions")) {
IgnoreUnrecognizedVMOptions = true;
continue;
}
if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) {
if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions")) {
IgnoreUnrecognizedVMOptions = false;
continue;
}
if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) {
if (match_option(option, "-XX:+PrintFlagsInitial")) {
CommandLineFlags::printFlags(tty, false);
vm_exit(0);
}
@ -3796,7 +3849,7 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
#ifndef PRODUCT
if (match_option(option, "-XX:+PrintFlagsWithComments", &tail)) {
if (match_option(option, "-XX:+PrintFlagsWithComments")) {
CommandLineFlags::printFlags(tty, true);
vm_exit(0);
}

View File

@ -254,8 +254,6 @@ class Arguments : AllStatic {
static SystemProperty* _system_properties;
// Quick accessor to System properties in the list:
static SystemProperty *_java_ext_dirs;
static SystemProperty *_java_endorsed_dirs;
static SystemProperty *_sun_boot_library_path;
static SystemProperty *_java_library_path;
static SystemProperty *_java_home;
@ -266,6 +264,10 @@ class Arguments : AllStatic {
static char* _meta_index_path;
static char* _meta_index_dir;
// temporary: to emit warning if the default ext dirs are not empty.
// remove this variable when the warning is no longer needed.
static char* _ext_dirs;
// java.vendor.url.bug, bug reporting URL for fatal errors.
static const char* _java_vendor_url_bug;
@ -585,8 +587,7 @@ class Arguments : AllStatic {
static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); }
static void set_java_home(char *value) { _java_home->set_value(value); }
static void set_library_path(char *value) { _java_library_path->set_value(value); }
static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); }
static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); }
static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); }
static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); }
static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) {
@ -596,14 +597,14 @@ class Arguments : AllStatic {
static char* get_java_home() { return _java_home->value(); }
static char* get_dll_dir() { return _sun_boot_library_path->value(); }
static char* get_endorsed_dir() { return _java_endorsed_dirs->value(); }
static char* get_sysclasspath() { return _sun_boot_class_path->value(); }
static char* get_meta_index_path() { return _meta_index_path; }
static char* get_meta_index_dir() { return _meta_index_dir; }
static char* get_ext_dirs() { return _java_ext_dirs->value(); }
static char* get_ext_dirs() { return _ext_dirs; }
static char* get_appclasspath() { return _java_class_path->value(); }
static void fix_appclasspath();
// Operation modi
static Mode mode() { return _mode; }
static bool is_interpreter_only() { return mode() == _int; }

View File

@ -1230,6 +1230,9 @@ class CommandLineFlags {
product(bool, CheckJNICalls, false, \
"Verify all arguments to JNI calls") \
\
product(bool, CheckEndorsedAndExtDirs, false, \
"Verify the endorsed and extension directories are not used") \
\
product(bool, UseFastJNIAccessors, true, \
"Use optimized versions of Get<Primitive>Field") \
\

View File

@ -1230,11 +1230,21 @@ bool os::set_boot_path(char fileSep, char pathSep) {
Arguments::set_meta_index_path(meta_index, meta_index_dir);
char* sysclasspath = NULL;
struct stat st;
// modular image if bootmodules.jimage exists
char* jimage = format_boot_path("%/lib/modules/bootmodules.jimage", home, home_len, fileSep, pathSep);
if (jimage == NULL) return false;
bool has_jimage = (os::stat(jimage, &st) == 0);
if (has_jimage) {
Arguments::set_sysclasspath(jimage);
return true;
}
FREE_C_HEAP_ARRAY(char, jimage);
// images build if rt.jar exists
char* rt_jar = format_boot_path("%/lib/rt.jar", home, home_len, fileSep, pathSep);
if (rt_jar == NULL) return false;
struct stat st;
bool has_rt_jar = (os::stat(rt_jar, &st) == 0);
FREE_C_HEAP_ARRAY(char, rt_jar);

View File

@ -500,6 +500,7 @@ class os: AllStatic {
//File i/o operations
static size_t read(int fd, void *buf, unsigned int nBytes);
static size_t read_at(int fd, void *buf, unsigned int nBytes, jlong offset);
static size_t restartable_read(int fd, void *buf, unsigned int nBytes);
static size_t write(int fd, const void *buf, unsigned int nBytes);

View File

@ -225,8 +225,6 @@ static const char* property_counters_ss[] = {
"java.vm.info",
"java.library.path",
"java.class.path",
"java.endorsed.dirs",
"java.ext.dirs",
"java.version",
"java.home",
NULL

View File

@ -556,9 +556,6 @@ typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
\
nonstatic_field(TenuredGeneration, _min_heap_delta_bytes, size_t) \
nonstatic_field(TenuredGeneration, _the_space, ContiguousSpace*) \
nonstatic_field(TenuredGeneration, _last_gc, WaterMark) \
\
\
\
nonstatic_field(Space, _bottom, HeapWord*) \
nonstatic_field(Space, _end, HeapWord*) \

View File

@ -314,6 +314,28 @@ Declares a structure type that can be used in other events.
<value type="BYTES64" field="totalSize" label="Total Size" />
</event>
<!-- Promotion events, Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. -->
<event id="PromoteObjectInNewPLAB" path="vm/gc/detailed/object_promotion_in_new_PLAB" label="Promotion in new PLAB"
description="Object survived scavenge and was copied to a new Promotion Local Allocation Buffer (PLAB). Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. Due to promotion being done in parallel an object might be reported multiple times as the GC threads race to copy all objects."
has_thread="true" has_stacktrace="false" is_instant="true">
<value type="UINT" field="gcId" label="GC ID" relation="GC_ID" description="ID of GC during which the object was promoted"/>
<value type="CLASS" field="class" label="Class" description="Class of promoted object"/>
<value type="BYTES64" field="objectSize" label="Object Size" description="Size of promoted object"/>
<value type="UINT" field="tenuringAge" label="Object Tenuring Age" description="Tenuring age of a surviving object before being copied. The tenuring age of an object is a value between 0-15 and is incremented each scavange the object survives. Newly allocated objects have tenuring age 0."/>
<value type="BOOLEAN" field="tenured" label="Tenured" description="True if object was promoted to Old space, otherwise the object was aged and copied to a Survivor space"/>
<value type="BYTES64" field="plabSize" label="PLAB Size" description="Size of the allocated PLAB to which the object was copied"/>
</event>
<event id="PromoteObjectOutsidePLAB" path="vm/gc/detailed/object_promotion_outside_PLAB" label="Promotion outside PLAB"
description="Object survived scavenge and was copied directly to the heap. Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. Due to promotion being done in parallel an object might be reported multiple times as the GC threads race to copy all objects."
has_thread="true" has_stacktrace="false" is_instant="true">
<value type="UINT" field="gcId" label="GC ID" relation="GC_ID" description="ID of GC during which the object was promoted"/>
<value type="CLASS" field="class" label="Class" description="Class of promoted object"/>
<value type="BYTES64" field="objectSize" label="Object Size" description="Size of promoted object"/>
<value type="UINT" field="tenuringAge" label="Object Tenuring Age" description="Tenuring age of a surviving object before being copied. The tenuring age of an object is a value between 0-15 and is incremented each scavange the object survives. Newly allocated objects have tenuring age 0."/>
<value type="BOOLEAN" field="tenured" label="Tenured" description="True if object was promoted to Old space, otherwise the object was aged and copied to a Survivor space"/>
</event>
<event id="PromotionFailed" path="vm/gc/detailed/promotion_failed" label="Promotion Failed" is_instant="true"
description="Promotion of an object failed">
<value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>

View File

@ -275,6 +275,9 @@ JTREG_BASIC_OPTIONS += -retain:fail,error
# Ignore tests are not run and completely silent about it
JTREG_IGNORE_OPTION = -ignore:quiet
JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
# Multiply by 4 the timeout factor
JTREG_TIMEOUT_OPTION = -timeoutFactor:4
JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
# Add any extra options
JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
# Set other vm and test options

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2014, 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.
*/
import com.oracle.java.testlibrary.JDKToolFinder;
import com.oracle.java.testlibrary.OutputAnalyzer;
import com.oracle.java.testlibrary.ProcessTools;
import com.oracle.java.testlibrary.Platform;
/*
* @test TestCardTablePageCommits
* @key gc
* @bug 8059066
* @summary Tests that the card table does not commit the same page twice
* @library /testlibrary
* @run driver TestCardTablePageCommits
*/
public class TestCardTablePageCommits {
public static void main(String args[]) throws Exception {
// The test is run with a small heap to make sure all pages in the card
// table gets committed. Need 8 MB heap to trigger the bug on SPARC
// because of 8kB pages, assume 4 KB pages for all other CPUs.
String Xmx = Platform.isSparc() ? "-Xmx8m" : "-Xmx4m";
String[] opts = {Xmx, "-XX:NativeMemoryTracking=detail", "-XX:+UseParallelGC", "-version"};
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(opts);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
}
}

View File

@ -30,40 +30,96 @@
import com.oracle.java.testlibrary.*;
public class LimitSharedSizes {
static enum Region {
RO, RW, MD, MC
}
private static class SharedSizeTestData {
public String optionName;
public String optionValue;
public String expectedErrorMsg;
public SharedSizeTestData(String name, String value, String msg) {
optionName = name;
public SharedSizeTestData(Region region, String value, String msg) {
optionName = getName(region);
optionValue = value;
expectedErrorMsg = msg;
}
public SharedSizeTestData(Region region, String msg) {
optionName = getName(region);
optionValue = getValue(region);
expectedErrorMsg = msg;
}
private String getName(Region region) {
String name;
switch (region) {
case RO:
name = "-XX:SharedReadOnlySize";
break;
case RW:
name = "-XX:SharedReadWriteSize";
break;
case MD:
name = "-XX:SharedMiscDataSize";
break;
case MC:
name = "-XX:SharedMiscCodeSize";
break;
default:
name = "Unknown";
break;
}
return name;
}
private String getValue(Region region) {
String value;
switch (region) {
case RO:
value = Platform.is64bit() ? "9M" : "8M";
break;
case RW:
value = Platform.is64bit() ? "12M" : "7M";
break;
case MD:
value = Platform.is64bit() ? "4M" : "2M";
break;
case MC:
value = "120k";
break;
default:
value = "0M";
break;
}
return value;
}
}
private static final SharedSizeTestData[] testTable = {
// values in this part of the test table should cause failure
// (shared space sizes are deliberately too small)
new SharedSizeTestData("-XX:SharedReadOnlySize", "4M", "read only"),
new SharedSizeTestData("-XX:SharedReadWriteSize","4M", "read write"),
// Known issue, JDK-8038422 (assert() on Windows)
// new SharedSizeTestData("-XX:SharedMiscDataSize", "500k", "miscellaneous data"),
// Too small of a misc code size should not cause a vm crash.
// It should result in the following error message:
// Too small of a region size should not cause a vm crash.
// It should result in an error message like the following:
// The shared miscellaneous code space is not large enough
// to preload requested classes. Use -XX:SharedMiscCodeSize=
// to increase the initial size of shared miscellaneous code space.
new SharedSizeTestData("-XX:SharedMiscCodeSize", "20k", "miscellaneous code"),
new SharedSizeTestData(Region.RO, "4M", "read only"),
new SharedSizeTestData(Region.RW, "4M", "read write"),
new SharedSizeTestData(Region.MD, "50k", "miscellaneous data"),
new SharedSizeTestData(Region.MC, "20k", "miscellaneous code"),
// these values are larger than default ones, but should
// be acceptable and not cause failure
new SharedSizeTestData("-XX:SharedReadOnlySize", "20M", null),
new SharedSizeTestData("-XX:SharedReadWriteSize", "20M", null),
new SharedSizeTestData("-XX:SharedMiscDataSize", "20M", null),
new SharedSizeTestData("-XX:SharedMiscCodeSize", "20M", null)
new SharedSizeTestData(Region.RO, "20M", null),
new SharedSizeTestData(Region.RW, "20M", null),
new SharedSizeTestData(Region.MD, "20M", null),
new SharedSizeTestData(Region.MC, "20M", null),
// test with sizes which just meet the minimum required sizes
// the following tests also attempt to use the shared archive
new SharedSizeTestData(Region.RO, "UseArchive"),
new SharedSizeTestData(Region.RW, "UseArchive"),
new SharedSizeTestData(Region.MD, "UseArchive"),
new SharedSizeTestData(Region.MC, "UseArchive")
};
public static void main(String[] args) throws Exception {
@ -82,10 +138,39 @@ public class LimitSharedSizes {
OutputAnalyzer output = new OutputAnalyzer(pb.start());
if (td.expectedErrorMsg != null) {
output.shouldContain("The shared " + td.expectedErrorMsg
+ " space is not large enough");
if (!td.expectedErrorMsg.equals("UseArchive")) {
output.shouldContain("The shared " + td.expectedErrorMsg
+ " space is not large enough");
output.shouldHaveExitValue(2);
output.shouldHaveExitValue(2);
} else {
output.shouldNotContain("space is not large enough");
output.shouldHaveExitValue(0);
// try to use the archive
pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=./" + fileName,
"-XX:+PrintSharedArchiveAndExit",
"-version");
try {
output = new OutputAnalyzer(pb.start());
output.shouldContain("archive is valid");
} catch (RuntimeException e) {
// if sharing failed due to ASLR or similar reasons,
// check whether sharing was attempted at all (UseSharedSpaces)
if ((output.getOutput().contains("Unable to use shared archive") ||
output.getOutput().contains("Unable to map ReadOnly shared space at required address.") ||
output.getOutput().contains("Unable to map ReadWrite shared space at required address.") ||
output.getOutput().contains("Unable to reserve shared space at required address")) &&
output.getExitValue() == 1) {
System.out.println("Unable to use shared archive: test not executed; assumed passed");
return;
}
}
output.shouldHaveExitValue(0);
}
} else {
output.shouldNotContain("space is not large enough");
output.shouldHaveExitValue(0);

View File

@ -0,0 +1,83 @@
/*
* Copyright (c) 2014, 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.
*/
/*
* @test
* @bug 8066670
* @summary Testing -XX:+PrintSharedArchiveAndExit option
* @library /testlibrary
*/
import com.oracle.java.testlibrary.*;
public class PrintSharedArchiveAndExit {
public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
try {
output.shouldContain("Loading classes to share");
output.shouldHaveExitValue(0);
// (1) With a valid archive
pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa",
"-XX:+PrintSharedArchiveAndExit", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldContain("archive is valid");
output.shouldNotContain("java version"); // Should not print JVM version
output.shouldHaveExitValue(0); // Should report success in error code.
pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa",
"-XX:+PrintSharedArchiveAndExit");
output = new OutputAnalyzer(pb.start());
output.shouldContain("archive is valid");
output.shouldNotContain("Usage:"); // Should not print JVM help message
output.shouldHaveExitValue(0); // Should report success in error code.
// (2) With an invalid archive (boot class path has been prepended)
pb = ProcessTools.createJavaProcessBuilder(
"-Xbootclasspath/p:foo.jar",
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa",
"-XX:+PrintSharedArchiveAndExit", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldContain("archive is invalid");
output.shouldNotContain("java version"); // Should not print JVM version
output.shouldHaveExitValue(1); // Should report failure in error code.
pb = ProcessTools.createJavaProcessBuilder(
"-Xbootclasspath/p:foo.jar",
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa",
"-XX:+PrintSharedArchiveAndExit");
output = new OutputAnalyzer(pb.start());
output.shouldContain("archive is invalid");
output.shouldNotContain("Usage:"); // Should not print JVM help message
output.shouldHaveExitValue(1); // Should report failure in error code.
} catch (RuntimeException e) {
e.printStackTrace();
output.shouldContain("Unable to use shared archive");
output.shouldHaveExitValue(1);
}
}
}

View File

@ -41,12 +41,12 @@ import java.io.File;
public class Test8028623 {
public static int à = 1;
public static int \u00CB = 1;
public static String dumpFile = "heap.out";
public static void main (String[] args) {
System.out.println(Ã);
System.out.println(\u00CB);
try {
if (!Platform.shouldSAAttach()) {

View File

@ -282,3 +282,6 @@ b9370464572fc663a38956047aa612d6e7854c3d jdk9-b35
48e4ec70cc1c8651e4a0324d91f193c4edd83af9 jdk9-b37
6c6b34477e93e6fb350035f73ed7c02266b78380 jdk9-b38
a12d347f84176200593999f4da91ae2bb86865b2 jdk9-b39
3f46e2196498de33e7c65efa7b372e46f1faba01 jdk9-b40
71dd8f7649428efd3a56ca5fefc80e59d37b8434 jdk9-b41
47b0d3fa4118b9d56870cf4004987438c501f5c0 jdk9-b42

View File

@ -151,18 +151,17 @@ public class ClassPath implements Serializable {
}
/** Checks for class path components in the following properties:
* "java.class.path", "sun.boot.class.path", "java.ext.dirs"
* "java.class.path", "sun.boot.class.path"
*
* @return class path as used by default by BCEL
*/
public static final String getClassPath() {
String class_path, boot_path, ext_path;
String class_path, boot_path;
try {
class_path = SecuritySupport.getSystemProperty("java.class.path");
boot_path = SecuritySupport.getSystemProperty("sun.boot.class.path");
ext_path = SecuritySupport.getSystemProperty("java.ext.dirs");
}
catch (SecurityException e) {
return "";
@ -173,23 +172,6 @@ public class ClassPath implements Serializable {
getPathComponents(class_path, list);
getPathComponents(boot_path, list);
ArrayList dirs = new ArrayList();
getPathComponents(ext_path, dirs);
for(Iterator e = dirs.iterator(); e.hasNext(); ) {
File ext_dir = new File((String)e.next());
String[] extensions = SecuritySupport.getFileList(ext_dir, new FilenameFilter() {
public boolean accept(File dir, String name) {
name = name.toLowerCase();
return name.endsWith(".zip") || name.endsWith(".jar");
}
});
if(extensions != null)
for(int i=0; i < extensions.length; i++)
list.add(ext_path + File.separatorChar + extensions[i]);
}
StringBuffer buf = new StringBuffer();
for(Iterator e = list.iterator(); e.hasNext(); ) {

View File

@ -243,6 +243,9 @@ public final class SecuritySupport {
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
} else if (protocol.equalsIgnoreCase("jrt")) {
// if the systemId is "jrt" then allow access if "file" allowed
protocol = "file";
}
}
@ -278,7 +281,7 @@ public final class SecuritySupport {
/**
* Read JAXP system property in this order: system property,
* $java.home/lib/jaxp.properties if the system property is not specified
* $java.home/conf/jaxp.properties if the system property is not specified
*
* @param propertyId the Id of the property
* @return the value of the property
@ -292,7 +295,7 @@ public final class SecuritySupport {
}
/**
* Read from $java.home/lib/jaxp.properties for the specified property
* Read from $java.home/conf/jaxp.properties for the specified property
* The program
*
* @param propertyId the Id of the property
@ -306,7 +309,7 @@ public final class SecuritySupport {
synchronized (cacheProps) {
if (firstTime) {
String configFile = getSystemProperty("java.home") + File.separator +
"lib" + File.separator + "jaxp.properties";
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
if (getFileExists(f)) {
is = getFileInputStream(f);
@ -332,12 +335,12 @@ public final class SecuritySupport {
}
/**
* Cache for properties in java.home/lib/jaxp.properties
* Cache for properties in java.home/conf/jaxp.properties
*/
static final Properties cacheProps = new Properties();
/**
* Flag indicating if the program has tried reading java.home/lib/jaxp.properties
* Flag indicating if the program has tried reading java.home/conf/jaxp.properties
*/
static volatile boolean firstTime = true;

View File

@ -558,9 +558,6 @@ public class EnvironmentCheck
* Logs java.class.path and other likely paths; then attempts
* to search those paths for .jar files with Xalan-related classes.
*
* //@todo NOTE: We don't actually search java.ext.dirs for
* // *.jar files therein! This should be updated
*
* @param h Hashtable to put information in
* @see #jarNames
* @see #checkPathForJars(String, String[])
@ -615,20 +612,6 @@ public class EnvironmentCheck
h.put(FOUNDCLASSES + "sun.boot.class.path", classpathJars);
}
//@todo NOTE: We don't actually search java.ext.dirs for
// *.jar files therein! This should be updated
othercp = SecuritySupport.getSystemProperty("java.ext.dirs");
if (null != othercp)
{
h.put("java.ext.dirs", othercp);
classpathJars = checkPathForJars(othercp, jarNames);
if (null != classpathJars)
h.put(FOUNDCLASSES + "java.ext.dirs", classpathJars);
}
//@todo also check other System properties' paths?
// v2 = checkPathForJars(System.getProperty("sun.boot.library.path"), jarNames); // ?? may not be needed
// v3 = checkPathForJars(System.getProperty("java.library.path"), jarNames); // ?? may not be needed

View File

@ -41,7 +41,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
* </li>
* <li>
* If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
* If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
* The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step
* and processed as documented in the prior step.
* </li>

View File

@ -237,6 +237,9 @@ public final class SecuritySupport {
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
} else if (protocol.equalsIgnoreCase("jrt")) {
// if the systemId is "jrt" then allow access if "file" allowed
protocol = "file";
}
}
@ -272,7 +275,7 @@ public final class SecuritySupport {
/**
* Read JAXP system property in this order: system property,
* $java.home/lib/jaxp.properties if the system property is not specified
* $java.home/conf/jaxp.properties if the system property is not specified
*
* @param propertyId the Id of the property
* @return the value of the property
@ -286,7 +289,7 @@ public final class SecuritySupport {
}
/**
* Read from $java.home/lib/jaxp.properties for the specified property
* Read from $java.home/conf/jaxp.properties for the specified property
* The program
*
* @param propertyId the Id of the property
@ -300,7 +303,7 @@ public final class SecuritySupport {
synchronized (cacheProps) {
if (firstTime) {
String configFile = getSystemProperty("java.home") + File.separator +
"lib" + File.separator + "jaxp.properties";
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
if (getFileExists(f)) {
is = getFileInputStream(f);
@ -326,12 +329,12 @@ public final class SecuritySupport {
}
/**
* Cache for properties in java.home/lib/jaxp.properties
* Cache for properties in java.home/conf/jaxp.properties
*/
static final Properties cacheProps = new Properties();
/**
* Flag indicating if the program has tried reading java.home/lib/jaxp.properties
* Flag indicating if the program has tried reading java.home/conf/jaxp.properties
*/
static volatile boolean firstTime = true;

View File

@ -247,7 +247,7 @@ public final class XMLConstants {
* </p>
*
* <p>
* <b>${JAVA_HOME}/lib/jaxp.properties:</b> This configuration file is in standard
* <b>${JAVA_HOME}/conf/jaxp.properties:</b> This configuration file is in standard
* {@link java.util.Properties} format. If the file exists and the system property is specified,
* its value will be used to override the default of the property.
* </p>
@ -314,7 +314,7 @@ public final class XMLConstants {
* </p>
*
* <p>
* <b>${JAVA_HOME}/lib/jaxp.properties:</b> This configuration file is in standard
* <b>${JAVA_HOME}/conf/jaxp.properties:</b> This configuration file is in standard
* java.util.Properties format. If the file exists and the system property is specified,
* its value will be used to override the default of the property.
*
@ -380,7 +380,7 @@ public final class XMLConstants {
* </p>
*
* <p>
* <b>${JAVA_HOME}/lib/jaxp.properties: </b> This configuration file is in standard
* <b>${JAVA_HOME}/conf/jaxp.properties: </b> This configuration file is in standard
* java.util.Properties format. If the file exists and the system property is specified,
* its value will be used to override the default of the property.
*

View File

@ -43,7 +43,7 @@ import java.util.regex.Pattern;
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
* </li>
* <li>
* If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
* If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
* The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step
* and processed as documented in the prior step.
* </li>

View File

@ -50,12 +50,12 @@ class FactoryFinder {
private static boolean debug = false;
/**
* Cache for properties in java.home/lib/jaxp.properties
* Cache for properties in java.home/conf/jaxp.properties
*/
private final static Properties cacheProps = new Properties();
/**
* Flag indicating if properties from java.home/lib/jaxp.properties
* Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
private static volatile boolean firstTime = true;
@ -237,13 +237,13 @@ class FactoryFinder {
if (debug) se.printStackTrace();
}
// try to read from $java.home/lib/jaxp.properties
// try to read from $java.home/conf/jaxp.properties
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
"lib" + File.separator + "jaxp.properties";
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
@ -256,7 +256,7 @@ class FactoryFinder {
final String factoryClassName = cacheProps.getProperty(factoryId);
if (factoryClassName != null) {
dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
return newInstance(type, factoryClassName, null, true);
}
}

View File

@ -66,7 +66,7 @@ public abstract class DocumentBuilderFactory {
* property.
* </li>
* <li>
* Use the properties file "lib/jaxp.properties" in the JRE directory.
* Use the properties file "conf/jaxp.properties" in the JRE directory.
* This configuration file is in standard <code>java.util.Properties
* </code> format and contains the fully qualified name of the
* implementation class with the key being the system property defined

View File

@ -50,12 +50,12 @@ class FactoryFinder {
private static boolean debug = false;
/**
* Cache for properties in java.home/lib/jaxp.properties
* Cache for properties in java.home/conf/jaxp.properties
*/
private static final Properties cacheProps = new Properties();
/**
* Flag indicating if properties from java.home/lib/jaxp.properties
* Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
static volatile boolean firstTime = true;
@ -236,13 +236,13 @@ class FactoryFinder {
if (debug) se.printStackTrace();
}
// try to read from $java.home/lib/jaxp.properties
// try to read from $java.home/conf/jaxp.properties
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
"lib" + File.separator + "jaxp.properties";
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
@ -255,7 +255,7 @@ class FactoryFinder {
final String factoryClassName = cacheProps.getProperty(factoryId);
if (factoryClassName != null) {
dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
return newInstance(type, factoryClassName, null, true);
}
}

View File

@ -70,7 +70,7 @@ public abstract class SAXParserFactory {
* property.
* </li>
* <li>
* Use the properties file "lib/jaxp.properties" in the JRE directory.
* Use the properties file "conf/jaxp.properties" in the JRE directory.
* This configuration file is in standard <code>java.util.Properties
* </code> format and contains the fully qualified name of the
* implementation class with the key being the system property defined

View File

@ -51,12 +51,12 @@ class FactoryFinder {
private static boolean debug = false;
/**
* Cache for properties in java.home/lib/jaxp.properties
* Cache for properties in java.home/conf/jaxp.properties
*/
final private static Properties cacheProps = new Properties();
/**
* Flag indicating if properties from java.home/lib/jaxp.properties
* Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
private static volatile boolean firstTime = true;
@ -271,7 +271,7 @@ class FactoryFinder {
}
// Try read $java.home/lib/stax.properties followed by
// $java.home/lib/jaxp.properties if former not present
// $java.home/conf/jaxp.properties if former not present
String configFile = null;
try {
if (firstTime) {
@ -287,7 +287,7 @@ class FactoryFinder {
}
else {
configFile = ss.getSystemProperty("java.home") + File.separator +
"lib" + File.separator + "jaxp.properties";
"conf" + File.separator + "jaxp.properties";
f = new File(configFile);
if (ss.doesFileExist(f)) {
dPrint("Read properties file "+f);

View File

@ -53,12 +53,12 @@ class FactoryFinder {
private static boolean debug = false;
/**
* Cache for properties in java.home/lib/jaxp.properties
* Cache for properties in java.home/conf/jaxp.properties
*/
private final static Properties cacheProps = new Properties();
/**
* Flag indicating if properties from java.home/lib/jaxp.properties
* Flag indicating if properties from java.home/conf/jaxp.properties
* have been cached.
*/
static volatile boolean firstTime = true;
@ -268,13 +268,13 @@ class FactoryFinder {
if (debug) se.printStackTrace();
}
// try to read from $java.home/lib/jaxp.properties
// try to read from $java.home/conf/jaxp.properties
try {
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
String configFile = ss.getSystemProperty("java.home") + File.separator +
"lib" + File.separator + "jaxp.properties";
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
if (ss.doesFileExist(f)) {
@ -287,7 +287,7 @@ class FactoryFinder {
final String factoryClassName = cacheProps.getProperty(factoryId);
if (factoryClassName != null) {
dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
return newInstance(type, factoryClassName, null, true, true);
}
}

View File

@ -62,7 +62,7 @@ public abstract class TransformerFactory {
* property.
* </li>
* <li>
* Use the properties file "lib/jaxp.properties" in the JRE directory.
* Use the properties file "conf/jaxp.properties" in the JRE directory.
* This configuration file is in standard <code>java.util.Properties
* </code> format and contains the fully qualified name of the
* implementation class with the key being the system property defined

View File

@ -141,7 +141,7 @@ public abstract class SchemaFactory {
* and returns it if it is successfully created.
* </li>
* <li>
* <code>$java.home/lib/jaxp.properties</code> is read and
* <code>$java.home/conf/jaxp.properties</code> is read and
* the value associated with the key being the system property above
* is looked for. If present, the value is processed just like above.
* </li>

View File

@ -181,10 +181,10 @@ class SchemaFactoryFinder {
String javah = ss.getSystemProperty( "java.home" );
String configFile = javah + File.separator +
"lib" + File.separator + "jaxp.properties";
"conf" + File.separator + "jaxp.properties";
// try to read from $java.home/lib/jaxp.properties
// try to read from $java.home/conf/jaxp.properties
try {
if(firstTime){
synchronized(cacheProps){
@ -199,7 +199,7 @@ class SchemaFactoryFinder {
}
}
final String factoryClassName = cacheProps.getProperty(propertyName);
debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
debugPrintln("found " + factoryClassName + " in $java.home/conf/jaxp.properties");
if (factoryClassName != null) {
sf = createInstance(factoryClassName, true);

Some files were not shown because too many files have changed in this diff Show More