This commit is contained in:
J. Duke 2017-07-05 23:29:31 +02:00
commit aaaff4e4e5
61 changed files with 1548 additions and 351 deletions

View File

@ -419,4 +419,7 @@ ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166
111e2e7d00f45c983cdbc9c59ae40552152fcc23 jdk-10+5
03fe61bb7670644cf6e46b5cfafb6b27c0e0157e jdk-10+6
b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169
4d163ec59d989a9261ed7f848bc6303f90869af5 jdk-9+170
aa3c97810d7c484c93a2fd75d3c76ff574deb6d8 jdk-10+7
df33ef1dc163f994177fd97d4d0e73a1e3cb5d85 jdk-10+8

View File

@ -5186,7 +5186,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1494615666
DATE_WHEN_GENERATED=1494858828
###############################################################################
#
@ -48811,173 +48811,63 @@ $as_echo "yes" >&6; }
# Check whether --with-jtreg was given.
if test "${with_jtreg+set}" = set; then :
withval=$with_jtreg;
else
with_jtreg=no
fi
if test "x$with_jtreg" = xno; then
# jtreg disabled
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg" >&5
$as_echo_n "checking for jtreg... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg test harness" >&5
$as_echo_n "checking for jtreg test harness... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no, disabled" >&5
$as_echo "no, disabled" >&6; }
elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
# An explicit path is specified, use it.
JT_HOME="$with_jtreg"
if test ! -d "$JT_HOME"; then
as_fn_error $? "jtreg home directory from --with-jtreg=$with_jtreg does not exist" "$LINENO" 5
fi
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
as_fn_error $? "jtreg home directory from --with-jtreg=$with_jtreg is not a valid jtreg home" "$LINENO" 5
fi
JTREGEXE="$JT_HOME/bin/jtreg"
if test ! -x "$JTREGEXE"; then
as_fn_error $? "jtreg home directory from --with-jtreg=$with_jtreg does not contain valid jtreg executable" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg test harness" >&5
$as_echo_n "checking for jtreg test harness... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $JT_HOME" >&5
$as_echo "$JT_HOME" >&6; }
else
if test "x$with_jtreg" != xyes; then
# with path specified.
JT_HOME="$with_jtreg"
fi
# Try to locate jtreg
if test "x$JT_HOME" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg" >&5
$as_echo_n "checking for jtreg... " >&6; }
# use JT_HOME enviroment var.
# Only process if variable expands to non-empty
if test "x$JT_HOME" != x; then
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
# Input might be given as Windows format, start by converting to
# unix format.
path="$JT_HOME"
new_path=`$CYGPATH -u "$path"`
# Cygwin tries to hide some aspects of the Windows file system, such that binaries are
# named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
# the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
# "foo.exe" is OK but "foo" is an error.
#
# This test is therefore slightly more accurate than "test -f" to check for file precense.
# It is also a way to make sure we got the proper file name for the real test later on.
test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
if test "x$test_shortpath" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5
$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;}
as_fn_error $? "Cannot locate the the path of JT_HOME" "$LINENO" 5
fi
# Call helper function which possibly converts this using DOS-style short mode.
# If so, the updated path is stored in $new_path.
input_path="$new_path"
# Check if we need to convert this using DOS-style short mode. If the path
# contains just simple characters, use it. Otherwise (spaces, weird characters),
# take no chances and rewrite it.
# Note: m4 eats our [], so we need to use [ and ] instead.
has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
if test "x$has_forbidden_chars" != x; then
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
shortmode_path=`$CYGPATH -s -m -a "$input_path"`
path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
# Going to short mode and back again did indeed matter. Since short mode is
# case insensitive, let's make it lowercase to improve readability.
shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
# Now convert it back to Unix-style (cygpath)
input_path=`$CYGPATH -u "$shortmode_path"`
new_path="$input_path"
fi
fi
test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
if test "x$test_cygdrive_prefix" = x; then
# As a simple fix, exclude /usr/bin since it's not a real path.
if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
# The path is in a Cygwin special directory (e.g. /home). We need this converted to
# a path prefixed by /cygdrive for fixpath to work.
new_path="$CYGWIN_ROOT_PATH$input_path"
fi
fi
if test "x$path" != "x$new_path"; then
JT_HOME="$new_path"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5
$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;}
fi
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
path="$JT_HOME"
has_colon=`$ECHO $path | $GREP ^.:`
new_path="$path"
if test "x$has_colon" = x; then
# Not in mixed or Windows style, start by that.
new_path=`cmd //c echo $path`
fi
input_path="$new_path"
# Check if we need to convert this using DOS-style short mode. If the path
# contains just simple characters, use it. Otherwise (spaces, weird characters),
# take no chances and rewrite it.
# Note: m4 eats our [], so we need to use [ and ] instead.
has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
if test "x$has_forbidden_chars" != x; then
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
fi
windows_path="$new_path"
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
unix_path=`$CYGPATH -u "$windows_path"`
new_path="$unix_path"
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
new_path="$unix_path"
fi
if test "x$path" != "x$new_path"; then
JT_HOME="$new_path"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5
$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;}
fi
# Save the first 10 bytes of this path to the storage, so fixpath can work.
all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
else
# We're on a unix platform. Hooray! :)
path="$JT_HOME"
has_space=`$ECHO "$path" | $GREP " "`
if test "x$has_space" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5
$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;}
as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
fi
# Use eval to expand a potential ~
eval path="$path"
if test ! -f "$path" && test ! -d "$path"; then
as_fn_error $? "The path of JT_HOME, which resolves as \"$path\", is not found." "$LINENO" 5
fi
if test -d "$path"; then
JT_HOME="`cd "$path"; $THEPWDCMD -L`"
# JT_HOME set in environment, use it
if test ! -d "$JT_HOME"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring JT_HOME pointing to invalid directory: $JT_HOME" >&5
$as_echo "$as_me: WARNING: Ignoring JT_HOME pointing to invalid directory: $JT_HOME" >&2;}
JT_HOME=
else
dir="`$DIRNAME "$path"`"
base="`$BASENAME "$path"`"
JT_HOME="`cd "$dir"; $THEPWDCMD -L`/$base"
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME" >&5
$as_echo "$as_me: WARNING: Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME" >&2;}
JT_HOME=
elif test ! -x "$JT_HOME/bin/jtreg"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring JT_HOME which does not contain valid jtreg executable: $JT_HOME" >&5
$as_echo "$as_me: WARNING: Ignoring JT_HOME which does not contain valid jtreg executable: $JT_HOME" >&2;}
JT_HOME=
else
JTREGEXE="$JT_HOME/bin/jtreg"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Located jtreg using JT_HOME from environment" >&5
$as_echo "$as_me: Located jtreg using JT_HOME from environment" >&6;}
fi
fi
fi
fi
# jtreg win32 script works for everybody
JTREGEXE="$JT_HOME/bin/jtreg"
if test ! -f "$JTREGEXE"; then
as_fn_error $? "JTReg executable does not exist: $JTREGEXE" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $JTREGEXE" >&5
$as_echo "$JTREGEXE" >&6; }
else
# try to find jtreg on path
if test "x$JT_HOME" = x; then
# JT_HOME is not set in environment, or was deemed invalid.
# Try to find jtreg on path
# Publish this variable in the help.
@ -49175,13 +49065,451 @@ $as_echo "$tool_specified" >&6; }
fi
if test "x$JTREGEXE" != x; then
# That's good, now try to derive JT_HOME
JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)`
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring jtreg from path since a valid jtreg home cannot be found" >&5
$as_echo "$as_me: WARNING: Ignoring jtreg from path since a valid jtreg home cannot be found" >&2;}
JT_HOME=
JTREGEXE=
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: Located jtreg using jtreg executable in path" >&5
$as_echo "$as_me: Located jtreg using jtreg executable in path" >&6;}
fi
fi
fi
if test "x$JTREGEXE" = x; then
as_fn_error $? "Could not find required tool for JTREGEXE" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jtreg test harness" >&5
$as_echo_n "checking for jtreg test harness... " >&6; }
if test "x$JT_HOME" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $JT_HOME" >&5
$as_echo "$JT_HOME" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no, not found" >&5
$as_echo "no, not found" >&6; }
if test "x$with_jtreg" = xyes; then
as_fn_error $? "--with-jtreg was specified, but no jtreg found." "$LINENO" 5
fi
fi
fi
JT_HOME="`$DIRNAME $JTREGEXE`"
# Only process if variable expands to non-empty
if test "x$JTREGEXE" != x; then
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
# First separate the path from the arguments. This will split at the first
# space.
complete="$JTREGEXE"
path="${complete%% *}"
tmp="$complete EOL"
arguments="${tmp#* }"
# Input might be given as Windows format, start by converting to
# unix format.
new_path=`$CYGPATH -u "$path"`
# Now try to locate executable using which
new_path=`$WHICH "$new_path" 2> /dev/null`
# bat and cmd files are not always considered executable in cygwin causing which
# to not find them
if test "x$new_path" = x \
&& test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
new_path=`$CYGPATH -u "$path"`
fi
if test "x$new_path" = x; then
# Oops. Which didn't find the executable.
# The splitting of arguments from the executable at a space might have been incorrect,
# since paths with space are more likely in Windows. Give it another try with the whole
# argument.
path="$complete"
arguments="EOL"
new_path=`$CYGPATH -u "$path"`
new_path=`$WHICH "$new_path" 2> /dev/null`
# bat and cmd files are not always considered executable in cygwin causing which
# to not find them
if test "x$new_path" = x \
&& test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
new_path=`$CYGPATH -u "$path"`
fi
if test "x$new_path" = x; then
# It's still not found. Now this is an unrecoverable error.
{ $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&5
$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&6;}
has_space=`$ECHO "$complete" | $GREP " "`
if test "x$has_space" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5
$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;}
fi
as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5
fi
fi
# Cygwin tries to hide some aspects of the Windows file system, such that binaries are
# named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
# the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
# "foo.exe" is OK but "foo" is an error.
#
# This test is therefore slightly more accurate than "test -f" to check for file presence.
# It is also a way to make sure we got the proper file name for the real test later on.
test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
if test "x$test_shortpath" = x; then
# Short path failed, file does not exist as specified.
# Try adding .exe or .cmd
if test -f "${new_path}.exe"; then
input_to_shortpath="${new_path}.exe"
elif test -f "${new_path}.cmd"; then
input_to_shortpath="${new_path}.cmd"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$new_path\", is invalid." >&5
$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$new_path\", is invalid." >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&5
$as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&6;}
as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5
fi
else
input_to_shortpath="$new_path"
fi
# Call helper function which possibly converts this using DOS-style short mode.
# If so, the updated path is stored in $new_path.
new_path="$input_to_shortpath"
input_path="$input_to_shortpath"
# Check if we need to convert this using DOS-style short mode. If the path
# contains just simple characters, use it. Otherwise (spaces, weird characters),
# take no chances and rewrite it.
# Note: m4 eats our [], so we need to use [ and ] instead.
has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
if test "x$has_forbidden_chars" != x; then
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
shortmode_path=`$CYGPATH -s -m -a "$input_path"`
path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
# Going to short mode and back again did indeed matter. Since short mode is
# case insensitive, let's make it lowercase to improve readability.
shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
# Now convert it back to Unix-style (cygpath)
input_path=`$CYGPATH -u "$shortmode_path"`
new_path="$input_path"
fi
fi
test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
if test "x$test_cygdrive_prefix" = x; then
# As a simple fix, exclude /usr/bin since it's not a real path.
if test "x`$ECHO $input_to_shortpath | $GREP ^/usr/bin/`" = x; then
# The path is in a Cygwin special directory (e.g. /home). We need this converted to
# a path prefixed by /cygdrive for fixpath to work.
new_path="$CYGWIN_ROOT_PATH$input_path"
fi
fi
# remove trailing .exe if any
new_path="${new_path/%.exe/}"
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
# First separate the path from the arguments. This will split at the first
# space.
complete="$JTREGEXE"
path="${complete%% *}"
tmp="$complete EOL"
arguments="${tmp#* }"
# Input might be given as Windows format, start by converting to
# unix format.
new_path="$path"
windows_path="$new_path"
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
unix_path=`$CYGPATH -u "$windows_path"`
new_path="$unix_path"
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
new_path="$unix_path"
fi
# Now try to locate executable using which
new_path=`$WHICH "$new_path" 2> /dev/null`
if test "x$new_path" = x; then
# Oops. Which didn't find the executable.
# The splitting of arguments from the executable at a space might have been incorrect,
# since paths with space are more likely in Windows. Give it another try with the whole
# argument.
path="$complete"
arguments="EOL"
new_path="$path"
windows_path="$new_path"
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
unix_path=`$CYGPATH -u "$windows_path"`
new_path="$unix_path"
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
new_path="$unix_path"
fi
new_path=`$WHICH "$new_path" 2> /dev/null`
# bat and cmd files are not always considered executable in MSYS causing which
# to not find them
if test "x$new_path" = x \
&& test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
&& test "x`$LS \"$path\" 2>/dev/null`" != x; then
new_path="$path"
windows_path="$new_path"
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
unix_path=`$CYGPATH -u "$windows_path"`
new_path="$unix_path"
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
new_path="$unix_path"
fi
fi
if test "x$new_path" = x; then
# It's still not found. Now this is an unrecoverable error.
{ $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&5
$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&6;}
has_space=`$ECHO "$complete" | $GREP " "`
if test "x$has_space" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5
$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;}
fi
as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5
fi
fi
# Now new_path has a complete unix path to the binary
if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then
# Keep paths in /bin as-is, but remove trailing .exe if any
new_path="${new_path/%.exe/}"
# Do not save /bin paths to all_fixpath_prefixes!
else
# Not in mixed or Windows style, start by that.
new_path=`cmd //c echo $new_path`
input_path="$new_path"
# Check if we need to convert this using DOS-style short mode. If the path
# contains just simple characters, use it. Otherwise (spaces, weird characters),
# take no chances and rewrite it.
# Note: m4 eats our [], so we need to use [ and ] instead.
has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
if test "x$has_forbidden_chars" != x; then
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
fi
# Output is in $new_path
windows_path="$new_path"
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
unix_path=`$CYGPATH -u "$windows_path"`
new_path="$unix_path"
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
new_path="$unix_path"
fi
# remove trailing .exe if any
new_path="${new_path/%.exe/}"
# Save the first 10 bytes of this path to the storage, so fixpath can work.
all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
fi
else
# We're on a unix platform. Hooray! :)
# First separate the path from the arguments. This will split at the first
# space.
complete="$JTREGEXE"
path="${complete%% *}"
tmp="$complete EOL"
arguments="${tmp#* }"
# Cannot rely on the command "which" here since it doesn't always work.
is_absolute_path=`$ECHO "$path" | $GREP ^/`
if test -z "$is_absolute_path"; then
# Path to executable is not absolute. Find it.
IFS_save="$IFS"
IFS=:
for p in $PATH; do
if test -f "$p/$path" && test -x "$p/$path"; then
new_path="$p/$path"
break
fi
done
IFS="$IFS_save"
else
# This is an absolute path, we can use it without further modifications.
new_path="$path"
fi
if test "x$new_path" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&5
$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&6;}
has_space=`$ECHO "$complete" | $GREP " "`
if test "x$has_space" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5
$as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;}
fi
as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5
fi
fi
# Now join together the path and the arguments once again
if test "x$arguments" != xEOL; then
new_complete="$new_path ${arguments% *}"
else
new_complete="$new_path"
fi
if test "x$complete" != "x$new_complete"; then
JTREGEXE="$new_complete"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JTREGEXE to \"$new_complete\"" >&5
$as_echo "$as_me: Rewriting JTREGEXE to \"$new_complete\"" >&6;}
fi
fi
# Only process if variable expands to non-empty
if test "x$JT_HOME" != x; then
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
# Input might be given as Windows format, start by converting to
# unix format.
path="$JT_HOME"
new_path=`$CYGPATH -u "$path"`
# Cygwin tries to hide some aspects of the Windows file system, such that binaries are
# named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
# the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
# "foo.exe" is OK but "foo" is an error.
#
# This test is therefore slightly more accurate than "test -f" to check for file precense.
# It is also a way to make sure we got the proper file name for the real test later on.
test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
if test "x$test_shortpath" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5
$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;}
as_fn_error $? "Cannot locate the the path of JT_HOME" "$LINENO" 5
fi
# Call helper function which possibly converts this using DOS-style short mode.
# If so, the updated path is stored in $new_path.
input_path="$new_path"
# Check if we need to convert this using DOS-style short mode. If the path
# contains just simple characters, use it. Otherwise (spaces, weird characters),
# take no chances and rewrite it.
# Note: m4 eats our [], so we need to use [ and ] instead.
has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
if test "x$has_forbidden_chars" != x; then
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
shortmode_path=`$CYGPATH -s -m -a "$input_path"`
path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
# Going to short mode and back again did indeed matter. Since short mode is
# case insensitive, let's make it lowercase to improve readability.
shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
# Now convert it back to Unix-style (cygpath)
input_path=`$CYGPATH -u "$shortmode_path"`
new_path="$input_path"
fi
fi
test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
if test "x$test_cygdrive_prefix" = x; then
# As a simple fix, exclude /usr/bin since it's not a real path.
if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
# The path is in a Cygwin special directory (e.g. /home). We need this converted to
# a path prefixed by /cygdrive for fixpath to work.
new_path="$CYGWIN_ROOT_PATH$input_path"
fi
fi
if test "x$path" != "x$new_path"; then
JT_HOME="$new_path"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5
$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;}
fi
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
path="$JT_HOME"
has_colon=`$ECHO $path | $GREP ^.:`
new_path="$path"
if test "x$has_colon" = x; then
# Not in mixed or Windows style, start by that.
new_path=`cmd //c echo $path`
fi
input_path="$new_path"
# Check if we need to convert this using DOS-style short mode. If the path
# contains just simple characters, use it. Otherwise (spaces, weird characters),
# take no chances and rewrite it.
# Note: m4 eats our [], so we need to use [ and ] instead.
has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
if test "x$has_forbidden_chars" != x; then
# Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
fi
windows_path="$new_path"
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
unix_path=`$CYGPATH -u "$windows_path"`
new_path="$unix_path"
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
new_path="$unix_path"
fi
if test "x$path" != "x$new_path"; then
JT_HOME="$new_path"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5
$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;}
fi
# Save the first 10 bytes of this path to the storage, so fixpath can work.
all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
else
# We're on a unix platform. Hooray! :)
path="$JT_HOME"
has_space=`$ECHO "$path" | $GREP " "`
if test "x$has_space" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5
$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;}
as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
fi
# Use eval to expand a potential ~
eval path="$path"
if test ! -f "$path" && test ! -d "$path"; then
as_fn_error $? "The path of JT_HOME, which resolves as \"$path\", is not found." "$LINENO" 5
fi
if test -d "$path"; then
JT_HOME="`cd "$path"; $THEPWDCMD -L`"
else
dir="`$DIRNAME "$path"`"
base="`$BASENAME "$path"`"
JT_HOME="`cd "$dir"; $THEPWDCMD -L`/$base"
fi
fi
fi

View File

@ -271,9 +271,6 @@ BUNDLES_OUTPUTDIR=$(BUILD_OUTPUT)/bundles
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
# By default, output javadoc directly into image
JAVADOC_OUTPUTDIR = $(DOCS_IMAGE_DIR)
# This does not get overridden in a bootcycle build
CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
@ -819,6 +816,8 @@ INTERIM_IMAGE_DIR := $(SUPPORT_OUTPUTDIR)/interim-image
# Docs image
DOCS_IMAGE_SUBDIR := docs
DOCS_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(DOCS_IMAGE_SUBDIR)
# Output docs directly into image
DOCS_OUTPUTDIR := $(DOCS_IMAGE_DIR)
# Macosx bundles directory definitions
JDK_MACOSX_BUNDLE_SUBDIR=jdk-bundle

View File

@ -926,41 +926,82 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
[
AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
[Regression Test Harness @<:@probed@:>@])],
[],
[with_jtreg=no])
[Regression Test Harness @<:@probed@:>@])])
if test "x$with_jtreg" = xno; then
# jtreg disabled
AC_MSG_CHECKING([for jtreg])
AC_MSG_RESULT(no)
else
if test "x$with_jtreg" != xyes; then
# with path specified.
JT_HOME="$with_jtreg"
AC_MSG_CHECKING([for jtreg test harness])
AC_MSG_RESULT([no, disabled])
elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
# An explicit path is specified, use it.
JT_HOME="$with_jtreg"
if test ! -d "$JT_HOME"; then
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not exist])
fi
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg is not a valid jtreg home])
fi
JTREGEXE="$JT_HOME/bin/jtreg"
if test ! -x "$JTREGEXE"; then
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not contain valid jtreg executable])
fi
AC_MSG_CHECKING([for jtreg test harness])
AC_MSG_RESULT([$JT_HOME])
else
# Try to locate jtreg
if test "x$JT_HOME" != x; then
AC_MSG_CHECKING([for jtreg])
# use JT_HOME enviroment var.
BASIC_FIXUP_PATH([JT_HOME])
# jtreg win32 script works for everybody
JTREGEXE="$JT_HOME/bin/jtreg"
if test ! -f "$JTREGEXE"; then
AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
# JT_HOME set in environment, use it
if test ! -d "$JT_HOME"; then
AC_MSG_WARN([Ignoring JT_HOME pointing to invalid directory: $JT_HOME])
JT_HOME=
else
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
AC_MSG_WARN([Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME])
JT_HOME=
elif test ! -x "$JT_HOME/bin/jtreg"; then
AC_MSG_WARN([Ignoring JT_HOME which does not contain valid jtreg executable: $JT_HOME])
JT_HOME=
else
JTREGEXE="$JT_HOME/bin/jtreg"
AC_MSG_NOTICE([Located jtreg using JT_HOME from environment])
fi
fi
fi
AC_MSG_RESULT($JTREGEXE)
if test "x$JT_HOME" = x; then
# JT_HOME is not set in environment, or was deemed invalid.
# Try to find jtreg on path
BASIC_PATH_PROGS(JTREGEXE, jtreg)
if test "x$JTREGEXE" != x; then
# That's good, now try to derive JT_HOME
JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)`
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
AC_MSG_WARN([Ignoring jtreg from path since a valid jtreg home cannot be found])
JT_HOME=
JTREGEXE=
else
AC_MSG_NOTICE([Located jtreg using jtreg executable in path])
fi
fi
fi
AC_MSG_CHECKING([for jtreg test harness])
if test "x$JT_HOME" != x; then
AC_MSG_RESULT([$JT_HOME])
else
# try to find jtreg on path
BASIC_REQUIRE_PROGS(JTREGEXE, jtreg)
JT_HOME="`$DIRNAME $JTREGEXE`"
AC_MSG_RESULT([no, not found])
if test "x$with_jtreg" = xyes; then
AC_MSG_ERROR([--with-jtreg was specified, but no jtreg found.])
fi
fi
fi
BASIC_FIXUP_EXECUTABLE(JTREGEXE)
BASIC_FIXUP_PATH(JT_HOME)
AC_SUBST(JT_HOME)
AC_SUBST(JTREGEXE)
])

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2017, 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
@ -183,7 +183,7 @@ trap 'nice_exit' EXIT
subrepos="corba jaxp jaxws langtools jdk hotspot nashorn"
jdk_subrepos_extra="closed jdk/src/closed jdk/make/closed jdk/test/closed hotspot/make/closed hotspot/src/closed hotspot/test/closed"
subrepos_extra="$jdk_subrepos_extra deploy install sponsors pubs"
subrepos_extra="$jdk_subrepos_extra deploy install sponsors"
# Only look in specific locations for possible forests (avoids long searches)
pull_default=""

View File

@ -997,7 +997,8 @@ var getJibProfilesDependencies = function (input, common) {
ext: "tar.gz",
revision: "2.38.0-1+1.1",
module: "graphviz-" + input.target_platform,
configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot"
configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot",
environment_path: input.get("graphviz", "install_path")
},
pandoc: {
@ -1005,7 +1006,8 @@ var getJibProfilesDependencies = function (input, common) {
ext: "tar.gz",
revision: "1.17.2+1.0",
module: "pandoc-" + input.target_platform,
configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc"
configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc",
environment_path: input.get("pandoc", "install_path") + "/pandoc"
},
};

View File

@ -6,6 +6,7 @@
<meta name="generator" content="pandoc" />
<title>OpenJDK Build README</title>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href=" ../../jdk/make/data/docs-resources/specs/resources/jdk-default.css" type="text/css" />
</head>
<body>
<div id="header">

View File

@ -6,9 +6,8 @@
<meta name="generator" content="pandoc" />
<title>Testing OpenJDK</title>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href="http://openjdk.java.net/page.css" type="text/css" />
<link rel="stylesheet" href=" ../../jdk/make/data/docs-resources/specs/resources/jdk-default.css" type="text/css" />
<style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
<style type="text/css">pre { font-size: 10pt; }</style>
</head>
<body>
<div id="header">

View File

@ -579,3 +579,6 @@ c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165
1ca7ed1b17b5776930d641d1379834f3140a74e4 jdk-9+167
fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168
16d692be099c5c38eb48cc9aca78b0c900910d5b jdk-9+169
38a240fd58a287acb1963920b92ed4d9c2fd39e3 jdk-9+170
9d4746eca95aec3e5a344bf2520745dcc1d17eed jdk-10+7
f5ded0cf954c770deeecb80f2ba1ba6a05cd979b jdk-10+8

View File

@ -1,22 +0,0 @@
Copyright (c) %YEARS%, 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.

View File

@ -1,20 +0,0 @@
Copyright (c) %YEARS%, 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.

View File

@ -1347,6 +1347,16 @@ void LIRGenerator::volatile_field_store(LIR_Opr value, LIR_Address* address,
void LIRGenerator::volatile_field_load(LIR_Address* address, LIR_Opr result,
CodeEmitInfo* info) {
// 8179954: We need to make sure that the code generated for
// volatile accesses forms a sequentially-consistent set of
// operations when combined with STLR and LDAR. Without a leading
// membar it's possible for a simple Dekker test to fail if loads
// use LD;DMB but stores use STLR. This can happen if C2 compiles
// the stores in one method and C1 compiles the loads in another.
if (! UseBarriersForVolatile) {
__ membar();
}
__ volatile_load_mem_reg(address, result, info);
}

View File

@ -2389,17 +2389,31 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
const Register obj = r4;
const Register off = r19;
const Register flags = r0;
const Register raw_flags = r6;
const Register bc = r4; // uses same reg as obj, so don't mix them
resolve_cache_and_index(byte_no, cache, index, sizeof(u2));
jvmti_post_field_access(cache, index, is_static, false);
load_field_cp_cache_entry(obj, cache, index, off, flags, is_static);
load_field_cp_cache_entry(obj, cache, index, off, raw_flags, is_static);
if (!is_static) {
// obj is on the stack
pop_and_check_object(obj);
}
// 8179954: We need to make sure that the code generated for
// volatile accesses forms a sequentially-consistent set of
// operations when combined with STLR and LDAR. Without a leading
// membar it's possible for a simple Dekker test to fail if loads
// use LDR;DMB but stores use STLR. This can happen if C2 compiles
// the stores in one method and we interpret the loads in another.
if (! UseBarriersForVolatile) {
Label notVolatile;
__ tbz(raw_flags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
__ membar(MacroAssembler::AnyAny);
__ bind(notVolatile);
}
const Address field(obj, off);
Label Done, notByte, notBool, notInt, notShort, notChar,
@ -2407,7 +2421,8 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
// x86 uses a shift and mask or wings it with a shift plus assert
// the mask is not needed. aarch64 just uses bitfield extract
__ ubfxw(flags, flags, ConstantPoolCacheEntry::tos_state_shift, ConstantPoolCacheEntry::tos_state_bits);
__ ubfxw(flags, raw_flags, ConstantPoolCacheEntry::tos_state_shift,
ConstantPoolCacheEntry::tos_state_bits);
assert(btos == 0, "change code, btos != 0");
__ cbnz(flags, notByte);
@ -2529,9 +2544,11 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
#endif
__ bind(Done);
// It's really not worth bothering to check whether this field
// really is volatile in the slow case.
Label notVolatile;
__ tbz(raw_flags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
__ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore);
__ bind(notVolatile);
}
@ -2979,6 +2996,19 @@ void TemplateTable::fast_accessfield(TosState state)
__ null_check(r0);
const Address field(r0, r1);
// 8179954: We need to make sure that the code generated for
// volatile accesses forms a sequentially-consistent set of
// operations when combined with STLR and LDAR. Without a leading
// membar it's possible for a simple Dekker test to fail if loads
// use LDR;DMB but stores use STLR. This can happen if C2 compiles
// the stores in one method and we interpret the loads in another.
if (! UseBarriersForVolatile) {
Label notVolatile;
__ tbz(r3, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
__ membar(MacroAssembler::AnyAny);
__ bind(notVolatile);
}
// access field
switch (bytecode()) {
case Bytecodes::_fast_agetfield:
@ -3027,6 +3057,22 @@ void TemplateTable::fast_xaccess(TosState state)
__ get_cache_and_index_at_bcp(r2, r3, 2);
__ ldr(r1, Address(r2, in_bytes(ConstantPoolCache::base_offset() +
ConstantPoolCacheEntry::f2_offset())));
// 8179954: We need to make sure that the code generated for
// volatile accesses forms a sequentially-consistent set of
// operations when combined with STLR and LDAR. Without a leading
// membar it's possible for a simple Dekker test to fail if loads
// use LDR;DMB but stores use STLR. This can happen if C2 compiles
// the stores in one method and we interpret the loads in another.
if (! UseBarriersForVolatile) {
Label notVolatile;
__ ldrw(r3, Address(r2, in_bytes(ConstantPoolCache::base_offset() +
ConstantPoolCacheEntry::flags_offset())));
__ tbz(r3, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
__ membar(MacroAssembler::AnyAny);
__ bind(notVolatile);
}
// make sure exception is reported in correct bcp range (getfield is
// next instruction)
__ increment(rbcp);

View File

@ -314,7 +314,11 @@ oop StringTable::intern(const char* utf8_string, TRAPS) {
}
void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), processed, removed);
BucketUnlinkContext context;
buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), &context);
_the_table->bulk_free_entries(&context);
*processed = context._num_processed;
*removed = context._num_removed;
}
void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
@ -323,6 +327,7 @@ void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_aliv
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
const int limit = the_table()->table_size();
BucketUnlinkContext context;
for (;;) {
// Grab next set of buckets to scan
int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
@ -332,8 +337,11 @@ void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_aliv
}
int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, processed, removed);
buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, &context);
}
_the_table->bulk_free_entries(&context);
*processed = context._num_processed;
*removed = context._num_removed;
}
void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) {
@ -359,7 +367,7 @@ void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) {
}
}
void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed) {
void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, BucketUnlinkContext* context) {
const int limit = the_table()->table_size();
assert(0 <= start_idx && start_idx <= limit,
@ -383,10 +391,9 @@ void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClos
p = entry->next_addr();
} else {
*p = entry->next();
the_table()->free_entry(entry);
(*removed)++;
context->free_entry(entry);
}
(*processed)++;
context->_num_processed++;
entry = *p;
}
}

View File

@ -61,9 +61,13 @@ private:
// Apply the give oop closure to the entries to the buckets
// in the range [start_idx, end_idx).
static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
typedef StringTable::BucketUnlinkContext BucketUnlinkContext;
// Unlink or apply the give oop closure to the entries to the buckets
// in the range [start_idx, end_idx).
static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed);
// in the range [start_idx, end_idx). Unlinked bucket entries are collected in the given
// context to be freed later.
// This allows multiple threads to work on the table at once.
static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, BucketUnlinkContext* context);
// Hashing algorithm, used as the hash value used by the
// StringTable for bucket selection and comparison (stored in the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -98,7 +98,7 @@ int SymbolTable::_symbols_removed = 0;
int SymbolTable::_symbols_counted = 0;
volatile int SymbolTable::_parallel_claimed_idx = 0;
void SymbolTable::buckets_unlink(int start_idx, int end_idx, int* processed, int* removed) {
void SymbolTable::buckets_unlink(int start_idx, int end_idx, BucketUnlinkContext* context) {
for (int i = start_idx; i < end_idx; ++i) {
HashtableEntry<Symbol*, mtSymbol>** p = the_table()->bucket_addr(i);
HashtableEntry<Symbol*, mtSymbol>* entry = the_table()->bucket(i);
@ -111,15 +111,14 @@ void SymbolTable::buckets_unlink(int start_idx, int end_idx, int* processed, int
break;
}
Symbol* s = entry->literal();
(*processed)++;
context->_num_processed++;
assert(s != NULL, "just checking");
// If reference count is zero, remove.
if (s->refcount() == 0) {
assert(!entry->is_shared(), "shared entries should be kept live");
delete s;
(*removed)++;
*p = entry->next();
the_table()->free_entry(entry);
context->free_entry(entry);
} else {
p = entry->next_addr();
}
@ -132,17 +131,20 @@ void SymbolTable::buckets_unlink(int start_idx, int end_idx, int* processed, int
// Remove unreferenced symbols from the symbol table
// This is done late during GC.
void SymbolTable::unlink(int* processed, int* removed) {
size_t memory_total = 0;
buckets_unlink(0, the_table()->table_size(), processed, removed);
_symbols_removed += *removed;
_symbols_counted += *processed;
BucketUnlinkContext context;
buckets_unlink(0, the_table()->table_size(), &context);
_the_table->bulk_free_entries(&context);
*processed = context._num_processed;
*removed = context._num_removed;
_symbols_removed = context._num_removed;
_symbols_counted = context._num_processed;
}
void SymbolTable::possibly_parallel_unlink(int* processed, int* removed) {
const int limit = the_table()->table_size();
size_t memory_total = 0;
BucketUnlinkContext context;
for (;;) {
// Grab next set of buckets to scan
int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
@ -152,10 +154,15 @@ void SymbolTable::possibly_parallel_unlink(int* processed, int* removed) {
}
int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
buckets_unlink(start_idx, end_idx, processed, removed);
buckets_unlink(start_idx, end_idx, &context);
}
Atomic::add(*processed, &_symbols_counted);
Atomic::add(*removed, &_symbols_removed);
_the_table->bulk_free_entries(&context);
*processed = context._num_processed;
*removed = context._num_removed;
Atomic::add(context._num_processed, &_symbols_counted);
Atomic::add(context._num_removed, &_symbols_removed);
}
// Create a new table and using alternate hash code, populate the new table

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -154,8 +154,11 @@ private:
static volatile int _parallel_claimed_idx;
// Release any dead symbols
static void buckets_unlink(int start_idx, int end_idx, int* processed, int* removed);
typedef SymbolTable::BucketUnlinkContext BucketUnlinkContext;
// Release any dead symbols. Unlinked bucket entries are collected in the given
// context to be freed later.
// This allows multiple threads to work on the table at once.
static void buckets_unlink(int start_idx, int end_idx, BucketUnlinkContext* context);
public:
enum {
symbol_alloc_batch_size = 8,

View File

@ -675,7 +675,7 @@ typedef RehashableHashtable<Symbol*, mtSymbol> RehashableSymbolHashtable;
\
nonstatic_field(BasicHashtable<mtInternal>, _table_size, int) \
nonstatic_field(BasicHashtable<mtInternal>, _buckets, HashtableBucket<mtInternal>*) \
nonstatic_field(BasicHashtable<mtInternal>, _free_list, BasicHashtableEntry<mtInternal>*) \
volatile_nonstatic_field(BasicHashtable<mtInternal>, _free_list, BasicHashtableEntry<mtInternal>*) \
nonstatic_field(BasicHashtable<mtInternal>, _first_free_entry, char*) \
nonstatic_field(BasicHashtable<mtInternal>, _end_block, char*) \
nonstatic_field(BasicHashtable<mtInternal>, _entry_size, int) \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2017, 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
@ -173,6 +173,35 @@ template <MEMFLAGS F> void BasicHashtable<F>::reverse() {
}
}
template <MEMFLAGS F> void BasicHashtable<F>::BucketUnlinkContext::free_entry(BasicHashtableEntry<F>* entry) {
entry->set_next(_removed_head);
_removed_head = entry;
if (_removed_tail == NULL) {
_removed_tail = entry;
}
_num_removed++;
}
template <MEMFLAGS F> void BasicHashtable<F>::bulk_free_entries(BucketUnlinkContext* context) {
if (context->_num_removed == 0) {
assert(context->_removed_head == NULL && context->_removed_tail == NULL,
"Zero entries in the unlink context, but elements linked from " PTR_FORMAT " to " PTR_FORMAT,
p2i(context->_removed_head), p2i(context->_removed_tail));
return;
}
// MT-safe add of the list of BasicHashTableEntrys from the context to the free list.
BasicHashtableEntry<F>* current = _free_list;
while (true) {
context->_removed_tail->set_next(current);
BasicHashtableEntry<F>* old = (BasicHashtableEntry<F>*)Atomic::cmpxchg_ptr(context->_removed_head, &_free_list, current);
if (old == current) {
break;
}
current = old;
}
Atomic::add(-context->_num_removed, &_number_of_entries);
}
// Copy the table to the shared space.

View File

@ -173,11 +173,11 @@ private:
// Instance variables
int _table_size;
HashtableBucket<F>* _buckets;
BasicHashtableEntry<F>* _free_list;
BasicHashtableEntry<F>* volatile _free_list;
char* _first_free_entry;
char* _end_block;
int _entry_size;
int _number_of_entries;
volatile int _number_of_entries;
protected:
@ -225,6 +225,24 @@ protected:
// Free the buckets in this hashtable
void free_buckets();
// Helper data structure containing context for the bucket entry unlink process,
// storing the unlinked buckets in a linked list.
// Also avoids the need to pass around these four members as parameters everywhere.
struct BucketUnlinkContext {
int _num_processed;
int _num_removed;
// Head and tail pointers for the linked list of removed entries.
BasicHashtableEntry<F>* _removed_head;
BasicHashtableEntry<F>* _removed_tail;
BucketUnlinkContext() : _num_processed(0), _num_removed(0), _removed_head(NULL), _removed_tail(NULL) {
}
void free_entry(BasicHashtableEntry<F>* entry);
};
// Add of bucket entries linked together in the given context to the global free list. This method
// is mt-safe wrt. to other calls of this method.
void bulk_free_entries(BucketUnlinkContext* context);
public:
int table_size() { return _table_size; }
void set_entry(int index, BasicHashtableEntry<F>* entry);

View File

@ -24,7 +24,7 @@
import static jdk.test.lib.Asserts.assertEQ;
import static jdk.test.lib.Asserts.assertFalse;
import static jdk.test.lib.Asserts.assertTrue;
import jdk.test.lib.DynamicVMOption;
import jdk.test.lib.management.DynamicVMOption;
/**
* @test TestDynMaxHeapFreeRatio

View File

@ -38,7 +38,7 @@
import static jdk.test.lib.Asserts.assertEQ;
import static jdk.test.lib.Asserts.assertFalse;
import static jdk.test.lib.Asserts.assertTrue;
import jdk.test.lib.DynamicVMOption;
import jdk.test.lib.management.DynamicVMOption;
public class TestDynMinHeapFreeRatio {

View File

@ -26,7 +26,7 @@ import java.util.List;
import java.util.ArrayList;
import jdk.test.lib.ByteCodeLoader;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.Platform;
import sun.management.ManagementFactoryHelper;

View File

@ -31,7 +31,7 @@
* @library /test/lib /
* @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Xmx1g -verbose:gc TestDynShrinkHeap
*/
import jdk.test.lib.DynamicVMOption;
import jdk.test.lib.management.DynamicVMOption;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
import java.util.ArrayList;

View File

@ -31,7 +31,7 @@
* @run main BootstrapRedefine
*/
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;

View File

@ -34,7 +34,7 @@
*/
import jdk.test.lib.Asserts;
import jdk.test.lib.DynamicVMOption;
import jdk.test.lib.management.DynamicVMOption;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.dcmd.PidJcmdExecutor;

View File

@ -29,7 +29,7 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import jdk.test.lib.DynamicVMOption;
import jdk.test.lib.management.DynamicVMOption;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.dcmd.CommandExecutor;

View File

@ -51,7 +51,7 @@ import java.util.List;
import java.util.Properties;
import java.util.Set;
import jdk.test.lib.Asserts;
import jdk.test.lib.DynamicVMOption;
import jdk.test.lib.management.DynamicVMOption;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

View File

@ -34,15 +34,14 @@
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.lang.NoSuchFieldException;
import java.lang.NoSuchMethodException;
import java.lang.RuntimeException;
import java.lang.instrument.ClassDefinition;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.lang.instrument.Instrumentation;
import java.security.ProtectionDomain;
import jdk.test.lib.*;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
public class ModifyAnonymous {

View File

@ -32,8 +32,8 @@
*/
import java.security.ProtectionDomain;
import java.io.InputStream;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;

View File

@ -31,12 +31,9 @@
* @run main NestedUnsafe
*/
import java.security.ProtectionDomain;
import java.io.InputStream;
import java.lang.*;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
// package p;

View File

@ -34,11 +34,10 @@
package p;
import java.security.ProtectionDomain;
import java.io.InputStream;
import java.lang.*;
import jdk.test.lib.*;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
// Test that an anonymous class in package 'p' cannot define its own anonymous class

View File

@ -34,11 +34,10 @@
package p;
import java.security.ProtectionDomain;
import java.io.InputStream;
import java.lang.*;
import jdk.test.lib.*;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
// Test that an anonymous class that gets put in its host's package cannot define

View File

@ -33,7 +33,7 @@
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;

View File

@ -38,8 +38,7 @@
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.InMemoryJavaCompiler;
import java.io.File;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
public class ModuleStress {

View File

@ -30,10 +30,9 @@
* @run main PatchModule2Dirs
*/
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import java.io.File;
public class PatchModule2Dirs {

View File

@ -31,8 +31,7 @@
* @run main PatchModuleCDS
*/
import java.io.File;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

View File

@ -33,7 +33,7 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

View File

@ -31,7 +31,7 @@
* @run main PatchModuleJavaBase
*/
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

View File

@ -31,7 +31,7 @@
* @run main PatchModuleTest
*/
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

View File

@ -31,7 +31,7 @@
* @run main PatchModuleTestJar
*/
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

View File

@ -32,8 +32,8 @@
*/
import java.io.File;
import java.nio.file.Files;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

View File

@ -32,8 +32,7 @@
* @run main PatchModuleTraceCL
*/
import java.io.File;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

View File

@ -36,7 +36,7 @@ import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

View File

@ -31,7 +31,7 @@
* @run main/othervm XbootcpNoVisibility
*/
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;

View File

@ -36,7 +36,7 @@ import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

View File

@ -183,6 +183,7 @@ ifneq ($(filter product-bundles, $(MAKECMDGOALS)), )
$(JDK_SYMBOLS_EXCLUDE_PATTERN) \
$(JDK_EXTRA_EXCLUDES) \
$(SYMBOLS_EXCLUDE_PATTERN) \
$(JDK_IMAGE_HOMEDIR)/demo/% \
, \
$(ALL_JDK_FILES) \
)

View File

@ -38,7 +38,7 @@ $(eval $(call ReadImportMetaData))
################################################################################
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , Javadoc.gmk))
$(eval $(call IncludeCustomExtension, , Docs.gmk))
################################################################################
# Javadoc settings
@ -48,11 +48,8 @@ $(eval $(call IncludeCustomExtension, , Javadoc.gmk))
MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) \
$(SUPPORT_OUTPUTDIR)/rmic/* $(JDK_TOPDIR)/src/*/share/doc/stub)
# Should we use -Xdocrootparent? Allow custom to overwrite.
DOCROOTPARENT_FLAG ?= TRUE
# URLs
JAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=homepage
JAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&amp;id=homepage
BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/
COPYRIGHT_URL := {@docroot}/../legal/cpyr.html
LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html
@ -130,7 +127,7 @@ JAVADOC_BOTTOM := \
<span style="font-size:smaller"> \
<a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a><br> \
For further API reference and developer documentation, see \
<a href="$(JAVADOC_BASE_URL)/index.html" target="_blank">Java SE \
<a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \
Documentation</a>. That documentation contains more detailed, \
developer-targeted descriptions, with conceptual overviews, definitions \
of terms, workarounds, and working code examples.<br> \
@ -164,6 +161,11 @@ JDK_JAVADOC_DOC_TITLE := Java&trade; Platform, Standard Edition Development Kit
JAVASE_JAVADOC_DOC_TITLE := Java&trade; Platform, Standard Edition \
$(VERSION_SPECIFICATION)<br>API Specification
################################################################################
JDK_DOCS_INDEX_HTML_TITLE := Java&trade; Platform, Standard Edition Development Kit \
(JDK&trade;) $(VERSION_SPECIFICATION) Specification<br>$(DRAFT_MARKER_TITLE)
################################################################################
# Functions
@ -231,10 +233,6 @@ define SetupApiDocsGenerationBody
$1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \
$$(JAVADOC_DISABLED_DOCLINT)))
ifeq ($$($$DOCROOTPARENT_FLAG), TRUE)
$1_OPTIONS += -Xdocrootparent $$(JAVADOC_BASE_URL)
endif
$1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
$1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)'
$1_OPTIONS += -header '$$($1_HEADER_TITLE)'
@ -321,7 +319,7 @@ JDK_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.
$(eval $(call SetupApiDocsGeneration, JDK_API, \
MODULES := $(JDK_JAVADOC_MODULES), \
NAME := JDK, \
TARGET_DIR := $(JAVADOC_OUTPUTDIR)/api, \
TARGET_DIR := $(DOCS_OUTPUTDIR)/api, \
OVERVIEW := $(JDK_JAVADOC_OVERVIEW), \
DOC_TITLE := $(JDK_JAVADOC_DOC_TITLE), \
WINDOW_TITLE := $(JAVADOC_WINDOW_TITLE), \
@ -356,6 +354,18 @@ $(eval $(call SetupApiDocsGeneration, JAVASE_API, \
# Targets generated are returned in JAVASE_API_JAVADOC_TARGETS and
# JAVASE_API_MODULEGRAPH_TARGETS.
################################################################################
JDK_DOCS_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
$(JDK_DOCS_INDEX_HTML): $(BUILD_JIGSAW_TOOLS)
$(call LogInfo, Generating docs bundle index page)
$(MKDIR) -p $(@D)
$(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_DOCS_INDEX_HTML_TITLE)' \
--output $@
JDK_DOCS_INDEX_HTML_TARGETS := $(JDK_DOCS_INDEX_HTML)
################################################################################
# Copy JDK specs files
@ -367,13 +377,15 @@ COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib %.css
$(foreach m, $(ALL_MODULES), \
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
$(if $(SPECS_$m), \
$(eval $(call SetupCopyFiles, COPY_$m, \
SRC := $(SPECS_$m), \
FILES := $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $(SPECS_$m))), \
DEST := $(JAVADOC_OUTPUTDIR)/specs/, \
)) \
$(eval JDK_SPECS_TARGETS += $(COPY_$m)) \
$(foreach d, $(SPECS_$m), \
$(if $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \
$(eval $(call SetupCopyFiles, COPY_$m, \
SRC := $d, \
FILES := $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \
DEST := $(DOCS_OUTPUTDIR)/specs/, \
)) \
$(eval JDK_SPECS_TARGETS += $(COPY_$m)) \
) \
) \
)
@ -382,7 +394,7 @@ GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/specs
$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
DEST := $(JAVADOC_OUTPUTDIR)/specs/, \
DEST := $(DOCS_OUTPUTDIR)/specs/, \
))
JDK_SPECS_TARGETS += $(COPY_GLOBAL_RESOURCES)
@ -390,7 +402,7 @@ ifeq ($(ENABLE_FULL_DOCS), true)
# For all markdown files in $module/share/specs directories, convert them to
# html.
GLOBAL_SPECS_DEFAULT_CSS_FILE := $(JAVADOC_OUTPUTDIR)/specs/resources/jdk-default.css
GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/specs/resources/jdk-default.css
$(foreach m, $(ALL_MODULES), \
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
@ -399,7 +411,7 @@ ifeq ($(ENABLE_FULL_DOCS), true)
$(eval $(call SetupProcessMarkdown, CONVERT_MARKDOWN_$m_$(patsubst $(TOPDIR)/%,%,$d), \
SRC := $d, \
FILES := $(filter %.md, $(call CacheFind, $d)), \
DEST := $(JAVADOC_OUTPUTDIR)/specs/, \
DEST := $(DOCS_OUTPUTDIR)/specs/, \
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
)) \
) \
@ -413,7 +425,7 @@ endif
JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
$(eval $(call SetupCopyFiles, COPY_JDWP_PROTOCOL, \
FILES := $(JDWP_PROTOCOL), \
DEST := $(JAVADOC_OUTPUTDIR)/specs/jdwp, \
DEST := $(DOCS_OUTPUTDIR)/specs/jdwp, \
))
JDK_SPECS_TARGETS += $(COPY_JDWP_PROTOCOL)
@ -421,7 +433,7 @@ JDK_SPECS_TARGETS += $(COPY_JDWP_PROTOCOL)
JVMTI_HTML := $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html
$(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
FILES := $(JVMTI_HTML), \
DEST := $(JAVADOC_OUTPUTDIR)/specs, \
DEST := $(DOCS_OUTPUTDIR)/specs, \
))
JDK_SPECS_TARGETS += $(COPY_JVMTI_HTML)
@ -432,7 +444,7 @@ JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
JAVADOC_ZIP_FILE := $(OUTPUT_ROOT)/bundles/$(JAVADOC_ZIP_NAME)
$(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \
SRC := $(JAVADOC_OUTPUTDIR), \
SRC := $(DOCS_OUTPUTDIR), \
ZIP := $(JAVADOC_ZIP_FILE), \
EXTRA_DEPS := $(JDK_API_JAVADOC_TARGETS) $(JDK_API_MODULEGRAPH_TARGETS) \
$(JDK_SPECS_TARGETS), \
@ -442,20 +454,23 @@ ZIP_TARGETS += $(BUILD_JAVADOC_ZIP)
################################################################################
docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS)
docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) $(JDK_API_CUSTOM_TARGETS)
docs-jdk-api-modulegraph: $(JDK_API_MODULEGRAPH_TARGETS)
docs-javase-api-javadoc: $(JAVASE_API_JAVADOC_TARGETS)
docs-javase-api-javadoc: $(JAVASE_API_JAVADOC_TARGETS) $(JAVASE_API_CUSTOM_TARGETS)
docs-javase-api-modulegraph: $(JAVASE_API_MODULEGRAPH_TARGETS)
docs-jdk-specs: $(JDK_SPECS_TARGETS)
docs-jdk-index: $(JDK_DOCS_INDEX_HTML_TARGETS)
docs-zip: $(ZIP_TARGETS)
all: docs-jdk-api-javadoc docs-jdk-api-modulegraph docs-javase-api-javadoc \
docs-javase-api-modulegraph docs-jdk-specs docs-zip
docs-javase-api-modulegraph docs-jdk-specs docs-jdk-index docs-zip
.PHONY: default all docs-jdk-api-javadoc docs-jdk-api-modulegraph \
docs-javase-api-javadoc docs-javase-api-modulegraph docs-jdk-specs docs-zip
docs-javase-api-javadoc docs-javase-api-modulegraph docs-jdk-specs \
docs-jdk-index docs-zip

View File

@ -277,7 +277,10 @@ ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
demos-jdk:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
ALL_TARGETS += demos-jdk
test-image-demos-jdk:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk images)
ALL_TARGETS += demos-jdk test-image-demos-jdk
################################################################################
# Jigsaw specific data and analysis targets.
@ -363,29 +366,32 @@ ALL_TARGETS += store-source-revision create-source-revision-tracker bootcycle-im
# If building full docs, to complete docs-*-api we need both the javadoc and
# modulegraph targets.
docs-jdk-api-javadoc:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-jdk-api-javadoc)
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-api-javadoc)
docs-jdk-api-modulegraph:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-jdk-api-modulegraph)
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-api-modulegraph)
docs-javase-api-javadoc:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-javase-api-javadoc)
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-javase-api-javadoc)
docs-javase-api-modulegraph:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-javase-api-modulegraph)
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-javase-api-modulegraph)
docs-jdk-specs:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-jdk-specs)
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-specs)
docs-jdk-index:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-jdk-index)
docs-zip:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-zip)
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Docs.gmk docs-zip)
update-build-docs:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f UpdateBuildDocs.gmk)
ALL_TARGETS += docs-jdk-api-javadoc docs-jdk-api-modulegraph \
docs-javase-api-javadoc docs-javase-api-modulegraph docs-jdk-specs \
docs-zip update-build-docs
docs-jdk-index docs-zip update-build-docs
################################################################################
# Cross compilation support
@ -631,6 +637,7 @@ else
# jdk libs, even though they don't need to. To avoid warnings, make sure they
# aren't built until after libjava and libjvm are available to link to.
demos-jdk: java.base-libs exploded-image-optimize
test-image-demos-jdk: demos-jdk
# Declare dependency from <module>-java to <module>-gensrc
$(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
@ -793,6 +800,8 @@ else
# The gensrc steps for hotspot and jdk.jdi create html spec files.
docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc
docs-jdk-index: exploded-image buildtools-modules
docs-zip: docs-jdk
test: jdk-image test-image
@ -922,7 +931,7 @@ ifeq ($(ENABLE_FULL_DOCS), true)
docs-javase-api: docs-javase-api-modulegraph
endif
docs-jdk: docs-jdk-api docs-jdk-specs
docs-jdk: docs-jdk-api docs-jdk-specs docs-jdk-index
docs-javase: docs-javase-api
# alias for backwards compatibility
@ -963,7 +972,8 @@ docs-image: docs-jdk
# This target builds the test image
test-image: prepare-test-image test-image-hotspot-jtreg-native \
test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest
test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest \
test-image-demos-jdk
# all-images builds all our deliverables as images.
all-images: product-images test-image docs-image

View File

@ -299,6 +299,12 @@ define SetupRunJtregTestBody
$1_TEST_NAME := $$(strip $$(patsubst jtreg:%, %, $$($1_TEST)))
$1_COMPONENT := $$(firstword $$(subst /, $$(SPACE), $$($1_TEST_NAME)))
ifeq ($$(JT_HOME), )
$$(info Error: jtreg framework is not found.)
$$(info Please run configure using --with-jtreg.)
$$(error Cannot continue)
endif
# Unfortunately, we need different defaults for some JTREG values,
# depending on what component we're running.

View File

@ -391,7 +391,10 @@ define ReadSingleImportMetaData
else ifeq ($$(classloader), ext)
PLATFORM_MODULES += $1
endif
DOCS_MODULES += $1
ifneq ($$(include_in_docs), false)
# defaults to true if unspecified
DOCS_MODULES += $1
endif
else
# Default to include in all
JRE_MODULES += $1

View File

@ -23,7 +23,7 @@
import java.io.PrintWriter;
import java.lang.instrument.*;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
/*
* Helper class to write tests that redefine classes.

View File

@ -0,0 +1,84 @@
/*
* Copyright (c) 2014, 2017, 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.
*/
package jdk.test.lib;
import java.util.Collection;
import java.util.Comparator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* A logger designed specifically to allow collecting ordered log messages
* in a multi-threaded environment without involving any kind of locking.
* <p>
* It is particularly useful in situations when one needs to assert various
* details about the tested thread state or the locks it hold while also wanting
* to produce diagnostic log messages.
* <p>
* The logger does not provide any guarantees about the completness of the
* logs written from different threads - it is up to the caller to make sure
* {@code toString()} method is called only when all the activity has ceased
* and the per-thread logs contain all the necessary data.
*
* @author Jaroslav Bachorik
**/
public class LockFreeLogger {
private final AtomicInteger logCntr = new AtomicInteger(0);
private final Collection<Map<Integer, String>> allRecords = new ConcurrentLinkedQueue<>();
private final ThreadLocal<Map<Integer, String>> records = ThreadLocal.withInitial(ConcurrentHashMap::new);
public LockFreeLogger() {
allRecords.add(records.get());
}
/**
* Log a message
* @param format Message format
* @param params Message parameters
*/
public void log(String format, Object ... params) {
int id = logCntr.getAndIncrement();
records.get().put(id, String.format(format, params));
}
/**
* Will generate an aggregated log of chronologically ordered messages.
* <p>
* Make sure that you call this method only when all the related threads
* have finished; otherwise you might get incomplete data.
*
* @return An aggregated log of chronologically ordered messages
*/
@Override
public String toString() {
return allRecords.stream()
.flatMap(m -> m.entrySet().stream())
.sorted(Comparator.comparing(Map.Entry::getKey))
.map(Map.Entry::getValue)
.collect(Collectors.joining());
}
}

View File

@ -0,0 +1,272 @@
/*
* Copyright (c) 2017, 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.
*/
package jdk.test.lib;
import java.io.PrintStream;
import java.io.UncheckedIOException;
import java.io.IOException;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.net.NetworkInterface.getNetworkInterfaces;
import static java.util.Collections.list;
/**
* Helper class for retrieving network interfaces and local addresses
* suitable for testing.
*/
public class NetworkConfiguration {
private Map<NetworkInterface,List<Inet4Address>> ip4Interfaces;
private Map<NetworkInterface,List<Inet6Address>> ip6Interfaces;
private NetworkConfiguration(
Map<NetworkInterface,List<Inet4Address>> ip4Interfaces,
Map<NetworkInterface,List<Inet6Address>> ip6Interfaces) {
this.ip4Interfaces = ip4Interfaces;
this.ip6Interfaces = ip6Interfaces;
}
/**
* Returns a stream of interfaces suitable for functional tests.
*/
public Stream<NetworkInterface> interfaces() {
return Stream.concat(ip4Interfaces(), ip6Interfaces())
.distinct();
}
/**
* Returns a stream of interfaces suitable for IPv4 functional tests.
*/
public Stream<NetworkInterface> ip4Interfaces() {
return ip4Interfaces.keySet()
.stream()
.filter(NetworkConfiguration::isNotExcludedInterface)
.filter(hasIp4Addresses);
}
/**
* Returns a stream of interfaces suitable for IPv6 functional tests.
*/
public Stream<NetworkInterface> ip6Interfaces() {
return ip6Interfaces.keySet()
.stream()
.filter(NetworkConfiguration::isNotExcludedInterface)
.filter(hasIp6Addresses);
}
private static boolean isNotExcludedInterface(NetworkInterface nif) {
if (Platform.isOSX() && nif.getName().contains("awdl")) {
return false;
}
String dName = nif.getDisplayName();
if (Platform.isWindows() && dName != null && dName.contains("Teredo")) {
return false;
}
return true;
}
private final Predicate<NetworkInterface> hasIp4Addresses = nif ->
ip4Interfaces.get(nif).stream().anyMatch(a -> !a.isAnyLocalAddress());
private final Predicate<NetworkInterface> hasIp6Addresses = nif ->
ip6Interfaces.get(nif).stream().anyMatch(a -> !a.isAnyLocalAddress());
/**
* Returns a stream of interfaces suitable for IPv4 multicast tests.
*/
public Stream<NetworkInterface> ip4MulticastInterfaces() {
return ip4Interfaces().filter(supportsIp4Multicast);
}
/**
* Returns a stream of interfaces suitable for IPv6 multicast tests.
*/
public Stream<NetworkInterface> ip6MulticastInterfaces() {
return ip6Interfaces().filter(supportsIp6Multicast);
}
private final Predicate<NetworkInterface> supportsIp4Multicast = nif -> {
try {
if (!nif.supportsMulticast() || nif.isLoopback()) {
return false;
}
return hasIp4Addresses.test(nif);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
};
private final Predicate<NetworkInterface> supportsIp6Multicast = nif -> {
try {
if (!nif.supportsMulticast() || nif.isLoopback()) {
return false;
}
return hasIp6Addresses.test(nif);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
};
/**
* Returns all addresses on all "functional" interfaces.
*/
public Stream<InetAddress> addresses(NetworkInterface nif) {
return Stream.concat(ip4Interfaces.get(nif).stream(),
ip6Interfaces.get(nif).stream());
}
/**
* Returns all IPv4 addresses on all "functional" interfaces.
*/
public Stream<Inet4Address> ip4Addresses() {
return ip4Interfaces().flatMap(this::ip4Addresses);
}
/**
* Returns all IPv6 addresses on all "functional" interfaces.
*/
public Stream<Inet6Address> ip6Addresses() {
return ip6Interfaces().flatMap(this::ip6Addresses);
}
/**
* Returns all IPv4 addresses the given interface.
*/
public Stream<Inet4Address> ip4Addresses(NetworkInterface nif) {
return ip4Interfaces.get(nif).stream();
}
/**
* Returns all IPv6 addresses for the given interface.
*/
public Stream<Inet6Address> ip6Addresses(NetworkInterface nif) {
return ip6Interfaces.get(nif).stream();
}
/**
* Return a NetworkConfiguration instance.
*/
public static NetworkConfiguration probe() throws IOException {
Map<NetworkInterface, List<Inet4Address>> ip4Interfaces = new HashMap<>();
Map<NetworkInterface, List<Inet6Address>> ip6Interfaces = new HashMap<>();
List<NetworkInterface> nifs = list(getNetworkInterfaces());
for (NetworkInterface nif : nifs) {
// ignore interfaces that are down
if (!nif.isUp() || nif.isPointToPoint()) {
continue;
}
List<Inet4Address> ip4Addresses = new LinkedList<>();
List<Inet6Address> ip6Addresses = new LinkedList<>();
ip4Interfaces.put(nif, ip4Addresses);
ip6Interfaces.put(nif, ip6Addresses);
for (InetAddress addr : list(nif.getInetAddresses())) {
if (addr instanceof Inet4Address) {
ip4Addresses.add((Inet4Address) addr);
} else if (addr instanceof Inet6Address) {
ip6Addresses.add((Inet6Address) addr);
}
}
}
return new NetworkConfiguration(ip4Interfaces, ip6Interfaces);
}
@Override
public String toString() {
return interfaces().map(NetworkConfiguration::interfaceInformation)
.collect(Collectors.joining());
}
/** Returns detailed information for the given interface. */
public static String interfaceInformation(NetworkInterface nif) {
StringBuilder sb = new StringBuilder();
try {
sb.append("Display name: ")
.append(nif.getDisplayName())
.append("\n");
sb.append("Name: ")
.append(nif.getName())
.append("\n");
for (InetAddress inetAddress : list(nif.getInetAddresses())) {
sb.append("InetAddress: ")
.append(inetAddress)
.append("\n");
}
sb.append("Up? ")
.append(nif.isUp())
.append("\n");
sb.append("Loopback? ")
.append(nif.isLoopback())
.append("\n");
sb.append("PointToPoint? ")
.append(nif.isPointToPoint())
.append("\n");
sb.append("Supports multicast? ")
.append(nif.supportsMulticast())
.append("\n");
sb.append("Virtual? ")
.append(nif.isVirtual())
.append("\n");
sb.append("Hardware address: ")
.append(Arrays.toString(nif.getHardwareAddress()))
.append("\n");
sb.append("MTU: ")
.append(nif.getMTU())
.append("\n");
sb.append("Index: ")
.append(nif.getIndex())
.append("\n");
sb.append("\n");
return sb.toString();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
/** Prints all the system interface information to the give stream. */
public static void printSystemConfiguration(PrintStream out) {
try {
out.println("*** all system network interface configuration ***");
for (NetworkInterface nif : list(getNetworkInterfaces())) {
out.print(interfaceInformation(nif));
}
out.println("*** end ***");
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2014, 2017, 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.
*/
package jdk.test.lib.classloader;
import java.util.function.Predicate;
/**
* A classloader, which using target classloader in case provided condition
* for class name is met, and using parent otherwise
*/
public class FilterClassLoader extends ClassLoader {
private final ClassLoader target;
private final Predicate<String> condition;
public FilterClassLoader(ClassLoader target, ClassLoader parent,
Predicate<String> condition) {
super(parent);
this.condition = condition;
this.target = target;
}
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (condition.test(name)) {
return target.loadClass(name);
}
return super.loadClass(name);
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2014, 2017, 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.
*/
package jdk.test.lib.classloader;
import java.net.URL;
import java.net.URLClassLoader;
/**
* An url classloader, which trying to load class from provided URL[] first,
* and using parent classloader in case it failed
*/
public class ParentLastURLClassLoader extends URLClassLoader {
public ParentLastURLClassLoader(URL urls[], ClassLoader parent) {
super(urls, parent);
}
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
try {
Class<?> c = findClass(name);
if (c != null) {
return c;
}
} catch (ClassNotFoundException e) {
// ignore
}
return super.loadClass(name);
}
}

View File

@ -21,7 +21,7 @@
* questions.
*/
package jdk.test.lib;
package jdk.test.lib.compiler;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@ -56,7 +56,7 @@ import javax.tools.ToolProvider;
*
* <pre>
* {@code
* import jdk.test.lib.InMemoryJavaCompiler;
* import jdk.test.lib.compiler.InMemoryJavaCompiler;
* import jdk.test.lib.ByteClassLoader;
*
* class Example {

View File

@ -0,0 +1,129 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*/
package jdk.test.lib.compiler;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
/**
* Utility class for creating test modules.
*/
public class ModuleInfoMaker {
private static final String MODULE_INFO_JAVA = "module-info.java";
private static final Pattern MODULE_PATTERN =
Pattern.compile("module\\s+((?:\\w+\\.)*)");
private static final Pattern PACKAGE_PATTERN =
Pattern.compile("package\\s+(((?:\\w+\\.)*)(?:\\w+))");
private static final Pattern CLASS_PATTERN =
Pattern.compile("(?:public\\s+)?(?:class|enum|interface)\\s+(\\w+)");
private final Path dir;
public ModuleInfoMaker(Path dir) {
this.dir = dir;
}
/**
* Create java source files of the given module
*/
public void writeJavaFiles(String module, String moduleInfoJava, String... contents)
throws IOException
{
Path msrc = dir.resolve(module);
new JavaSource(moduleInfoJava).write(msrc);
for (String c : contents) {
new JavaSource(c).write(msrc);
}
}
/**
* Compile the module to the given destination.
*/
public void compile(String module, Path dest, String... options)
throws IOException
{
Path msrc = dir.resolve(module);
String[] args =
Stream.concat(Arrays.stream(options),
Stream.of("--module-source-path",
dir.toString())).toArray(String[]::new);
if (!CompilerUtils.compile(msrc, dest, args)) {
throw new Error("Fail to compile " + module);
}
}
static class JavaSource {
final String source;
JavaSource(String source) {
this.source = source;
}
/**
* Writes the source code to a file in a specified directory.
* @param dir the directory
* @throws IOException if there is a problem writing the file
*/
public void write(Path dir) throws IOException {
Path file = dir.resolve(getJavaFileNameFromSource(source));
Files.createDirectories(file.getParent());
try (BufferedWriter out = Files.newBufferedWriter(file)) {
out.write(source.replace("\n", System.lineSeparator()));
}
}
/**
* Extracts the Java file name from the class declaration.
* This method is intended for simple files and uses regular expressions,
* so comments matching the pattern can make the method fail.
*/
static String getJavaFileNameFromSource(String source) {
String packageName = null;
Matcher matcher = MODULE_PATTERN.matcher(source);
if (matcher.find())
return MODULE_INFO_JAVA;
matcher = PACKAGE_PATTERN.matcher(source);
if (matcher.find())
packageName = matcher.group(1).replace(".", "/");
matcher = CLASS_PATTERN.matcher(source);
if (matcher.find()) {
String className = matcher.group(1) + ".java";
return (packageName == null) ? className : packageName + "/" + className;
} else if (packageName != null) {
return packageName + "/package-info.java";
} else {
throw new Error("Could not extract the java class " +
"name from the provided source");
}
}
}
}

View File

@ -20,7 +20,8 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.test.lib;
package jdk.test.lib.management;
import com.sun.management.HotSpotDiagnosticMXBean;
import java.lang.management.ManagementFactory;

View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 2015, 2017, 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.
*/
package jdk.test.lib.management;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
/**
* A few utility methods to use ThreadMXBean.
*/
public final class ThreadMXBeanTool {
/**
* Waits until {@link Thread} is in the certain {@link Thread.State}
* and blocking on {@code object}.
*
* @param state The thread state
* @param object The object to block on
*/
public static void waitUntilBlockingOnObject(Thread thread, Thread.State state, Object object)
throws InterruptedException {
String want = object == null ? null : object.getClass().getName() + '@'
+ Integer.toHexString(System.identityHashCode(object));
ThreadMXBean tmx = ManagementFactory.getThreadMXBean();
while (thread.isAlive()) {
ThreadInfo ti = tmx.getThreadInfo(thread.getId());
if (ti.getThreadState() == state
&& (want == null || want.equals(ti.getLockName()))) {
return;
}
Thread.sleep(1);
}
}
/**
* Waits until {@link Thread} is in native.
*/
public static void waitUntilInNative(Thread thread) throws InterruptedException {
ThreadMXBean tmx = ManagementFactory.getThreadMXBean();
while (thread.isAlive()) {
ThreadInfo ti = tmx.getThreadInfo(thread.getId());
if (ti.isInNative()) {
return;
}
Thread.sleep(1);
}
}
}

View File

@ -0,0 +1,56 @@
/*
* Copyright (c) 2015, 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.
*/
package jdk.test.lib.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
/**
* Common library for various test serialization utility functions.
*/
public final class SerializationUtils {
/**
* Serialize an object into byte array.
*/
public static byte[] serialize(Object obj) throws IOException {
ByteArrayOutputStream bs = new ByteArrayOutputStream();
try (ObjectOutputStream out = new ObjectOutputStream(bs)) {
out.writeObject(obj);
}
return bs.toByteArray();
}
/**
* Deserialize an object from byte array.
*/
public static Object deserialize(byte[] ba) throws IOException, ClassNotFoundException {
try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(ba))) {
return in.readObject();
}
}
private SerializationUtils() {}
}