This commit is contained in:
Alejandro Murillo 2016-09-30 03:24:03 -07:00
commit d058e0d477
238 changed files with 4442 additions and 1617 deletions

View File

@ -379,3 +379,4 @@ e17429a7e843c4a4ed3651458d0f950970edcbcc jdk-9+133
a71210c0d9800eb6925b61ecd6198abd554f90ee jdk-9+134
e384420383a5b79fa0012ebcb25d8f83cff7f777 jdk-9+135
1b4b5d01aa11edf24b6fadbe3d2f3e411e3b02cd jdk-9+136
9cb87c88ed851c0575b8ead753ea238ed5b544e9 jdk-9+137

View File

@ -379,3 +379,4 @@ be1218f792a450dfb5d4b1f82616b9d95a6a732e jdk-9+133
065724348690eda41fc69112278d8da6dcde548c jdk-9+134
82b94cb5f342319d2cda77f9fa59703ad7fde576 jdk-9+135
3ec350f5f32af249b59620d7e37b54bdcd77b233 jdk-9+136
d7f519b004254b19e384131d9f0d0e40e31a0fd3 jdk-9+137

View File

@ -28,8 +28,8 @@
### It also performs some sanity checks on make.
###
# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU Make.
# /usr/ccs/bin/make lacks basically every other flow control mechanism.
# The shell code below will be executed on /usr/bin/make on Solaris, but not in GNU Make.
# /usr/bin/make lacks basically every other flow control mechanism.
.TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU Make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
# The .FEATURES variable is likely to be unique for GNU Make.

View File

@ -626,8 +626,7 @@ number of different configurations, e.g. debug, release, 32, 64, etc.</p>
<p>The Common UNIX Printing System (CUPS) Headers are required for building the
OpenJDK on Solaris and Linux. The Solaris header files can be obtained by
installing the package <strong>SFWcups</strong> from the Solaris Software Companion
CD/DVD, these often will be installed into the directory <code>/opt/sfw/cups</code>.</p>
installing the package <strong>print/cups</strong>.</p>
<p>The CUPS header files can always be downloaded from
<a href="http://www.cups.org">www.cups.org</a>.</p>
@ -1111,8 +1110,7 @@ version, see "<a href="#buildgmake">Building GNU make</a>".</li>
<li>Place the location of the GNU make binary in the <code>PATH</code>.</li>
<li><strong>Solaris:</strong> Do NOT use <code>/usr/bin/make</code> on Solaris. If your Solaris system
has the software from the Solaris Developer Companion CD installed, you
should try and use <code>gmake</code> which will be located in either the <code>/usr/bin</code>,
<code>/opt/sfw/bin</code> or <code>/usr/sfw/bin</code> directory.</li>
should try and use <code>/usr/bin/gmake</code> or <code>/usr/gnu/bin/make</code>.</li>
<li><strong>Windows:</strong> Make sure you start your build inside a bash shell.</li>
<li><strong>Mac OS X:</strong> The XCode "command line tools" must be installed on your Mac.</li>
</ul>

View File

@ -560,8 +560,7 @@ Some of the more commonly used `configure` options are:
> The Common UNIX Printing System (CUPS) Headers are required for building the
OpenJDK on Solaris and Linux. The Solaris header files can be obtained by
installing the package **SFWcups** from the Solaris Software Companion
CD/DVD, these often will be installed into the directory `/opt/sfw/cups`.
installing the package **print/cups**.
> The CUPS header files can always be downloaded from
[www.cups.org](http://www.cups.org).
@ -1017,8 +1016,7 @@ about using GNU make:
* Place the location of the GNU make binary in the `PATH`.
* **Solaris:** Do NOT use `/usr/bin/make` on Solaris. If your Solaris system
has the software from the Solaris Developer Companion CD installed, you
should try and use `gmake` which will be located in either the `/usr/bin`,
`/opt/sfw/bin` or `/usr/sfw/bin` directory.
should try and use `/usr/bin/gmake` or `/usr/gnu/bin/make`.
* **Windows:** Make sure you start your build inside a bash shell.
* **Mac OS X:** The XCode "command line tools" must be installed on your Mac.

View File

@ -750,11 +750,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
# Prepend the extra path to the global path
BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
# Add extra search paths on solaris for utilities like ar, as, dtrace etc...
PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin:/usr/sbin"
fi
AC_MSG_CHECKING([for sysroot])
AC_MSG_RESULT([$SYSROOT])
AC_MSG_CHECKING([for toolchain path])

View File

@ -88,8 +88,7 @@ AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
# inlining of system functions and intrinsics.
$1SYSROOT_CFLAGS="-I-xbuiltin -I[$]$1SYSROOT/usr/include"
$1SYSROOT_LDFLAGS="-L[$]$1SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
-L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
-L[$]$1SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
-L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
fi
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
$1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"

View File

@ -926,9 +926,7 @@ COMPRESS_JARS
INCLUDE_SA
UNLIMITED_CRYPTO
CACERTS_FILE
BUILD_HEADLESS
SUPPORT_HEADFUL
SUPPORT_HEADLESS
ENABLE_HEADLESS_ONLY
DEFAULT_MAKE_TARGET
OS_VERSION_MICRO
OS_VERSION_MINOR
@ -1153,7 +1151,7 @@ with_sdk_name
with_conf_name
with_output_sync
with_default_make_target
enable_headful
enable_headless_only
with_cacerts_file
enable_unlimited_crypto
with_copyright_year
@ -1976,8 +1974,7 @@ Optional Features:
[disabled]
--enable-debug set the debug level to fastdebug (shorthand for
--with-debug-level=fastdebug) [disabled]
--disable-headful disable building headful support (graphical UI
support) [enabled]
--enable-headless-only only build headless (no GUI) support [disabled]
--enable-unlimited-crypto
Enable unlimited crypto policy [disabled]
--disable-keep-packaged-modules
@ -5095,7 +5092,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=1472718471
DATE_WHEN_GENERATED=1474894604
###############################################################################
#
@ -17213,11 +17210,6 @@ $as_echo "$as_me: WARNING: Both SYSROOT and --with-sdk-name are set, only SYSROO
fi
if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
# Add extra search paths on solaris for utilities like ar, as, dtrace etc...
PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin:/usr/sbin"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
$as_echo_n "checking for sysroot... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSROOT" >&5
@ -24197,37 +24189,31 @@ fi
# We need build & target for this.
# Should we build a JDK/JVM with headful support (ie a graphical ui)?
# We always build headless support.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking headful support" >&5
$as_echo_n "checking headful support... " >&6; }
# Check whether --enable-headful was given.
if test "${enable_headful+set}" = set; then :
enableval=$enable_headful; SUPPORT_HEADFUL=${enable_headful}
else
SUPPORT_HEADFUL=yes
# Should we build a JDK without a graphical UI?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking headless only" >&5
$as_echo_n "checking headless only... " >&6; }
# Check whether --enable-headless-only was given.
if test "${enable_headless_only+set}" = set; then :
enableval=$enable_headless_only;
fi
SUPPORT_HEADLESS=yes
BUILD_HEADLESS="BUILD_HEADLESS:=true"
if test "x$SUPPORT_HEADFUL" = xyes; then
# We are building both headful and headless.
headful_msg="include support for both headful and headless"
if test "x$enable_headless_only" = "xyes"; then
ENABLE_HEADLESS_ONLY="true"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
elif test "x$enable_headless_only" = "xno"; then
ENABLE_HEADLESS_ONLY="false"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
elif test "x$enable_headless_only" = "x"; then
ENABLE_HEADLESS_ONLY="false"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
else
as_fn_error $? "--enable-headless-only can only take yes or no" "$LINENO" 5
fi
if test "x$SUPPORT_HEADFUL" = xno; then
# Thus we are building headless only.
BUILD_HEADLESS="BUILD_HEADLESS:=true"
headful_msg="headless only"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $headful_msg" >&5
$as_echo "$headful_msg" >&6; }
# Choose cacerts source file
@ -31475,8 +31461,7 @@ fi
# inlining of system functions and intrinsics.
SYSROOT_CFLAGS="-I-xbuiltin -I$SYSROOT/usr/include"
SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
-L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
fi
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
SYSROOT_CFLAGS="--sysroot=$SYSROOT"
@ -32992,14 +32977,6 @@ $as_echo "$as_me: or run \"bash.exe -l\" from a VS command prompt and then run c
fi
# For solaris we really need solaris tools, and not the GNU equivalent.
# The build tools on Solaris reside in /usr/ccs (C Compilation System),
# so add that to path before starting to probe.
# FIXME: This was originally only done for AS,NM,GNM,STRIP,OBJCOPY,OBJDUMP.
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
PATH="/usr/ccs/bin:$PATH"
fi
# Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to
# override all other locations.
if test "x$TOOLCHAIN_PATH" != x; then
@ -44000,8 +43977,7 @@ $as_echo "$BUILD_DEVKIT_ROOT" >&6; }
# inlining of system functions and intrinsics.
BUILD_SYSROOT_CFLAGS="-I-xbuiltin -I$BUILD_SYSROOT/usr/include"
BUILD_SYSROOT_LDFLAGS="-L$BUILD_SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$BUILD_SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$BUILD_SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
-L$BUILD_SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
fi
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
BUILD_SYSROOT_CFLAGS="--sysroot=$BUILD_SYSROOT"
@ -53060,13 +53036,9 @@ $as_echo "yes" >&6; }
# No X11 support on windows or macosx
NEEDS_LIB_X11=false
else
if test "x$SUPPORT_HEADFUL" = xno; then
# No X11 support if building headless-only
NEEDS_LIB_X11=false
else
# All other instances need X11
NEEDS_LIB_X11=true
fi
# All other instances need X11, even if building headless only, libawt still
# needs X11 headers.
NEEDS_LIB_X11=true
fi
# Check if cups is needed
@ -56730,9 +56702,7 @@ fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
OPENWIN_HOME="/usr/openwin"
X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
X_LIBS="-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
fi
@ -56909,23 +56879,6 @@ fi
done
fi
if test "x$CUPS_FOUND" = xno; then
# Getting nervous now? Lets poke around for standard Solaris third-party
# package installation locations.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cups headers" >&5
$as_echo_n "checking for cups headers... " >&6; }
if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then
# An SFW package seems to be installed!
CUPS_FOUND=yes
CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include"
elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then
# A CSW package seems to be installed!
CUPS_FOUND=yes
CUPS_CFLAGS="-I$SYSROOT/opt/csw/include"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_FOUND" >&5
$as_echo "$CUPS_FOUND" >&6; }
fi
if test "x$CUPS_FOUND" = xno; then
@ -61166,346 +61119,6 @@ $as_echo "$FREETYPE_LIB_PATH" >&6; }
fi
fi
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$SYSROOT/usr/sfw"
POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
METHOD="well-known location"
# Let's start with an optimistic view of the world :-)
FOUND_FREETYPE=yes
# First look for the canonical freetype main include file ft2build.h.
if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
# Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
# Fail.
FOUND_FREETYPE=no
fi
fi
if test "x$FOUND_FREETYPE" = xyes; then
# Include file found, let's continue the sanity check.
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
# Reset to default value
FREETYPE_BASE_NAME=freetype
FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
if test "x$OPENJDK_TARGET_OS" = xmacosx \
&& test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
# On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
# for the .6 version explicitly.
FREETYPE_BASE_NAME=freetype.6
FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
else
if test "x$OPENJDK_TARGET_OS" = xwindows; then
# On Windows, we will need both .lib and .dll file.
if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
elif test "x$OPENJDK_TARGET_OS" = xsolaris \
&& test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
# Found lib in isa dir, use that instead.
POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
fi
fi
fi
if test "x$FOUND_FREETYPE" = xyes; then
# Only process if variable expands to non-empty
if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != 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="$POTENTIAL_FREETYPE_INCLUDE_PATH"
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 POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$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
POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
fi
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
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
POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH 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="$POTENTIAL_FREETYPE_INCLUDE_PATH"
has_space=`$ECHO "$path" | $GREP " "`
if test "x$has_space" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, 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 POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
fi
if test -d "$path"; then
POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
else
dir="`$DIRNAME "$path"`"
base="`$BASENAME "$path"`"
POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$dir"; $THEPWDCMD -L`/$base"
fi
fi
fi
# Only process if variable expands to non-empty
if test "x$POTENTIAL_FREETYPE_LIB_PATH" != 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="$POTENTIAL_FREETYPE_LIB_PATH"
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 POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$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
POTENTIAL_FREETYPE_LIB_PATH="$new_path"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
fi
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
path="$POTENTIAL_FREETYPE_LIB_PATH"
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
POTENTIAL_FREETYPE_LIB_PATH="$new_path"
{ $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH 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="$POTENTIAL_FREETYPE_LIB_PATH"
has_space=`$ECHO "$path" | $GREP " "`
if test "x$has_space" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, 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 POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
fi
if test -d "$path"; then
POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
else
dir="`$DIRNAME "$path"`"
base="`$BASENAME "$path"`"
POTENTIAL_FREETYPE_LIB_PATH="`cd "$dir"; $THEPWDCMD -L`/$base"
fi
fi
fi
FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
$as_echo_n "checking for freetype includes... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
$as_echo_n "checking for freetype libraries... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
$as_echo "$FREETYPE_LIB_PATH" >&6; }
fi
fi
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$SYSROOT/usr"
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then

View File

@ -134,32 +134,25 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_OPEN_OR_CUSTOM],
AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
[
# Should we build a JDK/JVM with headful support (ie a graphical ui)?
# We always build headless support.
AC_MSG_CHECKING([headful support])
AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful],
[disable building headful support (graphical UI support) @<:@enabled@:>@])],
[SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes])
# Should we build a JDK without a graphical UI?
AC_MSG_CHECKING([headless only])
AC_ARG_ENABLE([headless-only], [AS_HELP_STRING([--enable-headless-only],
[only build headless (no GUI) support @<:@disabled@:>@])])
SUPPORT_HEADLESS=yes
BUILD_HEADLESS="BUILD_HEADLESS:=true"
if test "x$SUPPORT_HEADFUL" = xyes; then
# We are building both headful and headless.
headful_msg="include support for both headful and headless"
if test "x$enable_headless_only" = "xyes"; then
ENABLE_HEADLESS_ONLY="true"
AC_MSG_RESULT([yes])
elif test "x$enable_headless_only" = "xno"; then
ENABLE_HEADLESS_ONLY="false"
AC_MSG_RESULT([no])
elif test "x$enable_headless_only" = "x"; then
ENABLE_HEADLESS_ONLY="false"
AC_MSG_RESULT([no])
else
AC_MSG_ERROR([--enable-headless-only can only take yes or no])
fi
if test "x$SUPPORT_HEADFUL" = xno; then
# Thus we are building headless only.
BUILD_HEADLESS="BUILD_HEADLESS:=true"
headful_msg="headless only"
fi
AC_MSG_RESULT([$headful_msg])
AC_SUBST(SUPPORT_HEADLESS)
AC_SUBST(SUPPORT_HEADFUL)
AC_SUBST(BUILD_HEADLESS)
AC_SUBST(ENABLE_HEADLESS_ONLY)
# Choose cacerts source file
AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],

View File

@ -75,21 +75,6 @@ AC_DEFUN_ONCE([LIB_SETUP_CUPS],
DEFAULT_CUPS=yes
])
fi
if test "x$CUPS_FOUND" = xno; then
# Getting nervous now? Lets poke around for standard Solaris third-party
# package installation locations.
AC_MSG_CHECKING([for cups headers])
if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then
# An SFW package seems to be installed!
CUPS_FOUND=yes
CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include"
elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then
# A CSW package seems to be installed!
CUPS_FOUND=yes
CUPS_CFLAGS="-I$SYSROOT/opt/csw/include"
fi
AC_MSG_RESULT([$CUPS_FOUND])
fi
if test "x$CUPS_FOUND" = xno; then
HELP_MSG_MISSING_DEPENDENCY([cups])
AC_MSG_ERROR([Could not find cups! $HELP_MSG ])

View File

@ -357,11 +357,6 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
fi
fi
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$SYSROOT/usr/sfw"
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
fi
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$SYSROOT/usr"
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then

View File

@ -91,9 +91,7 @@ AC_DEFUN_ONCE([LIB_SETUP_X11],
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
OPENWIN_HOME="/usr/openwin"
X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
X_LIBS="-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
fi

View File

@ -42,13 +42,9 @@ AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
# No X11 support on windows or macosx
NEEDS_LIB_X11=false
else
if test "x$SUPPORT_HEADFUL" = xno; then
# No X11 support if building headless-only
NEEDS_LIB_X11=false
else
# All other instances need X11
NEEDS_LIB_X11=true
fi
# All other instances need X11, even if building headless only, libawt still
# needs X11 headers.
NEEDS_LIB_X11=true
fi
# Check if cups is needed

View File

@ -241,12 +241,8 @@ BUILD_GTEST := @BUILD_GTEST@
# Control use of precompiled header in hotspot libjvm build
USE_PRECOMPILED_HEADER := @USE_PRECOMPILED_HEADER@
# Should we compile support for running with a graphical UI? (ie headful)
# Should we compile support for running without? (ie headless)
SUPPORT_HEADFUL:=@SUPPORT_HEADFUL@
SUPPORT_HEADLESS:=@SUPPORT_HEADLESS@
# Legacy defines controlled by the SUPPORT_HEADLESS and SUPPORT_HEADFUL options.
@BUILD_HEADLESS@
# Only build headless support or not
ENABLE_HEADLESS_ONLY := @ENABLE_HEADLESS_ONLY@
# Legacy support
USE_NEW_HOTSPOT_BUILD:=@USE_NEW_HOTSPOT_BUILD@

View File

@ -294,14 +294,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
fi
AC_SUBST(TOOLCHAIN_VERSION)
# For solaris we really need solaris tools, and not the GNU equivalent.
# The build tools on Solaris reside in /usr/ccs (C Compilation System),
# so add that to path before starting to probe.
# FIXME: This was originally only done for AS,NM,GNM,STRIP,OBJCOPY,OBJDUMP.
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
PATH="/usr/ccs/bin:$PATH"
fi
# Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to
# override all other locations.
if test "x$TOOLCHAIN_PATH" != x; then

View File

@ -224,6 +224,23 @@ var getJibProfilesCommon = function (input) {
common.configure_args_slowdebug = ["--with-debug-level=slowdebug"],
common.organization = "jpg.infra.builddeps"
var boot_jdk_revision = "8";
var boot_jdk_subdirpart = "1.8.0";
// JDK 8 does not work on sparc M7 cpus, need a newer update when building
// on such hardware.
if (input.build_cpu == "sparcv9") {
var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
if (cpu_brand.trim() == 'SPARC-M7') {
boot_jdk_revision = "8u20";
boot_jdk_subdirpart = "1.8.0_20";
}
}
common.boot_jdk_revision = boot_jdk_revision;
common.boot_jdk_subdirpart = boot_jdk_subdirpart;
common.boot_jdk_home = input.get("boot_jdk", "home_path") + "/jdk"
+ common.boot_jdk_subdirpart
+ (input.build_os == "macosx" ? ".jdk/Contents/Home" : "");
return common;
};
@ -333,8 +350,11 @@ var getJibProfilesProfiles = function (input, common) {
"run-test": {
target_os: input.build_os,
target_cpu: input.build_cpu,
dependencies: [ "jtreg", "gnumake" ],
labels: "test"
dependencies: [ "jtreg", "gnumake", "boot_jdk" ],
labels: "test",
environment: {
"JT_JAVA": common.boot_jdk_home
}
}
};
profiles = concatObjects(profiles, testOnlyProfiles);
@ -357,18 +377,6 @@ var getJibProfilesDependencies = function (input, common) {
var boot_jdk_platform = input.build_os + "-"
+ (input.build_cpu == "x86" ? "i586" : input.build_cpu);
var boot_jdk_revision = "8";
var boot_jdk_subdirpart = "1.8.0";
// JDK 8 does not work on sparc M7 cpus, need a newer update when building
// on such hardware.
if (input.build_cpu == "sparcv9") {
var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
if (cpu_brand.trim() == 'SPARC-M7') {
boot_jdk_revision = "8u20";
boot_jdk_subdirpart = "1.8.0_20";
}
}
var devkit_platform_revisions = {
linux_x64: "gcc4.9.2-OEL6.4+1.0",
macosx_x64: "Xcode6.3-MacOSX10.9+1.0",
@ -386,12 +394,12 @@ var getJibProfilesDependencies = function (input, common) {
boot_jdk: {
server: "javare",
module: "jdk",
revision: boot_jdk_revision,
revision: common.boot_jdk_revision,
checksum_file: boot_jdk_platform + "/MD5_VALUES",
file: boot_jdk_platform + "/jdk-" + boot_jdk_revision + "-" + boot_jdk_platform + ".tar.gz",
configure_args: (input.build_os == "macosx"
? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart + ".jdk/Contents/Home"
: "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart)
file: boot_jdk_platform + "/jdk-" + common.boot_jdk_revision
+ "-" + boot_jdk_platform + ".tar.gz",
configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
environment_path: common.boot_jdk_home
},
devkit: {
@ -420,7 +428,8 @@ var getJibProfilesDependencies = function (input, common) {
build_number: "b03",
checksum_file: "MD5_VALUES",
file: "jtreg_bin-4.2.zip",
environment_name: "JT_HOME"
environment_name: "JT_HOME",
environment_path: input.get("jtreg", "install_path") + "/jtreg/bin"
},
gnumake: {

View File

@ -379,3 +379,4 @@ f7e1d5337c2e550fe553df7a3886bbed80292ecd jdk-9+131
1a497f5ca0cfd88115cc7daa8af8a62b8741caf2 jdk-9+134
094d0db606db976045f594dba47d4593b715cc81 jdk-9+135
aa053a3faf266c12b4fd5272da431a3e08e4a3e3 jdk-9+136
258cf18fa7fc59359b874f8743b7168dc48baf73 jdk-9+137

View File

@ -539,3 +539,5 @@ a25e0fb6033245ab075136e744d362ce765464cd jdk-9+133
b8b694c6b4d2ab0939aed7adaf0eec1ac321a085 jdk-9+134
3b1c4562953db47e36b237a500f368d5c9746d47 jdk-9+135
a20da289f646ee44440695b81abc0548330e4ca7 jdk-9+136
dfcbf839e299e7e2bba1da69bdb347617ea4c7e8 jdk-9+137
fc0956308c7a586267c5dd35dff74f773aa9c3eb jdk-9+138

View File

@ -379,3 +379,4 @@ e66cdc2de6b02443911d386fc9217b0d824d0686 jdk-9+130
1c6c21d87aa459d82425e1fddc9ce8647aebde34 jdk-9+134
f695240370c77a25fed88225a392e7d530cb4d78 jdk-9+135
f1eafcb0eb7182b937bc93f214d8cabd01ec4d59 jdk-9+136
a8d5fe567ae72b4931040e59dd4478363f9004f5 jdk-9+137

View File

@ -1033,12 +1033,12 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
staxInputSource = new StaxXMLInputSource(xmlInputSource, fISCreatedByResolver);
}
if (staxInputSource == null) {
if (staxInputSource == null && fUseCatalog) {
if (fCatalogFeatures == null) {
fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
}
fCatalogFile = fCatalogFeatures.get(Feature.FILES);
if (fUseCatalog && fCatalogFile != null) {
if (fCatalogFile != null) {
try {
if (fCatalogResolver == null) {
fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
@ -1133,12 +1133,12 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
xmlInputSource = fEntityResolver.resolveEntity(resourceIdentifier);
}
if (xmlInputSource == null) {
if (xmlInputSource == null && fUseCatalog) {
if (fCatalogFeatures == null) {
fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
}
fCatalogFile = fCatalogFeatures.get(Feature.FILES);
if (fUseCatalog && fCatalogFile != null) {
if (fCatalogFile != null) {
/*
since the method can be called from various processors, both
EntityResolver and URIResolver are used to attempt to find

View File

@ -34,6 +34,8 @@ import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException;
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.parsers.XIncludeParserConfiguration;
import com.sun.org.apache.xerces.internal.parsers.XPointerParserConfiguration;
import com.sun.org.apache.xerces.internal.util.AugmentationsImpl;
import com.sun.org.apache.xerces.internal.util.HTTPInputSource;
import com.sun.org.apache.xerces.internal.util.IntStack;
@ -129,8 +131,6 @@ import org.xml.sax.InputSource;
public class XIncludeHandler
implements XMLComponent, XMLDocumentFilter, XMLDTDFilter {
public final static String XINCLUDE_DEFAULT_CONFIGURATION =
"com.sun.org.apache.xerces.internal.parsers.XIncludeParserConfiguration";
public final static String HTTP_ACCEPT = "Accept";
public final static String HTTP_ACCEPT_LANGUAGE = "Accept-Language";
public final static String XPOINTER = "xpointer";
@ -1624,12 +1624,12 @@ public class XIncludeHandler
includedSource =
fEntityResolver.resolveEntity(resourceIdentifier);
if (includedSource == null) {
if (includedSource == null && fUseCatalog) {
if (fCatalogFeatures == null) {
fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
}
fCatalogFile = fCatalogFeatures.get(CatalogFeatures.Feature.FILES);
if (fUseCatalog && fCatalogFile != null) {
if (fCatalogFile != null) {
/*
Although URI entry is preferred for resolving XInclude, system entry
is allowed as well.
@ -1690,14 +1690,11 @@ public class XIncludeHandler
if ((xpointer != null && fXPointerChildConfig == null)
|| (xpointer == null && fXIncludeChildConfig == null) ) {
String parserName = XINCLUDE_DEFAULT_CONFIGURATION;
if (xpointer != null)
parserName = "com.sun.org.apache.xerces.internal.parsers.XPointerParserConfiguration";
fChildConfig =
(XMLParserConfiguration)ObjectFactory.newInstance(
parserName,
true);
if (xpointer == null) {
fChildConfig = new XIncludeParserConfiguration();
} else {
fChildConfig = new XPointerParserConfiguration();
}
// use the same symbol table, error reporter, entity resolver, security manager and buffer size.
if (fSymbolTable != null) fChildConfig.setProperty(SYMBOL_TABLE, fSymbolTable);

View File

@ -32,7 +32,6 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Listeners;
@ -42,7 +41,7 @@ import org.xml.sax.InputSource;
/**
* @test
* @bug 8158084 8162438 8162442 8166220
* @bug 8158084 8162438 8162442 8166220 8166398
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
* @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport
* @run testng/othervm catalog.CatalogSupport
@ -51,7 +50,7 @@ import org.xml.sax.InputSource;
* A custom resolver is used whether or not there's a Catalog;
* A Catalog is used when there's no custom resolver, and the USE_CATALOG
* is true (which is the case by default).
*/
*/
/**
* Support Catalog:
@ -177,13 +176,13 @@ public class CatalogSupport extends CatalogSupportBase {
*/
@DataProvider(name = "data_SAXA")
public Object[][] getDataSAX() {
String[] systemIds = {"system.xsd"};
InputSource[] returnValues = {new InputSource(new StringReader(dtd_systemResolved))};
MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInSystem);
String[] systemIds = {"system.dtd"};
return new Object[][]{
{false, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog},
{false, true, xml_catalog, xml_system, entityHandler, expectedWResolver},
{true, true, xml_catalog, xml_system, entityHandler, expectedWResolver}
{false, true, xml_catalog, xml_system, getMyEntityHandler(elementInSystem, systemIds,
new InputSource(new StringReader(dtd_systemResolved))), expectedWResolver},
{true, true, xml_catalog, xml_system, getMyEntityHandler(elementInSystem, systemIds,
new InputSource(new StringReader(dtd_systemResolved))), expectedWResolver}
};
}
@ -209,7 +208,7 @@ public class CatalogSupport extends CatalogSupportBase {
*/
@DataProvider(name = "data_DOMA")
public Object[][] getDataDOM() {
String[] systemIds = {"system.xsd"};
String[] systemIds = {"system.dtd"};
InputSource[] returnValues = {new InputSource(new StringReader(dtd_systemResolved))};
MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInSystem);
return new Object[][]{
@ -230,8 +229,8 @@ public class CatalogSupport extends CatalogSupportBase {
return new Object[][]{
{false, true, xml_catalog, xml_system, null, expectedWCatalog},
{false, true, xml_catalog, xml_system, null, expectedWResolver},
{true, true, xml_catalog, xml_system, null, expectedWResolver}
{false, true, xml_catalog, xml_system, new MyStaxEntityResolver(), expectedWResolver},
{true, true, xml_catalog, xml_system, new MyStaxEntityResolver(), expectedWResolver}
};
}

View File

@ -15,6 +15,7 @@
<system systemId="XI_utf8.xml" uri="XI_utf8.xml"/>
<system systemId="XI_utf8Catalog.xml" uri="XI_utf8Catalog.xml"/>
<system systemId="XI_test2.xml" uri="XI_test2.xml"/>
<system systemId="XI_test2Catalog.xml" uri="XI_test2Catalog.xml"/>
<system systemId="XI_red.dtd" uri="XI_red.dtd"/>
<!-- xsd import can be mapped using the namespace or systemId -->

View File

@ -276,7 +276,7 @@ public class CatalogSupportBase {
SAXParser parser = getSAXParser(setUseCatalog, useCatalog, catalog);
parser.parse(xml, handler);
assertEquals(expected, handler.getResult().trim(), "");
Assert.assertEquals(handler.getResult().trim(), expected);
}
/*
@ -287,8 +287,9 @@ public class CatalogSupportBase {
XMLReader reader = getXMLReader(setUseCatalog, useCatalog, catalog);
reader.setContentHandler(handler);
reader.setEntityResolver(handler);
reader.parse(xml);
assertEquals(expected, handler.getResult().trim(), "");
Assert.assertEquals(handler.getResult().trim(), expected);
}
/*
@ -300,7 +301,7 @@ public class CatalogSupportBase {
parser.parse(new InputSource(new StringReader(xml)), handler);
debugPrint("handler.result:" + handler.getResult());
assertEquals(expected, handler.getResult(), "Catalog support for XInclude");
Assert.assertEquals(handler.getResult().trim(), expected);
}
/*
@ -314,8 +315,7 @@ public class CatalogSupportBase {
Node node = doc.getElementsByTagName(elementInSystem).item(0);
String result = node.getFirstChild().getTextContent();
assertEquals(expected, result.trim(), "Catalog support for DOM");
Assert.assertEquals(result.trim(), expected);
}
/*
@ -327,7 +327,7 @@ public class CatalogSupportBase {
XMLStreamReader streamReader = getStreamReader(
setUseCatalog, useCatalog, catalog, xml, resolver);
String text = getText(streamReader, XMLStreamConstants.CHARACTERS);
assertEquals(expected, text.trim(), "Catalog support for StAX");
Assert.assertEquals(text.trim(), expected);
}
/*
@ -340,7 +340,7 @@ public class CatalogSupportBase {
XMLStreamReader streamReader = getStreamReader(
setUseCatalog, useCatalog, catalog, xml, resolver);
String text = getText(streamReader, XMLStreamConstants.ENTITY_REFERENCE);
assertEquals(expected, text.trim(), "Catalog support for StAX");
Assert.assertEquals(text.trim(), expected);
}
/*
@ -601,9 +601,11 @@ public class CatalogSupportBase {
}
/**
* Returns the text of the first element found by the reader.
* Returns the accumulated text of an event type.
*
* @param streamReader the XMLStreamReader
* @return the text of the first element
* @param type the type of event requested
* @return the text of the accumulated text for the request type
* @throws XMLStreamException
*/
String getText(XMLStreamReader streamReader, int type) throws XMLStreamException {
@ -662,24 +664,6 @@ public class CatalogSupportBase {
return factory;
}
void assertNotNull(Object obj, String msg) {
if (obj == null) {
debugPrint("Test failed: " + msg);
} else {
debugPrint("Test passed: " + obj + " is not null");
}
}
void assertEquals(String expected, String actual, String msg) {
if (!expected.equals(actual)) {
debugPrint("Test failed: " + msg);
} else {
debugPrint("Test passed: ");
}
debugPrint("Expected: " + expected);
debugPrint("Actual: " + actual);
}
void fail(String msg) {
System.out.println("Test failed:");
System.out.println(msg);

View File

@ -9,7 +9,7 @@
</another>
</latin1>
<test2>
<xinclude:include href="XI_test2.xml"/>
<xinclude:include href="XI_test2Catalog.xml"/>
</test2>
<test3>
<!-- <xinclude:include href="XI_roottest.xml"/> -->

View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!-- comment before root -->
<!DOCTYPE red SYSTEM "XI_red.dtd">
<red xmlns:xinclude="http://www.w3.org/2001/XInclude">
<blue>
<xinclude:include href="XI_utf8Catalog.xml" parse="text"/>
</blue>
</red>
<!-- comment after root -->

View File

@ -382,3 +382,4 @@ fe4e11bd2423635dc0f5f5cb9a64eb2f2cce7f4c jdk-9+128
ab1d78d395d4cb8be426ff181211da1a4085cf01 jdk-9+134
22631824f55128a7ab6605493b3001a37af6a168 jdk-9+135
09ec13a99f50a4a346180d1e3b0fd8bc1ee399ce jdk-9+136
297c16d401c534cb879809d2a746d21ca99d2954 jdk-9+137

View File

@ -379,3 +379,4 @@ d5c70818cd8a82e76632c8c815bdb4f75f53aeaf jdk-9+132
803adcd526d74ae0b64948d1f8260c2dbe514779 jdk-9+134
021369229cfd0b5feb76834b2ea498f47f43c0f3 jdk-9+135
54c5931849a33a363e03fdffa141503f5cc4779d jdk-9+136
e72df94364e3686e7d62059ce0d6b187b82da713 jdk-9+137

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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
@ -28,7 +28,7 @@ include LauncherCommon.gmk
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, jdk, launcher/Launcher-java.desktop.gmk))
ifndef BUILD_HEADLESS_ONLY
ifeq ($(ENABLE_HEADLESS_ONLY), false)
$(eval $(call SetupBuildLauncher, appletviewer, \
MAIN_CLASS := sun.applet.Main, \
JAVA_ARGS := --add-modules ALL-DEFAULT, \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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
@ -25,7 +25,7 @@
include LauncherCommon.gmk
ifndef BUILD_HEADLESS_ONLY
ifeq ($(ENABLE_HEADLESS_ONLY), false)
$(eval $(call SetupBuildLauncher, policytool, \
MAIN_CLASS := sun.security.tools.policytool.PolicyTool, \
LIBS_unix := $(X_LIBS), \

View File

@ -280,7 +280,7 @@ TARGETS += $(BUILD_LIBAWT)
################################################################################
ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
ifndef BUILD_HEADLESS_ONLY
ifeq ($(ENABLE_HEADLESS_ONLY), false)
LIBAWT_XAWT_DIRS := \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \
@ -511,77 +511,75 @@ TARGETS += $(BUILD_LIBJAVAJPEG)
################################################################################
ifeq ($(BUILD_HEADLESS), true)
# Mac and Windows only use the native AWT lib, do not build libawt_headless
ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
# Mac and Windows only use the native AWT lib, do not build libawt_headless
ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
#
LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
#
LIBAWT_HEADLESS_EXCLUDES := medialib
LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
$(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
$(LIBJAVA_HEADER_FLAGS) \
#
LIBAWT_HEADLESS_EXCLUDES := medialib
LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
$(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
$(LIBJAVA_HEADER_FLAGS) \
#
LIBAWT_HEADLESS_REORDER :=
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
endif
LIBAWT_HEADLESS_REORDER :=
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \
LIBRARY := awt_headless, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBAWT_HEADLESS_DIRS), \
EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
-DHEADLESS=true \
-DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
$(CUPS_CFLAGS) \
$(X_CFLAGS) \
$(LIBAWT_HEADLESS_CFLAGS), \
DISABLED_WARNINGS_xlc := 1506-356, \
DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
REORDER := $(LIBAWT_HEADLESS_REORDER), \
LIBS_unix := -lawt -ljvm -ljava, \
LIBS_linux := $(LIBM) $(LIBDL), \
LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX) -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
))
# AIX warning explanation:
# 1506-356 : (W) Compilation unit is empty.
# This happens during the headless build
$(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
TARGETS += $(BUILD_LIBAWT_HEADLESS)
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \
LIBRARY := awt_headless, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(LIBAWT_HEADLESS_DIRS), \
EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
-DHEADLESS=true \
-DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
$(CUPS_CFLAGS) \
$(X_CFLAGS) \
$(LIBAWT_HEADLESS_CFLAGS), \
DISABLED_WARNINGS_xlc := 1506-356, \
DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
REORDER := $(LIBAWT_HEADLESS_REORDER), \
LIBS_unix := -lawt -ljvm -ljava, \
LIBS_linux := $(LIBM) $(LIBDL), \
LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX) -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
))
# AIX warning explanation:
# 1506-356 : (W) Compilation unit is empty.
# This happens during the headless build
$(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
TARGETS += $(BUILD_LIBAWT_HEADLESS)
endif
################################################################################
@ -780,7 +778,7 @@ else # OPENJDK_TARGET_OS not windows
ifneq ($(OPENJDK_TARGET_OS), solaris)
JAWT_LIBS += -lawt
endif
ifndef BUILD_HEADLESS_ONLY
ifeq ($(ENABLE_HEADLESS_ONLY), false)
JAWT_LIBS += -lawt_xawt
else
JAWT_LIBS += -lawt_headless
@ -809,7 +807,7 @@ else # OPENJDK_TARGET_OS not windows
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
))
ifndef BUILD_HEADLESS_ONLY
ifeq ($(ENABLE_HEADLESS_ONLY), false)
$(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
else
$(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
@ -825,7 +823,7 @@ TARGETS += $(BUILD_LIBJAWT)
################################################################################
ifndef BUILD_HEADLESS_ONLY
ifeq ($(ENABLE_HEADLESS_ONLY), false)
LIBSPLASHSCREEN_DIRS := \
$(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg \

View File

@ -0,0 +1,85 @@
/*
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <stdio.h>
#include <sys/ldr.h>
#include "java_md_aix.h"
static unsigned char dladdr_buffer[0x4000];
static int fill_dll_info(void) {
return loadquery(L_GETINFO, dladdr_buffer, sizeof(dladdr_buffer));
}
static int dladdr_dont_reload(void *addr, Dl_info *info) {
const struct ld_info *p = (struct ld_info *)dladdr_buffer;
memset((void *)info, 0, sizeof(Dl_info));
for (;;) {
if (addr >= p->ldinfo_textorg &&
addr < (((char*)p->ldinfo_textorg) + p->ldinfo_textsize))
{
info->dli_fname = p->ldinfo_filename;
return 1;
}
if (!p->ldinfo_next) {
break;
}
p = (struct ld_info *)(((char *)p) + p->ldinfo_next);
}
return 0;
}
int dladdr(void *addr, Dl_info *info) {
static int loaded = 0;
int rc = 0;
void *addr0;
if (!addr) {
return rc;
}
if (!loaded) {
if (fill_dll_info() == -1)
return rc;
loaded = 1;
}
// first try with addr on cached data
rc = dladdr_dont_reload(addr, info);
// addr could be an AIX function descriptor, so try dereferenced version
if (rc == 0) {
addr0 = *((void **)addr);
rc = dladdr_dont_reload(addr0, info);
}
// if we had no success until now, maybe loadquery info is outdated.
// refresh and retry
if (rc == 0) {
if (fill_dll_info() == -1)
return rc;
rc = dladdr_dont_reload(addr, info);
if (rc == 0) {
rc = dladdr_dont_reload(addr0, info);
}
}
return rc;
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef JAVA_MD_AIX_H
#define JAVA_MD_AIX_H
/*
* Very limited AIX port of dladdr() for libjli.so.
*
* We try to mimick dladdr(3) on Linux (see http://linux.die.net/man/3/dladdr)
* dladdr(3) is not POSIX but a GNU extension, and is not available on AIX.
*
* We only support Dl_info.dli_fname here as this is the only thing that is
* used of it by libjli.so. A more comprehensive port of dladdr can be found
* in the hotspot implementation which is not available at this place, though.
*/
typedef struct {
const char *dli_fname; /* file path of loaded library */
void *dli_fbase; /* unsupported */
const char *dli_sname; /* unsupported */
void *dli_saddr; /* unsupported */
} Dl_info;
int dladdr(void *addr, Dl_info *info);
#endif /* JAVA_MD_AIX_H */

View File

@ -71,6 +71,7 @@ final class StackStreamFactory {
// These flags must match the values maintained in the VM
@Native private static final int DEFAULT_MODE = 0x0;
@Native private static final int FILL_CLASS_REFS_ONLY = 0x2;
@Native private static final int GET_CALLER_CLASS = 0x4;
@Native private static final int SHOW_HIDDEN_FRAMES = 0x20; // LambdaForms are hidden by the VM
@Native private static final int FILL_LIVE_STACK_FRAMES = 0x100;
/*
@ -614,9 +615,7 @@ final class StackStreamFactory {
private Class<?> caller;
CallerClassFinder(StackWalker walker) {
super(walker, FILL_CLASS_REFS_ONLY);
assert (mode & FILL_CLASS_REFS_ONLY) == FILL_CLASS_REFS_ONLY
: "mode should contain FILL_CLASS_REFS_ONLY";
super(walker, FILL_CLASS_REFS_ONLY|GET_CALLER_CLASS);
}
final class ClassBuffer extends FrameBuffer<Class<?>> {

View File

@ -869,5 +869,4 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
static SpeciesData speciesData_LLL() { return checkCache(3, "LLL"); }
static SpeciesData speciesData_LLLL() { return checkCache(4, "LLLL"); }
static SpeciesData speciesData_LLLLL() { return checkCache(5, "LLLLL"); }
static SpeciesData speciesData_LLLLLL() { return checkCache(6, "LLLLLL"); }
}

View File

@ -39,14 +39,14 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.stream.Stream;
import static java.lang.invoke.LambdaForm.*;
import static java.lang.invoke.LambdaForm.BasicType;
import static java.lang.invoke.LambdaForm.BasicType.*;
import static java.lang.invoke.LambdaForm.Kind.*;
import static java.lang.invoke.LambdaForm.*;
import static java.lang.invoke.MethodHandleNatives.Constants.*;
import static java.lang.invoke.MethodHandleStatics.*;
@ -65,6 +65,9 @@ class InvokerBytecodeGenerator {
private static final String OBJ = "java/lang/Object";
private static final String OBJARY = "[Ljava/lang/Object;";
private static final String LOOP_CLAUSES = MHI + "$LoopClauses";
private static final String MHARY2 = "[[L" + MH + ";";
private static final String LF_SIG = "L" + LF + ";";
private static final String LFN_SIG = "L" + LFN + ";";
private static final String LL_SIG = "(L" + OBJ + ";)L" + OBJ + ";";
@ -1319,38 +1322,43 @@ class InvokerBytecodeGenerator {
* The pattern looks like (Cf. MethodHandleImpl.loop):
* <blockquote><pre>{@code
* // a0: BMH
* // a1: inits, a2: steps, a3: preds, a4: finis
* // a5: box, a6: unbox
* // a7 (and following): arguments
* loop=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L,a5:L,a6:L,a7:L)=>{
* t8:L=MethodHandle.invokeBasic(a5:L,a7:L); // box the arguments into an Object[]
* t9:L=MethodHandleImpl.loop(bt:L,a1:L,a2:L,a3:L,a4:L,t8:L); // call the loop executor (with supplied types in bt)
* t10:L=MethodHandle.invokeBasic(a6:L,t9:L);t10:L} // unbox the result; return the result
* // a1: LoopClauses (containing an array of arrays: inits, steps, preds, finis)
* // a2: box, a3: unbox
* // a4 (and following): arguments
* loop=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L)=>{
* t5:L=MethodHandle.invokeBasic(a2:L,a4:L); // box the arguments into an Object[]
* t6:L=MethodHandleImpl.loop(bt:L,a1:L,t5:L); // call the loop executor (with supplied types in bt)
* t7:L=MethodHandle.invokeBasic(a3:L,t6:L);t7:L} // unbox the result; return the result
* }</pre></blockquote>
* <p>
* It is compiled into bytecode equivalent to the code seen in {@link MethodHandleImpl#loop(BasicType[],
* MethodHandle[], MethodHandle[], MethodHandle[], MethodHandle[], Object...)}, with the difference that no arrays
* MethodHandleImpl.LoopClauses, Object...)}, with the difference that no arrays
* will be used for local state storage. Instead, the local state will be mapped to actual stack slots.
* <p>
* Bytecode generation applies an unrolling scheme to enable better bytecode generation regarding local state type
* handling. The generated bytecode will have the following form ({@code void} types are ignored for convenience).
* Assume there are {@code C} clauses in the loop.
* <blockquote><pre>{@code
* INIT: (INIT_SEQ for clause 1)
* ...
* (INIT_SEQ for clause C)
* LOOP: (LOOP_SEQ for clause 1)
* ...
* (LOOP_SEQ for clause C)
* GOTO LOOP
* DONE: ...
* PREINIT: ALOAD_1
* CHECKCAST LoopClauses
* GETFIELD LoopClauses.clauses
* ASTORE clauseDataIndex // place the clauses 2-dimensional array on the stack
* INIT: (INIT_SEQ for clause 1)
* ...
* (INIT_SEQ for clause C)
* LOOP: (LOOP_SEQ for clause 1)
* ...
* (LOOP_SEQ for clause C)
* GOTO LOOP
* DONE: ...
* }</pre></blockquote>
* <p>
* The {@code INIT_SEQ_x} sequence for clause {@code x} (with {@code x} ranging from {@code 0} to {@code C-1}) has
* the following shape. Assume slot {@code vx} is used to hold the state for clause {@code x}.
* <blockquote><pre>{@code
* INIT_SEQ_x: ALOAD inits
* CHECKCAST MethodHandle[]
* INIT_SEQ_x: ALOAD clauseDataIndex
* ICONST_0
* AALOAD // load the inits array
* ICONST x
* AALOAD // load the init handle for clause x
* load args
@ -1361,24 +1369,27 @@ class InvokerBytecodeGenerator {
* The {@code LOOP_SEQ_x} sequence for clause {@code x} (with {@code x} ranging from {@code 0} to {@code C-1}) has
* the following shape. Again, assume slot {@code vx} is used to hold the state for clause {@code x}.
* <blockquote><pre>{@code
* LOOP_SEQ_x: ALOAD steps
* CHECKCAST MethodHandle[]
* LOOP_SEQ_x: ALOAD clauseDataIndex
* ICONST_1
* AALOAD // load the steps array
* ICONST x
* AALOAD // load the step handle for clause x
* load locals
* load args
* INVOKEVIRTUAL MethodHandle.invokeBasic
* store vx
* ALOAD preds
* CHECKCAST MethodHandle[]
* ALOAD clauseDataIndex
* ICONST_2
* AALOAD // load the preds array
* ICONST x
* AALOAD // load the pred handle for clause x
* load locals
* load args
* INVOKEVIRTUAL MethodHandle.invokeBasic
* IFNE LOOP_SEQ_x+1 // predicate returned false -> jump to next clause
* ALOAD finis
* CHECKCAST MethodHandle[]
* ALOAD clauseDataIndex
* ICONST_3
* AALOAD // load the finis array
* ICONST x
* AALOAD // load the fini handle for clause x
* load locals
@ -1397,8 +1408,12 @@ class InvokerBytecodeGenerator {
BasicType[] loopClauseTypes = (BasicType[]) invoker.arguments[0];
Class<?>[] loopLocalStateTypes = Stream.of(loopClauseTypes).
filter(bt -> bt != BasicType.V_TYPE).map(BasicType::basicTypeClass).toArray(Class<?>[]::new);
Class<?>[] localTypes = new Class<?>[loopLocalStateTypes.length + 1];
localTypes[0] = MethodHandleImpl.LoopClauses.class;
System.arraycopy(loopLocalStateTypes, 0, localTypes, 1, loopLocalStateTypes.length);
final int firstLoopStateIndex = extendLocalsMap(loopLocalStateTypes);
final int clauseDataIndex = extendLocalsMap(localTypes);
final int firstLoopStateIndex = clauseDataIndex + 1;
Class<?> returnType = result.function.resolvedHandle().type().returnType();
MethodType loopType = args.function.resolvedHandle().type()
@ -1420,10 +1435,16 @@ class InvokerBytecodeGenerator {
Label lDone = new Label();
Label lNext;
// PREINIT:
emitPushArgument(MethodHandleImpl.LoopClauses.class, invoker.arguments[1]);
mv.visitFieldInsn(Opcodes.GETFIELD, LOOP_CLAUSES, "clauses", MHARY2);
emitAstoreInsn(clauseDataIndex);
// INIT:
for (int c = 0, state = 0; c < nClauses; ++c) {
MethodType cInitType = loopType.changeReturnType(loopClauseTypes[c].basicTypeClass());
emitLoopHandleInvoke(invoker, inits, c, args, false, cInitType, loopLocalStateTypes, firstLoopStateIndex);
emitLoopHandleInvoke(invoker, inits, c, args, false, cInitType, loopLocalStateTypes, clauseDataIndex,
firstLoopStateIndex);
if (cInitType.returnType() != void.class) {
emitStoreInsn(BasicType.basicType(cInitType.returnType()), firstLoopStateIndex + state);
++state;
@ -1440,18 +1461,21 @@ class InvokerBytecodeGenerator {
boolean isVoid = stepType.returnType() == void.class;
// invoke loop step
emitLoopHandleInvoke(invoker, steps, c, args, true, stepType, loopLocalStateTypes, firstLoopStateIndex);
emitLoopHandleInvoke(invoker, steps, c, args, true, stepType, loopLocalStateTypes, clauseDataIndex,
firstLoopStateIndex);
if (!isVoid) {
emitStoreInsn(BasicType.basicType(stepType.returnType()), firstLoopStateIndex + state);
++state;
}
// invoke loop predicate
emitLoopHandleInvoke(invoker, preds, c, args, true, predType, loopLocalStateTypes, firstLoopStateIndex);
emitLoopHandleInvoke(invoker, preds, c, args, true, predType, loopLocalStateTypes, clauseDataIndex,
firstLoopStateIndex);
mv.visitJumpInsn(Opcodes.IFNE, lNext);
// invoke fini
emitLoopHandleInvoke(invoker, finis, c, args, true, finiType, loopLocalStateTypes, firstLoopStateIndex);
emitLoopHandleInvoke(invoker, finis, c, args, true, finiType, loopLocalStateTypes, clauseDataIndex,
firstLoopStateIndex);
mv.visitJumpInsn(Opcodes.GOTO, lDone);
// this is the beginning of the next loop clause
@ -1483,9 +1507,10 @@ class InvokerBytecodeGenerator {
}
private void emitLoopHandleInvoke(Name holder, int handles, int clause, Name args, boolean pushLocalState,
MethodType type, Class<?>[] loopLocalStateTypes, int firstLoopStateSlot) {
MethodType type, Class<?>[] loopLocalStateTypes, int clauseDataSlot,
int firstLoopStateSlot) {
// load handle for clause
emitPushArgument(holder, handles);
emitPushClauseArray(clauseDataSlot, handles);
emitIconstInsn(clause);
mv.visitInsn(Opcodes.AALOAD);
// load loop state (preceding the other arguments)
@ -1499,6 +1524,12 @@ class InvokerBytecodeGenerator {
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", type.toMethodDescriptorString(), false);
}
private void emitPushClauseArray(int clauseDataSlot, int which) {
emitAloadInsn(clauseDataSlot);
emitIconstInsn(which - 1);
mv.visitInsn(Opcodes.AALOAD);
}
private void emitZero(BasicType type) {
switch (type) {
case I_TYPE: mv.visitInsn(Opcodes.ICONST_0); break;

View File

@ -41,7 +41,6 @@ import java.util.HashMap;
import static java.lang.invoke.LambdaForm.BasicType.*;
import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
import static java.lang.invoke.MethodHandleStatics.*;
import java.util.Objects;
/**
* The symbolic, non-executable form of a method handle's invocation semantics.
@ -732,9 +731,9 @@ class LambdaForm {
boolean isLoop(int pos) {
// loop idiom:
// t_{n}:L=MethodHandle.invokeBasic(...)
// t_{n+1}:L=MethodHandleImpl.loop(types, *, *, *, *, t_{n})
// t_{n+1}:L=MethodHandleImpl.loop(types, *, t_{n})
// t_{n+2}:?=MethodHandle.invokeBasic(*, t_{n+1})
return isMatchingIdiom(pos, "loop", 5);
return isMatchingIdiom(pos, "loop", 2);
}
/*

View File

@ -1689,8 +1689,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
NF_tryFinally = new NamedFunction(MethodHandleImpl.class
.getDeclaredMethod("tryFinally", MethodHandle.class, MethodHandle.class, Object[].class));
NF_loop = new NamedFunction(MethodHandleImpl.class
.getDeclaredMethod("loop", BasicType[].class, MethodHandle[].class, MethodHandle[].class,
MethodHandle[].class, MethodHandle[].class, Object[].class));
.getDeclaredMethod("loop", BasicType[].class, LoopClauses.class, Object[].class));
NF_throwException = new NamedFunction(MethodHandleImpl.class
.getDeclaredMethod("throwException", Throwable.class));
NF_profileBoolean = new NamedFunction(MethodHandleImpl.class
@ -1794,12 +1793,13 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
MethodHandle collectArgs = varargsArray(type.parameterCount()).asType(varargsType);
MethodHandle unboxResult = unboxResultHandle(tloop);
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLLLL();
LoopClauses clauseData =
new LoopClauses(new MethodHandle[][]{toArray(init), toArray(step), toArray(pred), toArray(fini)});
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
BoundMethodHandle mh;
try {
mh = (BoundMethodHandle) data.constructor().invokeBasic(type, form, (Object) toArray(init),
(Object) toArray(step), (Object) toArray(pred), (Object) toArray(fini), (Object) collectArgs,
(Object) unboxResult);
mh = (BoundMethodHandle) data.constructor().invokeBasic(type, form, (Object) clauseData,
(Object) collectArgs, (Object) unboxResult);
} catch (Throwable ex) {
throw uncaughtException(ex);
}
@ -1818,23 +1818,20 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
* {@code t12}):
* <blockquote><pre>{@code
* loop=Lambda(a0:L,a1:L)=>{
* t2:L=BoundMethodHandle$Species_L6.argL0(a0:L); // array of init method handles
* t3:L=BoundMethodHandle$Species_L6.argL1(a0:L); // array of step method handles
* t4:L=BoundMethodHandle$Species_L6.argL2(a0:L); // array of pred method handles
* t5:L=BoundMethodHandle$Species_L6.argL3(a0:L); // array of fini method handles
* t6:L=BoundMethodHandle$Species_L6.argL4(a0:L); // helper handle to box the arguments into an Object[]
* t7:L=BoundMethodHandle$Species_L6.argL5(a0:L); // helper handle to unbox the result
* t8:L=MethodHandle.invokeBasic(t6:L,a1:L); // box the arguments into an Object[]
* t9:L=MethodHandleImpl.loop(null,t2:L,t3:L,t4:L,t5:L,t6:L); // call the loop executor
* t10:L=MethodHandle.invokeBasic(t7:L,t9:L);t10:L} // unbox the result; return the result
* t2:L=BoundMethodHandle$Species_L3.argL0(a0:L); // LoopClauses holding init, step, pred, fini handles
* t3:L=BoundMethodHandle$Species_L3.argL1(a0:L); // helper handle to box the arguments into an Object[]
* t4:L=BoundMethodHandle$Species_L3.argL2(a0:L); // helper handle to unbox the result
* t5:L=MethodHandle.invokeBasic(t3:L,a1:L); // box the arguments into an Object[]
* t6:L=MethodHandleImpl.loop(null,t2:L,t3:L); // call the loop executor
* t7:L=MethodHandle.invokeBasic(t4:L,t6:L);t7:L} // unbox the result; return the result
* }</pre></blockquote>
* <p>
* {@code argL0} through {@code argL3} are the arrays of init, step, pred, and fini method handles.
* {@code argL4} and {@code argL5} are auxiliary method handles: {@code argL2} boxes arguments and wraps them into
* {@code Object[]} ({@code ValueConversions.array()}), and {@code argL3} unboxes the result if necessary
* {@code argL0} is a LoopClauses instance holding, in a 2-dimensional array, the init, step, pred, and fini method
* handles. {@code argL1} and {@code argL2} are auxiliary method handles: {@code argL1} boxes arguments and wraps
* them into {@code Object[]} ({@code ValueConversions.array()}), and {@code argL2} unboxes the result if necessary
* ({@code ValueConversions.unbox()}).
* <p>
* Having {@code t6} and {@code t7} passed in via a BMH and not hardcoded in the lambda form allows to share lambda
* Having {@code t3} and {@code t4} passed in via a BMH and not hardcoded in the lambda form allows to share lambda
* forms among loop combinators with the same basic type.
* <p>
* The above template is instantiated by using the {@link LambdaFormEditor} to replace the {@code null} argument to
@ -1845,15 +1842,12 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
private static LambdaForm makeLoopForm(MethodType basicType, BasicType[] localVarTypes) {
MethodType lambdaType = basicType.invokerType();
final int THIS_MH = 0; // the BMH_LLLLLL
final int THIS_MH = 0; // the BMH_LLL
final int ARG_BASE = 1; // start of incoming arguments
final int ARG_LIMIT = ARG_BASE + basicType.parameterCount();
int nameCursor = ARG_LIMIT;
final int GET_INITS = nameCursor++;
final int GET_STEPS = nameCursor++;
final int GET_PREDS = nameCursor++;
final int GET_FINIS = nameCursor++;
final int GET_CLAUSE_DATA = nameCursor++;
final int GET_COLLECT_ARGS = nameCursor++;
final int GET_UNBOX_RESULT = nameCursor++;
final int BOXED_ARGS = nameCursor++;
@ -1864,14 +1858,11 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
if (lform == null) {
Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLLLL();
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
names[THIS_MH] = names[THIS_MH].withConstraint(data);
names[GET_INITS] = new Name(data.getterFunction(0), names[THIS_MH]);
names[GET_STEPS] = new Name(data.getterFunction(1), names[THIS_MH]);
names[GET_PREDS] = new Name(data.getterFunction(2), names[THIS_MH]);
names[GET_FINIS] = new Name(data.getterFunction(3), names[THIS_MH]);
names[GET_COLLECT_ARGS] = new Name(data.getterFunction(4), names[THIS_MH]);
names[GET_UNBOX_RESULT] = new Name(data.getterFunction(5), names[THIS_MH]);
names[GET_CLAUSE_DATA] = new Name(data.getterFunction(0), names[THIS_MH]);
names[GET_COLLECT_ARGS] = new Name(data.getterFunction(1), names[THIS_MH]);
names[GET_UNBOX_RESULT] = new Name(data.getterFunction(2), names[THIS_MH]);
// t_{i}:L=MethodHandle.invokeBasic(collectArgs:L,a1:L,...);
MethodType collectArgsType = basicType.changeReturnType(Object.class);
@ -1881,10 +1872,10 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
System.arraycopy(names, ARG_BASE, args, 1, ARG_LIMIT - ARG_BASE);
names[BOXED_ARGS] = new Name(makeIntrinsic(invokeBasic, Intrinsic.LOOP), args);
// t_{i+1}:L=MethodHandleImpl.loop(localTypes:L,inits:L,steps:L,preds:L,finis:L,t_{i}:L);
// t_{i+1}:L=MethodHandleImpl.loop(localTypes:L,clauses:L,t_{i}:L);
Object[] lArgs =
new Object[]{null, // placeholder for BasicType[] localTypes - will be added by LambdaFormEditor
names[GET_INITS], names[GET_STEPS], names[GET_PREDS], names[GET_FINIS], names[BOXED_ARGS]};
names[GET_CLAUSE_DATA], names[BOXED_ARGS]};
names[LOOP] = new Name(NF_loop, lArgs);
// t_{i+2}:I=MethodHandle.invokeBasic(unbox:L,t_{i+1}:L);
@ -1900,22 +1891,52 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
return lform.editor().noteLoopLocalTypesForm(BOXED_ARGS, localVarTypes);
}
static class LoopClauses {
@Stable final MethodHandle[][] clauses;
LoopClauses(MethodHandle[][] clauses) {
assert clauses.length == 4;
this.clauses = clauses;
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer("LoopClauses -- ");
for (int i = 0; i < 4; ++i) {
if (i > 0) {
sb.append(" ");
}
sb.append('<').append(i).append(">: ");
MethodHandle[] hs = clauses[i];
for (int j = 0; j < hs.length; ++j) {
if (j > 0) {
sb.append(" ");
}
sb.append('*').append(j).append(": ").append(hs[j]).append('\n');
}
}
sb.append(" --\n");
return sb.toString();
}
}
/**
* Intrinsified during LambdaForm compilation
* (see {@link InvokerBytecodeGenerator#emitLoop(int)}).
*/
@LambdaForm.Hidden
static Object loop(BasicType[] localTypes, MethodHandle[] init, MethodHandle[] step, MethodHandle[] pred,
MethodHandle[] fini, Object... av) throws Throwable {
static Object loop(BasicType[] localTypes, LoopClauses clauseData, Object... av) throws Throwable {
final MethodHandle[] init = clauseData.clauses[0];
final MethodHandle[] step = clauseData.clauses[1];
final MethodHandle[] pred = clauseData.clauses[2];
final MethodHandle[] fini = clauseData.clauses[3];
int varSize = (int) Stream.of(init).filter(h -> h.type().returnType() != void.class).count();
int nArgs = init[0].type().parameterCount();
Object[] varsAndArgs = new Object[varSize + nArgs];
for (int i = 0, v = 0; i < init.length; ++i) {
if (init[i].type().returnType() == void.class) {
init[i].asFixedArity().invokeWithArguments(av);
MethodHandle ih = init[i];
if (ih.type().returnType() == void.class) {
ih.invokeWithArguments(av);
} else {
varsAndArgs[v++] = init[i].asFixedArity().invokeWithArguments(av);
varsAndArgs[v++] = ih.invokeWithArguments(av);
}
}
System.arraycopy(av, 0, varsAndArgs, varSize, nArgs);
@ -1926,12 +1947,12 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
MethodHandle s = step[i];
MethodHandle f = fini[i];
if (s.type().returnType() == void.class) {
s.asFixedArity().invokeWithArguments(varsAndArgs);
s.invokeWithArguments(varsAndArgs);
} else {
varsAndArgs[v++] = s.asFixedArity().invokeWithArguments(varsAndArgs);
varsAndArgs[v++] = s.invokeWithArguments(varsAndArgs);
}
if (!(boolean) p.asFixedArity().invokeWithArguments(varsAndArgs)) {
return f.asFixedArity().invokeWithArguments(varsAndArgs);
if (!(boolean) p.invokeWithArguments(varsAndArgs)) {
return f.invokeWithArguments(varsAndArgs);
}
}
}
@ -2122,14 +2143,13 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
Throwable t = null;
Object r = null;
try {
// Use asFixedArity() to avoid unnecessary boxing of last argument for VarargsCollector case.
r = target.asFixedArity().invokeWithArguments(av);
r = target.invokeWithArguments(av);
} catch (Throwable thrown) {
t = thrown;
throw t;
} finally {
Object[] args = target.type().returnType() == void.class ? prepend(av, t) : prepend(av, t, r);
r = cleanup.asFixedArity().invokeWithArguments(args);
r = cleanup.invokeWithArguments(args);
}
return r;
}

View File

@ -4368,10 +4368,11 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
}
// Step 4: fill in missing parameter types.
List<MethodHandle> finit = fillParameterTypes(init, commonSuffix);
List<MethodHandle> fstep = fillParameterTypes(step, commonParameterSequence);
List<MethodHandle> fpred = fillParameterTypes(pred, commonParameterSequence);
List<MethodHandle> ffini = fillParameterTypes(fini, commonParameterSequence);
// Also convert all handles to fixed-arity handles.
List<MethodHandle> finit = fixArities(fillParameterTypes(init, commonSuffix));
List<MethodHandle> fstep = fixArities(fillParameterTypes(step, commonParameterSequence));
List<MethodHandle> fpred = fixArities(fillParameterTypes(pred, commonParameterSequence));
List<MethodHandle> ffini = fixArities(fillParameterTypes(fini, commonParameterSequence));
assert finit.stream().map(MethodHandle::type).map(MethodType::parameterList).
allMatch(pl -> pl.equals(commonSuffix));
@ -4389,6 +4390,10 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
}).collect(Collectors.toList());
}
private static List<MethodHandle> fixArities(List<MethodHandle> hs) {
return hs.stream().map(MethodHandle::asFixedArity).collect(Collectors.toList());
}
/**
* Constructs a {@code while} loop from an initializer, a body, and a predicate. This is a convenience wrapper for
* the {@linkplain #loop(MethodHandle[][]) generic loop combinator}.
@ -4887,7 +4892,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
// target parameter list.
cleanup = dropArgumentsToMatch(cleanup, (rtype == void.class ? 1 : 2), targetParamTypes, 0);
return MethodHandleImpl.makeTryFinally(target, cleanup, rtype, targetParamTypes);
// Use asFixedArity() to avoid unnecessary boxing of last argument for VarargsCollector case.
return MethodHandleImpl.makeTryFinally(target.asFixedArity(), cleanup.asFixedArity(), rtype, targetParamTypes);
}
/**

View File

@ -664,7 +664,7 @@ final class ModuleInfo {
try {
bb.get(b, off, len);
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}
@ -681,7 +681,7 @@ final class ModuleInfo {
int ch = bb.get();
return (ch != 0);
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}
@ -690,7 +690,7 @@ final class ModuleInfo {
try {
return bb.get();
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}
@ -699,7 +699,7 @@ final class ModuleInfo {
try {
return ((int) bb.get()) & 0xff;
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}
@ -708,7 +708,7 @@ final class ModuleInfo {
try {
return bb.getShort();
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}
@ -717,7 +717,7 @@ final class ModuleInfo {
try {
return ((int) bb.getShort()) & 0xffff;
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}
@ -726,7 +726,7 @@ final class ModuleInfo {
try {
return bb.getChar();
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}
@ -735,7 +735,7 @@ final class ModuleInfo {
try {
return bb.getInt();
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}
@ -744,7 +744,7 @@ final class ModuleInfo {
try {
return bb.getLong();
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}
@ -753,7 +753,7 @@ final class ModuleInfo {
try {
return bb.getFloat();
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}
@ -762,7 +762,7 @@ final class ModuleInfo {
try {
return bb.getDouble();
} catch (BufferUnderflowException e) {
throw new EOFException();
throw new EOFException(e.getMessage());
}
}

View File

@ -597,10 +597,10 @@ public class Proxy implements java.io.Serializable {
private final Module module;
ProxyBuilder(ClassLoader loader, List<Class<?>> interfaces) {
if (!VM.isModuleSystemInited()) {
throw new InternalError("Proxy is not supported until module system is fully initialzed");
throw new InternalError("Proxy is not supported until module system is fully initialized");
}
if (interfaces.size() > 65535) {
throw new IllegalArgumentException("interface limit exceeded");
throw new IllegalArgumentException("interface limit exceeded: " + interfaces.size());
}
Set<Class<?>> refTypes = referencedTypes(loader, interfaces);

View File

@ -2559,6 +2559,13 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
* exceptionally with a CompletionException with this exception as
* cause.
*
* <p>Unless overridden by a subclass, a new non-minimal
* CompletableFuture with all methods available can be obtained from
* a minimal CompletionStage via {@link #toCompletableFuture()}.
* For example, completion of a minimal stage can be awaited by
*
* <pre> {@code minimalStage.toCompletableFuture().join(); }</pre>
*
* @return the new CompletionStage
* @since 9
*/
@ -2853,6 +2860,16 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
@Override public CompletableFuture<T> completeOnTimeout
(T value, long timeout, TimeUnit unit) {
throw new UnsupportedOperationException(); }
@Override public CompletableFuture<T> toCompletableFuture() {
Object r;
if ((r = result) != null)
return new CompletableFuture<T>(encodeRelay(r));
else {
CompletableFuture<T> d = new CompletableFuture<>();
unipush(new UniRelay<T,T>(d, this));
return d;
}
}
}
// VarHandle mechanics

View File

@ -1191,7 +1191,7 @@ public class ForkJoinPool extends AbstractExecutorService {
* Default idle timeout value (in milliseconds) for the thread
* triggering quiescence to park waiting for new work
*/
private static final long DEFAULT_KEEPALIVE = 60000L;
private static final long DEFAULT_KEEPALIVE = 60_000L;
/**
* Undershoot tolerance for idle timeouts
@ -2303,7 +2303,6 @@ public class ForkJoinPool extends AbstractExecutorService {
throw new NullPointerException();
long ms = Math.max(unit.toMillis(keepAliveTime), TIMEOUT_SLOP);
String prefix = "ForkJoinPool-" + nextPoolId() + "-worker-";
int corep = Math.min(Math.max(corePoolSize, parallelism), MAX_CAP);
long c = ((((long)(-corep) << TC_SHIFT) & TC_MASK) |
(((long)(-parallelism) << RC_SHIFT) & RC_MASK));
@ -2315,8 +2314,8 @@ public class ForkJoinPool extends AbstractExecutorService {
n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16;
n = (n + 1) << 1; // power of two, including space for submission queues
this.workerNamePrefix = "ForkJoinPool-" + nextPoolId() + "-worker-";
this.workQueues = new WorkQueue[n];
this.workerNamePrefix = prefix;
this.factory = factory;
this.ueh = handler;
this.saturate = saturate;
@ -2327,11 +2326,19 @@ public class ForkJoinPool extends AbstractExecutorService {
checkPermission();
}
private Object newInstanceFromSystemProperty(String property)
throws ReflectiveOperationException {
String className = System.getProperty(property);
return (className == null)
? null
: ClassLoader.getSystemClassLoader().loadClass(className)
.getConstructor().newInstance();
}
/**
* Constructor for common pool using parameters possibly
* overridden by system properties
*/
@SuppressWarnings("deprecation") // Class.newInstance
private ForkJoinPool(byte forCommonPoolOnly) {
int parallelism = -1;
ForkJoinWorkerThreadFactory fac = null;
@ -2339,18 +2346,12 @@ public class ForkJoinPool extends AbstractExecutorService {
try { // ignore exceptions in accessing/parsing properties
String pp = System.getProperty
("java.util.concurrent.ForkJoinPool.common.parallelism");
String fp = System.getProperty
("java.util.concurrent.ForkJoinPool.common.threadFactory");
String hp = System.getProperty
("java.util.concurrent.ForkJoinPool.common.exceptionHandler");
if (pp != null)
parallelism = Integer.parseInt(pp);
if (fp != null)
fac = ((ForkJoinWorkerThreadFactory)ClassLoader.
getSystemClassLoader().loadClass(fp).newInstance());
if (hp != null)
handler = ((UncaughtExceptionHandler)ClassLoader.
getSystemClassLoader().loadClass(hp).newInstance());
fac = (ForkJoinWorkerThreadFactory) newInstanceFromSystemProperty(
"java.util.concurrent.ForkJoinPool.common.threadFactory");
handler = (UncaughtExceptionHandler) newInstanceFromSystemProperty(
"java.util.concurrent.ForkJoinPool.common.exceptionHandler");
} catch (Exception ignore) {
}
@ -2373,8 +2374,8 @@ public class ForkJoinPool extends AbstractExecutorService {
n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16;
n = (n + 1) << 1;
this.workQueues = new WorkQueue[n];
this.workerNamePrefix = "ForkJoinPool.commonPool-worker-";
this.workQueues = new WorkQueue[n];
this.factory = fac;
this.ueh = handler;
this.saturate = null;

View File

@ -35,6 +35,9 @@
package java.util.concurrent.atomic;
import static java.lang.Double.doubleToRawLongBits;
import static java.lang.Double.longBitsToDouble;
import java.io.Serializable;
import java.util.function.DoubleBinaryOperator;
@ -91,7 +94,7 @@ public class DoubleAccumulator extends Striped64 implements Serializable {
public DoubleAccumulator(DoubleBinaryOperator accumulatorFunction,
double identity) {
this.function = accumulatorFunction;
base = this.identity = Double.doubleToRawLongBits(identity);
base = this.identity = doubleToRawLongBits(identity);
}
/**
@ -101,18 +104,19 @@ public class DoubleAccumulator extends Striped64 implements Serializable {
*/
public void accumulate(double x) {
Cell[] as; long b, v, r; int m; Cell a;
if ((as = cells) != null ||
(r = Double.doubleToRawLongBits
(function.applyAsDouble
(Double.longBitsToDouble(b = base), x))) != b && !casBase(b, r)) {
if ((as = cells) != null
|| ((r = doubleToRawLongBits
(function.applyAsDouble(longBitsToDouble(b = base), x))) != b
&& !casBase(b, r))) {
boolean uncontended = true;
if (as == null || (m = as.length - 1) < 0 ||
(a = as[getProbe() & m]) == null ||
!(uncontended =
(r = Double.doubleToRawLongBits
(function.applyAsDouble
(Double.longBitsToDouble(v = a.value), x))) == v ||
a.cas(v, r)))
if (as == null
|| (m = as.length - 1) < 0
|| (a = as[getProbe() & m]) == null
|| !(uncontended =
((r = doubleToRawLongBits
(function.applyAsDouble
(longBitsToDouble(v = a.value), x))) == v)
|| a.cas(v, r)))
doubleAccumulate(x, function, uncontended);
}
}
@ -128,12 +132,12 @@ public class DoubleAccumulator extends Striped64 implements Serializable {
*/
public double get() {
Cell[] as = cells;
double result = Double.longBitsToDouble(base);
double result = longBitsToDouble(base);
if (as != null) {
for (Cell a : as)
if (a != null)
result = function.applyAsDouble
(result, Double.longBitsToDouble(a.value));
(result, longBitsToDouble(a.value));
}
return result;
}
@ -168,12 +172,12 @@ public class DoubleAccumulator extends Striped64 implements Serializable {
*/
public double getThenReset() {
Cell[] as = cells;
double result = Double.longBitsToDouble(base);
double result = longBitsToDouble(base);
base = identity;
if (as != null) {
for (Cell a : as) {
if (a != null) {
double v = Double.longBitsToDouble(a.value);
double v = longBitsToDouble(a.value);
a.reset(identity);
result = function.applyAsDouble(result, v);
}
@ -267,9 +271,9 @@ public class DoubleAccumulator extends Striped64 implements Serializable {
* held by this proxy
*/
private Object readResolve() {
double d = Double.longBitsToDouble(identity);
double d = longBitsToDouble(identity);
DoubleAccumulator a = new DoubleAccumulator(function, d);
a.base = Double.doubleToRawLongBits(value);
a.base = doubleToRawLongBits(value);
return a;
}
}

View File

@ -103,14 +103,16 @@ public class LongAccumulator extends Striped64 implements Serializable {
*/
public void accumulate(long x) {
Cell[] as; long b, v, r; int m; Cell a;
if ((as = cells) != null ||
(r = function.applyAsLong(b = base, x)) != b && !casBase(b, r)) {
if ((as = cells) != null
|| ((r = function.applyAsLong(b = base, x)) != b
&& !casBase(b, r))) {
boolean uncontended = true;
if (as == null || (m = as.length - 1) < 0 ||
(a = as[getProbe() & m]) == null ||
!(uncontended =
(r = function.applyAsLong(v = a.value, x)) == v ||
a.cas(v, r)))
if (as == null
|| (m = as.length - 1) < 0
|| (a = as[getProbe() & m]) == null
|| !(uncontended =
(r = function.applyAsLong(v = a.value, x)) == v
|| a.cas(v, r)))
longAccumulate(x, function, uncontended);
}
}

View File

@ -186,7 +186,9 @@ public class BasicImageReader implements AutoCloseable {
if (result.getMajorVersion() != ImageHeader.MAJOR_VERSION ||
result.getMinorVersion() != ImageHeader.MINOR_VERSION) {
throw new IOException("The image file \"" + name + "\" is not the correct version");
throw new IOException("The image file \"" + name + "\" is not " +
"the correct version. Major: " + result.getMajorVersion() +
". Minor: " + result.getMinorVersion());
}
return result;
@ -318,11 +320,11 @@ public class BasicImageReader implements AutoCloseable {
private ByteBuffer readBuffer(long offset, long size) {
if (offset < 0 || Integer.MAX_VALUE <= offset) {
throw new IndexOutOfBoundsException("offset");
throw new IndexOutOfBoundsException("Bad offset: " + offset);
}
if (size < 0 || Integer.MAX_VALUE <= size) {
throw new IndexOutOfBoundsException("size");
throw new IndexOutOfBoundsException("Bad size: " + size);
}
if (MAP_ALL) {
@ -382,11 +384,13 @@ public class BasicImageReader implements AutoCloseable {
long uncompressedSize = loc.getUncompressedSize();
if (compressedSize < 0 || Integer.MAX_VALUE < compressedSize) {
throw new IndexOutOfBoundsException("Compressed size");
throw new IndexOutOfBoundsException(
"Bad compressed size: " + compressedSize);
}
if (uncompressedSize < 0 || Integer.MAX_VALUE < uncompressedSize) {
throw new IndexOutOfBoundsException("Uncompressed size");
throw new IndexOutOfBoundsException(
"Bad uncompressed size: " + uncompressedSize);
}
if (compressedSize == 0) {

View File

@ -79,7 +79,8 @@ public final class ImageHeader {
Objects.requireNonNull(buffer);
if (buffer.capacity() != HEADER_SLOTS) {
throw new InternalError("jimage header not the correct size");
throw new InternalError(
"jimage header not the correct size: " + buffer.capacity());
}
int magic = buffer.get(0);

View File

@ -81,7 +81,8 @@ public class ImageLocation {
}
if (kind < ATTRIBUTE_END || ATTRIBUTE_COUNT <= kind) {
throw new InternalError("Invalid jimage attribute kind");
throw new InternalError(
"Invalid jimage attribute kind: " + kind);
}
int length = attributeLength(data);
@ -91,7 +92,7 @@ public class ImageLocation {
value <<= 8;
if (!bytes.hasRemaining()) {
throw new InternalError("\"Missing jimage attribute datad");
throw new InternalError("Missing jimage attribute data");
}
value |= bytes.get() & 0xFF;
@ -134,7 +135,8 @@ public class ImageLocation {
long getAttribute(int kind) {
if (kind < ATTRIBUTE_END || ATTRIBUTE_COUNT <= kind) {
throw new InternalError("Invalid jimage attribute kind");
throw new InternalError(
"Invalid jimage attribute kind: " + kind);
}
return attributes[kind];
@ -142,7 +144,8 @@ public class ImageLocation {
String getAttributeString(int kind) {
if (kind < ATTRIBUTE_END || ATTRIBUTE_COUNT <= kind) {
throw new InternalError("Invalid jimage attribute kind");
throw new InternalError(
"Invalid jimage attribute kind: " + kind);
}
return getStrings().get((int)attributes[kind]);

View File

@ -82,7 +82,7 @@ public class ImageStream {
public void ensure(int needs) {
if (needs < 0) {
throw new IndexOutOfBoundsException("needs");
throw new IndexOutOfBoundsException("Bad value: " + needs);
}
if (needs > buffer.remaining()) {
@ -106,7 +106,7 @@ public class ImageStream {
public void skip(int n) {
if (n < 0) {
throw new IndexOutOfBoundsException("n");
throw new IndexOutOfBoundsException("skip value = " + n);
}
buffer.position(buffer.position() + n);

View File

@ -151,7 +151,7 @@ public class ImageStringsReader implements ImageStrings {
try {
charsFromMUTF8(chars, bytes, offset, count);
} catch (UTFDataFormatException ex) {
throw new InternalError("Attempt to convert non modified UTF-8 byte sequence");
throw new InternalError("Attempt to convert non modified UTF-8 byte sequence", ex);
}
return new String(chars);
@ -199,7 +199,8 @@ public class ImageStringsReader implements ImageStrings {
ch = buffer.get();
if ((ch & 0xC0) != 0x80) {
throw new InternalError("Bad continuation in modified UTF-8 byte sequence");
throw new InternalError("Bad continuation in " +
"modified UTF-8 byte sequence: " + ch);
}
uch = ((uch & ~mask) << 6) | (ch & 0x3F);
@ -208,7 +209,8 @@ public class ImageStringsReader implements ImageStrings {
}
if ((uch & 0xFFFF) != uch) {
throw new InternalError("UTF-32 char in modified UTF-8 byte sequence");
throw new InternalError("UTF-32 char in modified UTF-8 " +
"byte sequence: " + uch);
}
chars[j++] = (char)uch;

View File

@ -183,7 +183,7 @@ class JrtFileSystem extends FileSystem {
public PathMatcher getPathMatcher(String syntaxAndInput) {
int pos = syntaxAndInput.indexOf(':');
if (pos <= 0 || pos == syntaxAndInput.length()) {
throw new IllegalArgumentException();
throw new IllegalArgumentException("pos is " + pos);
}
String syntax = syntaxAndInput.substring(0, pos);
String input = syntaxAndInput.substring(pos + 1);
@ -285,7 +285,8 @@ class JrtFileSystem extends FileSystem {
for (OpenOption option : options) {
Objects.requireNonNull(option);
if (!(option instanceof StandardOpenOption)) {
throw new IllegalArgumentException();
throw new IllegalArgumentException(
"option class: " + option.getClass());
}
}
if (options.contains(StandardOpenOption.WRITE) ||

View File

@ -122,7 +122,8 @@ final class JrtPath implements Path {
public final JrtPath getName(int index) {
initOffsets();
if (index < 0 || index >= offsets.length) {
throw new IllegalArgumentException();
throw new IllegalArgumentException("index: " +
index + ", offsets length: " + offsets.length);
}
int begin = offsets[index];
int end;
@ -139,7 +140,9 @@ final class JrtPath implements Path {
initOffsets();
if (beginIndex < 0 || endIndex > offsets.length ||
beginIndex >= endIndex) {
throw new IllegalArgumentException();
throw new IllegalArgumentException(
"beginIndex: " + beginIndex + ", endIndex: " + endIndex +
", offsets length: " + offsets.length);
}
// starting/ending offsets
int begin = offsets[beginIndex];
@ -211,7 +214,8 @@ final class JrtPath implements Path {
return o;
}
if (jrtfs != o.jrtfs || isAbsolute() != o.isAbsolute()) {
throw new IllegalArgumentException();
throw new IllegalArgumentException(
"Incorrect filesystem or path: " + other);
}
final String tp = this.path;
final String op = o.path;
@ -366,7 +370,8 @@ final class JrtPath implements Path {
private JrtPath checkPath(Path path) {
Objects.requireNonNull(path);
if (!(path instanceof JrtPath))
throw new ProviderMismatchException();
throw new ProviderMismatchException("path class: " +
path.getClass());
return (JrtPath) path;
}
@ -459,7 +464,7 @@ final class JrtPath implements Path {
}
if (c == '\u0000') {
throw new InvalidPathException(path,
"Path: nul character not allowed");
"Path: NUL character not allowed");
}
to.append(c);
prevC = c;

View File

@ -1603,11 +1603,50 @@ public final class Unsafe {
return weakCompareAndSwapShort(o, offset, c2s(expected), c2s(x));
}
/**
* The JVM converts integral values to boolean values using two
* different conventions, byte testing against zero and truncation
* to least-significant bit.
*
* <p>The JNI documents specify that, at least for returning
* values from native methods, a Java boolean value is converted
* to the value-set 0..1 by first truncating to a byte (0..255 or
* maybe -128..127) and then testing against zero. Thus, Java
* booleans in non-Java data structures are by convention
* represented as 8-bit containers containing either zero (for
* false) or any non-zero value (for true).
*
* <p>Java booleans in the heap are also stored in bytes, but are
* strongly normalized to the value-set 0..1 (i.e., they are
* truncated to the least-significant bit).
*
* <p>The main reason for having different conventions for
* conversion is performance: Truncation to the least-significant
* bit can be usually implemented with fewer (machine)
* instructions than byte testing against zero.
*
* <p>A number of Unsafe methods load boolean values from the heap
* as bytes. Unsafe converts those values according to the JNI
* rules (i.e, using the "testing against zero" convention). The
* method {@code byte2bool} implements that conversion.
*
* @param b the byte to be converted to boolean
* @return the result of the conversion
*/
@ForceInline
private boolean byte2bool(byte b) {
return b > 0;
return b != 0;
}
/**
* Convert a boolean value to a byte. The return value is strongly
* normalized to the value-set 0..1 (i.e., the value is truncated
* to the least-significant bit). See {@link #byte2bool(byte)} for
* more details on conversion conventions.
*
* @param b the boolean to be converted to byte (and then normalized)
* @return the result of the conversion
*/
@ForceInline
private byte bool2byte(boolean b) {
return b ? (byte)1 : (byte)0;

View File

@ -50,7 +50,7 @@ public class VM {
public static void initLevel(int value) {
synchronized (lock) {
if (value <= initLevel || value > SYSTEM_BOOTED)
throw new InternalError();
throw new InternalError("Bad level: " + value);
initLevel = value;
lock.notifyAll();
}

View File

@ -153,27 +153,24 @@ public final class ModuleBootstrap {
boolean addAllDefaultModules = false;
boolean addAllSystemModules = false;
boolean addAllApplicationModules = false;
String propValue = getAndRemoveProperty("jdk.module.addmods");
if (propValue != null) {
for (String mod: propValue.split(",")) {
switch (mod) {
case ALL_DEFAULT:
addAllDefaultModules = true;
break;
case ALL_SYSTEM:
addAllSystemModules = true;
break;
case ALL_MODULE_PATH:
addAllApplicationModules = true;
break;
default :
roots.add(mod);
}
for (String mod: getExtraAddModules()) {
switch (mod) {
case ALL_DEFAULT:
addAllDefaultModules = true;
break;
case ALL_SYSTEM:
addAllSystemModules = true;
break;
case ALL_MODULE_PATH:
addAllApplicationModules = true;
break;
default :
roots.add(mod);
}
}
// --limit-modules
propValue = getAndRemoveProperty("jdk.module.limitmods");
String propValue = getAndRemoveProperty("jdk.module.limitmods");
if (propValue != null) {
Set<String> mods = new HashSet<>();
for (String mod: propValue.split(",")) {
@ -392,6 +389,32 @@ public final class ModuleBootstrap {
}
}
/**
* Returns the set of module names specified via --add-modules options
* on the command line
*/
private static Set<String> getExtraAddModules() {
String prefix = "jdk.module.addmods.";
int index = 0;
// the system property is removed after decoding
String value = getAndRemoveProperty(prefix + index);
if (value == null) {
return Collections.emptySet();
}
Set<String> modules = new HashSet<>();
while (value != null) {
for (String s : value.split(",")) {
if (s.length() > 0) modules.add(s);
}
index++;
value = getAndRemoveProperty(prefix + index);
}
return modules;
}
/**
* Process the --add-reads options to add any additional read edges that
@ -514,7 +537,7 @@ public final class ModuleBootstrap {
// value is <module>(,<module>)*
if (map.containsKey(key))
fail(key + " specified more than once");
fail(key + " specified more than once");
Set<String> values = new HashSet<>();
map.put(key, values);

View File

@ -166,6 +166,7 @@ module java.base {
jdk.charsets,
jdk.compiler,
jdk.jartool,
jdk.jdeps,
jdk.jlink,
jdk.net,
jdk.scripting.nashorn,
@ -189,7 +190,8 @@ module java.base {
jdk.unsupported,
jdk.vm.ci;
exports jdk.internal.util.jar to
jdk.jartool;
jdk.jartool,
jdk.jdeps;
exports jdk.internal.vm to
java.management,
jdk.jvmstat;

View File

@ -328,8 +328,6 @@ class DatagramChannelImpl
public SocketAddress receive(ByteBuffer dst) throws IOException {
if (dst.isReadOnly())
throw new IllegalArgumentException("Read-only buffer");
if (dst == null)
throw new NullPointerException();
synchronized (readLock) {
ensureOpen();
// Socket was not bound before attempting receive
@ -716,8 +714,6 @@ class DatagramChannelImpl
@Override
public DatagramChannel connect(SocketAddress sa) throws IOException {
int localPort = 0;
synchronized(readLock) {
synchronized(writeLock) {
synchronized (stateLock) {

View File

@ -616,8 +616,6 @@ class SocketChannelImpl
}
public boolean connect(SocketAddress sa) throws IOException {
int localPort = 0;
synchronized (readLock) {
synchronized (writeLock) {
ensureOpenAndUnconnected();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -344,7 +344,8 @@ abstract class SeedGenerator {
try {
BogusThread bt = new BogusThread();
Thread t = new Thread
(seedGroup, bt, "SeedGenerator Thread", 0, false);
(seedGroup, bt, "SeedGenerator Thread", 0,
false);
t.start();
} catch (Exception e) {
throw new InternalError("internal error: " +
@ -357,7 +358,8 @@ abstract class SeedGenerator {
long startTime = System.nanoTime();
while (System.nanoTime() - startTime < 250000000) {
synchronized(this){};
latch++;
// Mask the sign bit and keep latch non-negative
latch = (latch + 1) & 0x1FFFFFFF;
}
// Translate the value using the permutation, and xor
@ -431,7 +433,7 @@ abstract class SeedGenerator {
// data and using it to mix the trivial permutation.
// It should be evenly distributed. The specific values
// are not crucial to the security of this class.
private static byte[] rndTab = {
private static final byte[] rndTab = {
56, 30, -107, -6, -86, 25, -83, 75, -12, -64,
5, -128, 78, 21, 16, 32, 70, -81, 37, -51,
-43, -46, -108, 87, 29, 17, -55, 22, -11, -111,

View File

@ -179,6 +179,7 @@ JVM_GetStackTraceElements(JNIEnv *env, jobject throwable, jobjectArray elements)
*/
enum {
JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2,
JVM_STACKWALK_GET_CALLER_CLASS = 0x04,
JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20,
JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100
};

View File

@ -152,8 +152,8 @@ defaultPath(void)
#ifdef __solaris__
/* These really are the Solaris defaults! */
return (geteuid() == 0 || getuid() == 0) ?
"/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" :
"/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin:";
"/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" :
"/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:";
#else
return ":/bin:/usr/bin"; /* glibc */
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -35,12 +35,12 @@
#include "manifest_info.h"
#include "jli_util.h"
#define PATH_SEPARATOR ':'
#define FILESEP "/"
#define FILE_SEPARATOR '/'
#define PATH_SEPARATOR ':'
#define FILESEP "/"
#define FILE_SEPARATOR '/'
#define IS_FILE_SEPARATOR(c) ((c) == '/')
#ifndef MAXNAMELEN
#define MAXNAMELEN PATH_MAX
#define MAXNAMELEN PATH_MAX
#endif
#ifdef _LP64
@ -59,10 +59,13 @@ static jboolean GetJVMPath(const char *jrepath, const char *jvmtype,
static jboolean GetJREPath(char *path, jint pathsize, const char * arch,
jboolean speculative);
#if defined(_AIX)
#include "java_md_aix.h"
#endif
#ifdef MACOSX
#include "java_md_macosx.h"
#else /* !MACOSX */
#include "java_md_solinux.h"
#endif /* MACOSX */
#endif /* JAVA_MD_H */

View File

@ -33,6 +33,7 @@
#include <process.h>
#include <iphlpapi.h>
#include <icmpapi.h>
#include <WinError.h>
#include "java_net_InetAddress.h"
#include "java_net_Inet4AddressImpl.h"
@ -442,7 +443,15 @@ ping4(JNIEnv *env,
DWORD ReplySize = 0;
jboolean ret = JNI_FALSE;
ReplySize = sizeof(ICMP_ECHO_REPLY) + sizeof(SendData);
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa366051%28v=vs.85%29.aspx
ReplySize = sizeof(ICMP_ECHO_REPLY) // The buffer should be large enough
// to hold at least one ICMP_ECHO_REPLY
// structure
+ sizeof(SendData) // plus RequestSize bytes of data.
+ 8; // This buffer should also be large enough
// to also hold 8 more bytes of data
// (the size of an ICMP error message)
ReplyBuffer = (VOID*) malloc(ReplySize);
if (ReplyBuffer == NULL) {
IcmpCloseHandle(hIcmpFile);
@ -478,10 +487,47 @@ ping4(JNIEnv *env,
(timeout < 1000) ? 1000 : timeout); // DWORD Timeout
}
if (dwRetVal != 0) {
if (dwRetVal == 0) { // if the call failed
TCHAR *buf;
DWORD err = WSAGetLastError();
switch (err) {
case ERROR_NO_NETWORK:
case ERROR_NETWORK_UNREACHABLE:
case ERROR_HOST_UNREACHABLE:
case ERROR_PROTOCOL_UNREACHABLE:
case ERROR_PORT_UNREACHABLE:
case ERROR_REQUEST_ABORTED:
case ERROR_INCORRECT_ADDRESS:
case ERROR_HOST_DOWN:
case ERROR_INVALID_COMPUTERNAME:
case ERROR_INVALID_NETNAME:
case WSAEHOSTUNREACH: /* Host Unreachable */
case WSAENETUNREACH: /* Network Unreachable */
case WSAENETDOWN: /* Network is down */
case WSAEPFNOSUPPORT: /* Protocol Family unsupported */
case IP_REQ_TIMED_OUT:
break;
default:
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&buf, 0, NULL);
NET_ThrowNew(env, err, buf);
LocalFree(buf);
break;
}
} else {
PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)ReplyBuffer;
if ((int)pEchoReply->RoundTripTime <= timeout)
// This is to take into account the undocumented minimum
// timeout mentioned in the IcmpSendEcho call above.
// We perform an extra check to make sure that our
// roundtrip time was less than our desired timeout
// for cases where that timeout is < 1000ms.
if (pEchoReply->Status == IP_SUCCESS
&& (int)pEchoReply->RoundTripTime <= timeout)
{
ret = JNI_TRUE;
}
}
free(ReplyBuffer);

View File

@ -67,19 +67,22 @@ public final class ConstructorFinder extends AbstractFinder<Constructor<?>> {
*/
public static Constructor<?> findConstructor(Class<?> type, Class<?>...args) throws NoSuchMethodException {
if (type.isPrimitive()) {
throw new NoSuchMethodException("Primitive wrapper does not contain constructors");
throw new NoSuchMethodException("Primitive wrapper does not contain constructors: "
+ type.getName());
}
if (type.isInterface()) {
throw new NoSuchMethodException("Interface does not contain constructors");
throw new NoSuchMethodException("Interface does not contain constructors: "
+ type.getName());
}
if (!FinderUtils.isExported(type)) {
throw new NoSuchMethodException("Class is not accessible");
throw new NoSuchMethodException("Class is not accessible: " + type.getName());
}
if (Modifier.isAbstract(type.getModifiers())) {
throw new NoSuchMethodException("Abstract class cannot be instantiated");
throw new NoSuchMethodException("Abstract class cannot be instantiated: "
+ type.getName());
}
if (!Modifier.isPublic(type.getModifiers()) || !isPackageAccessible(type)) {
throw new NoSuchMethodException("Class is not accessible");
throw new NoSuchMethodException("Class is not accessible: " + type.getName());
}
PrimitiveWrapperMap.replacePrimitivesWithWrappers(args);
Signature signature = new Signature(type, args);

View File

@ -2461,16 +2461,16 @@ public abstract class ImageReader {
try {
bundle = ResourceBundle.getBundle(baseName, locale, this.getClass().getModule());
} catch (MissingResourceException mre) {
throw new IllegalArgumentException("Bundle not found!");
throw new IllegalArgumentException("Bundle not found!", mre);
}
String warning = null;
try {
warning = bundle.getString(keyword);
} catch (ClassCastException cce) {
throw new IllegalArgumentException("Resource is not a String!");
throw new IllegalArgumentException("Resource is not a String!", cce);
} catch (MissingResourceException mre) {
throw new IllegalArgumentException("Resource is missing!");
throw new IllegalArgumentException("Resource is missing!", mre);
}
listener.warningOccurred(this, warning);

View File

@ -1963,16 +1963,16 @@ public abstract class ImageWriter implements ImageTranscoder {
try {
bundle = ResourceBundle.getBundle(baseName, locale, this.getClass().getModule());
} catch (MissingResourceException mre) {
throw new IllegalArgumentException("Bundle not found!");
throw new IllegalArgumentException("Bundle not found!", mre);
}
String warning = null;
try {
warning = bundle.getString(keyword);
} catch (ClassCastException cce) {
throw new IllegalArgumentException("Resource is not a String!");
throw new IllegalArgumentException("Resource is not a String!", cce);
} catch (MissingResourceException mre) {
throw new IllegalArgumentException("Resource is missing!");
throw new IllegalArgumentException("Resource is missing!", mre);
}
listener.warningOccurred(this, imageIndex, warning);

View File

@ -442,7 +442,7 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
#ifndef __linux__ /* SOLARIS */
if (xrenderLibHandle == NULL) {
xrenderLibHandle = dlopen("/usr/sfw/lib/libXrender.so.1",
xrenderLibHandle = dlopen("/usr/lib/libXrender.so.1",
RTLD_LAZY | RTLD_GLOBAL);
}
#endif

View File

@ -39,6 +39,10 @@ DEF_STATIC_JNI_OnLoad
*/
JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
{
#if defined(HEADLESS)
/* there are no AWT libs available at all */
return JNI_FALSE;
#else
if (awt == NULL) {
return JNI_FALSE;
}
@ -64,4 +68,5 @@ JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
}
return JNI_TRUE;
#endif
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -68,8 +68,8 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
// master secret as a P11Key
private P11Key p11Key;
// version, e.g. 0x0301
private int version;
// whether SSLv3 is supported
private final boolean supportSSLv3;
P11TlsKeyMaterialGenerator(Token token, String algorithm, long mechanism)
throws PKCS11Exception {
@ -77,6 +77,11 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
this.token = token;
this.algorithm = algorithm;
this.mechanism = mechanism;
// Given the current lookup order specified in SunPKCS11.java,
// if CKM_SSL3_KEY_AND_MAC_DERIVE is not used to construct this object,
// it means that this mech is disabled or unsupported.
this.supportSSLv3 = (mechanism == CKM_SSL3_KEY_AND_MAC_DERIVE);
}
protected void engineInit(SecureRandom random) {
@ -89,20 +94,26 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
if (params instanceof TlsKeyMaterialParameterSpec == false) {
throw new InvalidAlgorithmParameterException(MSG);
}
this.spec = (TlsKeyMaterialParameterSpec)params;
TlsKeyMaterialParameterSpec spec = (TlsKeyMaterialParameterSpec)params;
int version = (spec.getMajorVersion() << 8) | spec.getMinorVersion();
if ((version == 0x0300 && !supportSSLv3) || (version < 0x0300) ||
(version > 0x0302)) {
throw new InvalidAlgorithmParameterException
("Only" + (supportSSLv3? " SSL 3.0,": "") +
" TLS 1.0, and TLS 1.1 are supported (0x" +
Integer.toHexString(version) + ")");
}
try {
p11Key = P11SecretKeyFactory.convertKey
(token, spec.getMasterSecret(), "TlsMasterSecret");
} catch (InvalidKeyException e) {
throw new InvalidAlgorithmParameterException("init() failed", e);
}
version = (spec.getMajorVersion() << 8) | spec.getMinorVersion();
if ((version < 0x0300) && (version > 0x0302)) {
throw new InvalidAlgorithmParameterException
("Only SSL 3.0, TLS 1.0, and TLS 1.1 are supported");
}
// we assume the token supports both the CKM_SSL3_* and the CKM_TLS_*
// mechanisms
this.spec = spec;
this.mechanism = (version == 0x0300)?
CKM_SSL3_KEY_AND_MAC_DERIVE : CKM_TLS_KEY_AND_MAC_DERIVE;
}
protected void engineInit(int keysize, SecureRandom random) {
@ -115,8 +126,6 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
throw new IllegalStateException
("TlsKeyMaterialGenerator must be initialized");
}
mechanism = (version == 0x0300) ? CKM_SSL3_KEY_AND_MAC_DERIVE
: CKM_TLS_KEY_AND_MAC_DERIVE;
int macBits = spec.getMacKeyLength() << 3;
int ivBits = spec.getIvLength() << 3;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -61,7 +61,10 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
private TlsMasterSecretParameterSpec spec;
private P11Key p11Key;
int version;
CK_VERSION ckVersion;
// whether SSLv3 is supported
private final boolean supportSSLv3;
P11TlsMasterSecretGenerator(Token token, String algorithm, long mechanism)
throws PKCS11Exception {
@ -69,6 +72,11 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
this.token = token;
this.algorithm = algorithm;
this.mechanism = mechanism;
// Given the current lookup order specified in SunPKCS11.java, if
// CKM_SSL3_MASTER_KEY_DERIVE is not used to construct this object,
// it means that this mech is disabled or unsupported.
supportSSLv3 = (mechanism == CKM_SSL3_MASTER_KEY_DERIVE);
}
protected void engineInit(SecureRandom random) {
@ -81,7 +89,17 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
if (params instanceof TlsMasterSecretParameterSpec == false) {
throw new InvalidAlgorithmParameterException(MSG);
}
this.spec = (TlsMasterSecretParameterSpec)params;
TlsMasterSecretParameterSpec spec = (TlsMasterSecretParameterSpec)params;
int version = (spec.getMajorVersion() << 8) | spec.getMinorVersion();
if ((version == 0x0300 && !supportSSLv3) || (version < 0x0300) ||
(version > 0x0302)) {
throw new InvalidAlgorithmParameterException
("Only" + (supportSSLv3? " SSL 3.0,": "") +
" TLS 1.0, and TLS 1.1 are supported (0x" +
Integer.toHexString(version) + ")");
}
SecretKey key = spec.getPremasterSecret();
// algorithm should be either TlsRsaPremasterSecret or TlsPremasterSecret,
// but we omit the check
@ -90,25 +108,7 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
} catch (InvalidKeyException e) {
throw new InvalidAlgorithmParameterException("init() failed", e);
}
version = (spec.getMajorVersion() << 8) | spec.getMinorVersion();
if ((version < 0x0300) || (version > 0x0302)) {
throw new InvalidAlgorithmParameterException
("Only SSL 3.0, TLS 1.0, and TLS 1.1 supported");
}
// We assume the token supports the required mechanism. If it does not,
// generateKey() will fail and the failover should take care of us.
}
protected void engineInit(int keysize, SecureRandom random) {
throw new InvalidParameterException(MSG);
}
protected SecretKey engineGenerateKey() {
if (spec == null) {
throw new IllegalStateException
("TlsMasterSecretGenerator must be initialized");
}
CK_VERSION ckVersion;
this.spec = spec;
if (p11Key.getAlgorithm().equals("TlsRsaPremasterSecret")) {
mechanism = (version == 0x0300) ? CKM_SSL3_MASTER_KEY_DERIVE
: CKM_TLS_MASTER_KEY_DERIVE;
@ -124,6 +124,17 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
: CKM_TLS_MASTER_KEY_DERIVE_DH;
ckVersion = null;
}
}
protected void engineInit(int keysize, SecureRandom random) {
throw new InvalidParameterException(MSG);
}
protected SecretKey engineGenerateKey() {
if (spec == null) {
throw new IllegalStateException
("TlsMasterSecretGenerator must be initialized");
}
byte[] clientRandom = spec.getClientRandom();
byte[] serverRandom = spec.getServerRandom();
CK_SSL3_RANDOM_DATA random =
@ -139,13 +150,12 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
long keyID = token.p11.C_DeriveKey(session.id(),
new CK_MECHANISM(mechanism, params), p11Key.keyID, attributes);
int major, minor;
ckVersion = params.pVersion;
if (ckVersion == null) {
if (params.pVersion == null) {
major = -1;
minor = -1;
} else {
major = ckVersion.major;
minor = ckVersion.minor;
major = params.pVersion.major;
minor = params.pVersion.minor;
}
SecretKey key = P11Key.masterSecretKey(session, keyID,
"TlsMasterSecret", 48 << 3, attributes, major, minor);
@ -156,5 +166,4 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
token.releaseSession(session);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -60,12 +60,20 @@ final class P11TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi {
@SuppressWarnings("deprecation")
private TlsRsaPremasterSecretParameterSpec spec;
// whether SSLv3 is supported
private final boolean supportSSLv3;
P11TlsRsaPremasterSecretGenerator(Token token, String algorithm, long mechanism)
throws PKCS11Exception {
super();
this.token = token;
this.algorithm = algorithm;
this.mechanism = mechanism;
// Given the current lookup order specified in SunPKCS11.java,
// if CKM_SSL3_PRE_MASTER_KEY_GEN is not used to construct this object,
// it means that this mech is disabled or unsupported.
this.supportSSLv3 = (mechanism == CKM_SSL3_PRE_MASTER_KEY_GEN);
}
protected void engineInit(SecureRandom random) {
@ -78,7 +86,20 @@ final class P11TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi {
if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) {
throw new InvalidAlgorithmParameterException(MSG);
}
this.spec = (TlsRsaPremasterSecretParameterSpec)params;
TlsRsaPremasterSecretParameterSpec spec =
(TlsRsaPremasterSecretParameterSpec) params;
int version = (spec.getMajorVersion() << 8) | spec.getMinorVersion();
if ((version == 0x0300 && !supportSSLv3) || (version < 0x0300) ||
(version > 0x0302)) {
throw new InvalidAlgorithmParameterException
("Only" + (supportSSLv3? " SSL 3.0,": "") +
" TLS 1.0, and TLS 1.1 are supported (0x" +
Integer.toHexString(version) + ")");
}
this.spec = spec;
}
protected void engineInit(int keysize, SecureRandom random) {

View File

@ -45,7 +45,7 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
* <pre>
* Secmod secmod = Secmod.getInstance();
* if (secmod.isInitialized() == false) {
* secmod.initialize("/home/myself/.mozilla", "/usr/sfw/lib/mozilla");
* secmod.initialize("/home/myself/.mozilla");
* }
*
* Provider p = secmod.getModule(ModuleType.KEYSTORE).getProvider();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -145,6 +145,7 @@ public class Test5 extends Test {
socket.close();
s = new String (b,0,count, "ISO8859_1");
if (!compare (s, result)) {
System.err.println(" Expected [" + result + "]\n actual [" + s + "]");
throw new RuntimeException ("wrong string result");
}
}

View File

@ -21,10 +21,11 @@
* questions.
*/
/**
/*
* @test
* @bug 8146156
* @summary test whether conversion follows Locale.Category.FORMAT locale.
* @modules jdk.localedata
* @run main/othervm FormatLocale
*/

View File

@ -0,0 +1,35 @@
/*
* 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.
*/
/*
* @test
* @bug 8157464
* @summary Basic test for StackWalker.getCallerClass()
* @library src
* @build java.base/java.util.CSM csm/*
* @run main/othervm csm/jdk.test.CallerSensitiveTest
* @run main/othervm csm/jdk.test.CallerSensitiveTest sm
*/
public class Main {
}

View File

@ -0,0 +1,159 @@
/*
* 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;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.invoke.MethodType;
import java.lang.reflect.Method;
import java.security.Permission;
import java.security.PermissionCollection;
import java.security.Permissions;
import java.security.Policy;
import java.security.ProtectionDomain;
import java.util.CSM.Result;
import java.util.function.Supplier;
/**
* This test invokes StackWalker::getCallerClass via static reference,
* reflection, MethodHandle, lambda. Also verify that
* StackWalker::getCallerClass can't be called from @CallerSensitive method.
*/
public class CallerSensitiveTest {
private static final String NON_CSM_CALLER_METHOD = "getCallerClass";
private static final String CSM_CALLER_METHOD = "caller";
public static void main(String... args) throws Throwable {
boolean sm = false;
if (args.length > 0 && args[0].equals("sm")) {
sm = true;
PermissionCollection perms = new Permissions();
perms.add(new StackFramePermission("retainClassReference"));
Policy.setPolicy(new Policy() {
@Override
public boolean implies(ProtectionDomain domain, Permission p) {
return perms.implies(p);
}
});
System.setSecurityManager(new SecurityManager());
}
System.err.format("Test %s security manager.%n",
sm ? "with" : "without");
CallerSensitiveTest cstest = new CallerSensitiveTest();
// test static call to java.util.CSM::caller and CSM::getCallerClass
cstest.staticMethodCall();
// test java.lang.reflect.Method call
cstest.reflectMethodCall();
// test java.lang.invoke.MethodHandle
cstest.invokeMethodHandle(Lookup1.lookup);
cstest.invokeMethodHandle(Lookup2.lookup);
// test method ref
cstest.lambda();
LambdaTest.lambda();
if (failed > 0) {
throw new RuntimeException(failed + " test cases failed.");
}
}
void staticMethodCall() {
java.util.CSM.caller();
Result result = java.util.CSM.getCallerClass();
checkNonCSMCaller(CallerSensitiveTest.class, result);
}
void reflectMethodCall() throws Throwable {
Method method1 = java.util.CSM.class.getMethod(CSM_CALLER_METHOD);
method1.invoke(null);
Method method2 = java.util.CSM.class.getMethod(NON_CSM_CALLER_METHOD);
Result result = (Result) method2.invoke(null);
checkNonCSMCaller(CallerSensitiveTest.class, result);
}
void invokeMethodHandle(Lookup lookup) throws Throwable {
MethodHandle mh1 = lookup.findStatic(java.util.CSM.class, CSM_CALLER_METHOD,
MethodType.methodType(Class.class));
Class<?> c = (Class<?>)mh1.invokeExact();
MethodHandle mh2 = lookup.findStatic(java.util.CSM.class, NON_CSM_CALLER_METHOD,
MethodType.methodType(Result.class));
Result result = (Result)mh2.invokeExact();
checkNonCSMCaller(CallerSensitiveTest.class, result);
}
void lambda() {
Result result = LambdaTest.getCallerClass.get();
checkNonCSMCaller(CallerSensitiveTest.class, result);
LambdaTest.caller.get();
}
static int failed = 0;
static void checkNonCSMCaller(Class<?> expected, Result result) {
if (result.callers.size() != 1) {
throw new RuntimeException("Expected result.callers contain one element");
}
if (expected != result.callers.get(0)) {
System.err.format("ERROR: Expected %s but got %s%n", expected,
result.callers);
result.frames.stream()
.forEach(f -> System.err.println(" " + f));
failed++;
}
}
static class Lookup1 {
static Lookup lookup = MethodHandles.lookup();
}
static class Lookup2 {
static Lookup lookup = MethodHandles.lookup();
}
static class LambdaTest {
static Supplier<Class<?>> caller = java.util.CSM::caller;
static Supplier<Result> getCallerClass = java.util.CSM::getCallerClass;
static void caller() {
caller.get();
}
static Result getCallerClass() {
return getCallerClass.get();
}
static void lambda() {
Result result = LambdaTest.getCallerClass();
checkNonCSMCaller(LambdaTest.class, result);
LambdaTest.caller();
}
}
}

View File

@ -0,0 +1,26 @@
/*
* 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.
*/
module csm {
exports jdk.test;
}

View File

@ -0,0 +1,77 @@
/*
* 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 java.util;
import static java.lang.StackWalker.Option.*;
import java.lang.StackWalker.StackFrame;
import java.util.stream.Collectors;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
public class CSM {
private static StackWalker walker =
StackWalker.getInstance(EnumSet.of(RETAIN_CLASS_REFERENCE,
SHOW_HIDDEN_FRAMES,
SHOW_REFLECT_FRAMES));
public static class Result {
public final List<Class<?>> callers;
public final List<StackWalker.StackFrame> frames;
Result(List<Class<?>> callers,
List<StackFrame> frames) {
this.callers = callers;
this.frames = frames;
}
}
/**
* Returns the caller of this caller-sensitive method returned by
* by Reflection::getCallerClass.
*
* StackWalker::getCallerClass is expected to throw UOE
*/
@CallerSensitive
public static Class<?> caller() {
Class<?> c1 = Reflection.getCallerClass();
try {
Class<?> c2 = walker.getCallerClass();
throw new RuntimeException("Exception not thrown by StackWalker::getCallerClass");
} catch (UnsupportedOperationException e) {}
return c1;
}
/**
* Returns the caller of this non-caller-sensitive method.
*/
public static Result getCallerClass() {
Class<?> caller = walker.getCallerClass();
return new Result(List.of(caller), dump());
}
static List<StackFrame> dump() {
return walker.walk(s -> s.collect(Collectors.toList()));
}
}

View File

@ -0,0 +1,32 @@
/*
* 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.
*/
import java.lang.instrument.Instrumentation;
class SimpleAgent {
public static void premain(String args, Instrumentation inst) {
System.out.println("in premain");
}
}

View File

@ -0,0 +1,40 @@
/*
* 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.
*/
/**
*
* @test
* @summary Tests that the -javaagent option adds the java.instrument into
* the module graph
* @modules java.instrument
* @run shell MakeJAR3.sh SimpleAgent
* @run main/othervm -javaagent:SimpleAgent.jar -limitmods java.base TestAgentWithLimitMods
*
*/
public class TestAgentWithLimitMods {
public static void main(String[] args) {
System.out.println("Test passed");
}
}

View File

@ -632,6 +632,7 @@ public class MethodHandlesTest {
}
public void testFindVirtualClone0() throws Throwable {
if (CAN_SKIP_WORKING) return;
// test some ad hoc system methods
testFindVirtual(false, PUBLIC, Object.class, Object.class, "clone");
@ -2798,11 +2799,17 @@ public class MethodHandlesTest {
toClauseMajor(postClauses, inits, steps, usePreds, finis);
MethodHandle pre = MethodHandles.loop(preClauses);
MethodHandle post = MethodHandles.loop(postClauses);
if (verbosity >= 6) {
System.out.println("pre-handle: " + pre);
}
Object[] preResults = (Object[]) pre.invokeWithArguments(args);
if (verbosity >= 4) {
System.out.println("pre-checked: expected " + Arrays.asList(preCheckedResults[i]) + ", actual " +
Arrays.asList(preResults));
}
if (verbosity >= 6) {
System.out.println("post-handle: " + post);
}
Object[] postResults = (Object[]) post.invokeWithArguments(args);
if (verbosity >= 4) {
System.out.println("post-checked: expected " + Arrays.asList(postCheckedResults[i]) + ", actual " +

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -37,26 +37,27 @@ public class TimeToLive {
static int[] bad_ttls = { -1, 256 };
public static void main(String[] args) throws Exception {
MulticastSocket socket = new MulticastSocket(6789);
int ttl = socket.getTimeToLive();
System.out.println("default ttl: " + ttl);
for (int i = 0; i < new_ttls.length; i++) {
socket.setTimeToLive(new_ttls[i]);
if (!(new_ttls[i] == socket.getTimeToLive())) {
throw new RuntimeException("test failure, set/get differ: " +
new_ttls[i] + " / " +
socket.getTimeToLive());
try (MulticastSocket socket = new MulticastSocket()) {
int ttl = socket.getTimeToLive();
System.out.println("default ttl: " + ttl);
for (int i = 0; i < new_ttls.length; i++) {
socket.setTimeToLive(new_ttls[i]);
if (!(new_ttls[i] == socket.getTimeToLive())) {
throw new RuntimeException("test failure, set/get differ: " +
new_ttls[i] + " / " +
socket.getTimeToLive());
}
}
}
for (int j = 0; j < bad_ttls.length; j++) {
boolean exception = false;
try {
socket.setTimeToLive(bad_ttls[j]);
} catch (IllegalArgumentException e) {
exception = true;
}
if (!exception) {
throw new RuntimeException("bad argument accepted: " + bad_ttls[j]);
for (int j = 0; j < bad_ttls.length; j++) {
boolean exception = false;
try {
socket.setTimeToLive(bad_ttls[j]);
} catch (IllegalArgumentException e) {
exception = true;
}
if (!exception) {
throw new RuntimeException("bad argument accepted: " + bad_ttls[j]);
}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@ -68,23 +68,23 @@ public class ThreadStop {
thr.start();
// give server time to block in ServerSocket.accept()
Thread.currentThread().sleep(2000);
Thread.sleep(2000);
// "stop" the thread
thr.stop();
// give thread time to stop
Thread.currentThread().sleep(2000);
Thread.sleep(2000);
// it's platform specific if Thread.stop interrupts the
// thread - on Linux/Windows most likely that thread is
// still in accept() so we connect to server which causes
// it to unblock and do JNI-stuff with a pending exception
try {
Socket s = new Socket("localhost", svr.localPort());
} catch (IOException ioe) { }
try (Socket s = new Socket("localhost", svr.localPort())) {
} catch (IOException ioe) {
}
thr.join();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -27,6 +27,7 @@
@author Chris Hegarty
*/
import java.net.BindException;
import java.net.ServerSocket;
import java.io.File;
import java.io.IOException;
@ -74,6 +75,11 @@ public class InheritHandle
} catch (IOException ioe) {
System.out.println("Cannot create process");
ioe.printStackTrace();
try {
ss.close();
} catch (IOException e) {
e.printStackTrace();
}
return;
}
@ -85,9 +91,18 @@ public class InheritHandle
System.out.println("Now close the socket and try to create another" +
" one listening on the same port");
ss.close();
ss = new ServerSocket(port);
System.out.println("Second ServerSocket created successfully");
ss.close();
int retries = 0;
while (retries < 5) {
try (ServerSocket s = new ServerSocket(port);) {
System.out.println("Second ServerSocket created successfully");
break;
} catch (BindException e) {
System.out.println("BindException \"" + e.getMessage() + "\", retrying...");
Thread.sleep(100L);
retries ++;
continue;
}
}
} catch (InterruptedException ie) {
} catch (IOException ioe) {

View File

@ -27,6 +27,7 @@
* @summary Test two URLClassLoader define Package object of the same name
* @library /lib/testlibrary
* @build CompilerUtils
* @modules jdk.compiler
* @run testng SplitPackage
*/

View File

@ -37,6 +37,7 @@ public class LookupTest {
String url, boolean throwsSecException, boolean throwsIOException)
{
try {
ProxySelector.setDefault(null);
URL u = new URL(url);
System.err.println ("Connecting to " + u);
URLConnection urlc = u.openConnection();
@ -71,7 +72,7 @@ public class LookupTest {
System.out.print(port);
} else if (cmd.equals("-runtest")) {
port = Integer.parseInt(args[1]);
String hostsFileName = System.getProperty("test.src", ".") + "/LookupTestHosts";
String hostsFileName = System.getProperty("user.dir", ".") + "/LookupTestHosts";
System.setProperty("jdk.net.hosts.file", hostsFileName);
addMappingToHostsFile("allowedAndFound.com", "127.0.0.1", hostsFileName, false);
addMappingToHostsFile("notAllowedButFound.com", "99.99.99.99", hostsFileName, true);

View File

@ -1,2 +0,0 @@
127.0.0.1 allowedAndFound.com
99.99.99.99 notAllowedButFound.com

View File

@ -48,6 +48,7 @@ cat << POLICY > policy
grant {
permission java.net.URLPermission "http://allowedAndFound.com:${port}/-", "*:*";
permission java.net.URLPermission "http://allowedButNotfound.com:${port}/-", "*:*";
permission java.net.NetPermission "setProxySelector";
permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
permission java.util.PropertyPermission "java.io.tmpdir", "read";

View File

@ -23,9 +23,11 @@
* questions.
*/
/**
/*
* @test
* @bug 8153142
* @modules java.httpclient
* jdk.httpserver
* @run main/othervm HeadersTest1
* @summary HeadersTest1
*/
@ -39,9 +41,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpClient;
import java.net.http.HttpHeaders;
import java.net.http.HttpResponse;
import java.net.http.HttpRequest;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.List;

View File

@ -26,6 +26,7 @@
* @test
* @bug 8163561
* @modules java.base/sun.net.www
* java.httpclient
* @summary Verify that Proxy-Authenticate header is correctly handled
*
* @run main/othervm ProxyAuthTest

View File

@ -24,5 +24,6 @@
/*
* @test
* @bug 8151299
* @modules java.httpclient
* @run testng java.httpclient/java.net.http.SelectorTest
*/

View File

@ -33,7 +33,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.NavigableMap;
import java.util.SortedMap;
import java.util.TreeMap;
@ -41,10 +40,8 @@ import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
import static org.testng.Assert.fail;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertSame;
public class EmptyNavigableMap {

View File

@ -41,10 +41,9 @@ import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
import static org.testng.Assert.fail;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
public class EmptyNavigableSet {

View File

@ -28,8 +28,14 @@
* @author Martin Buchholz
*/
import java.util.*;
import java.util.concurrent.*;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.NoSuchElementException;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.LinkedBlockingDeque;
public class ChorusLine {
private interface Tweaker {

View File

@ -28,7 +28,11 @@
* @author Martin Buchholz
*/
import java.util.*;
import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
public class ForgetMeNot {
private static void checkQ(PriorityQueue<Integer> q, Integer...elts) {

View File

@ -37,7 +37,13 @@
* @summary Checks that a priority queue returns elements in sorted order across various operations
*/
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Queue;
import java.util.PriorityQueue;
public class PriorityQueueSort {

View File

@ -28,8 +28,17 @@
* @author Martin Buchholz
*/
import java.util.*;
import java.util.concurrent.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.LinkedTransferQueue;
public class RemoveContains {
static volatile int passed = 0, failed = 0;

View File

@ -31,8 +31,6 @@
*/
import static java.util.concurrent.Executors.defaultThreadFactory;
import static java.util.concurrent.Executors.newFixedThreadPool;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static java.util.concurrent.TimeUnit.MILLISECONDS;

View File

@ -83,15 +83,18 @@ public class CoreThreadTimeOut {
tpe.allowCoreThreadTimeOut(true);
check(tpe.allowsCoreThreadTimeOut());
equal(countExecutorThreads(), 0);
long t0 = System.nanoTime();
for (int i = 0; i < threadCount; i++)
tpe.submit(new Runnable() { public void run() {}});
int count = countExecutorThreads();
if (millisElapsedSince(t0) < timeoutMillis)
equal(count, threadCount);
long startTime = System.nanoTime();
for (int i = 0; i < threadCount; i++) {
tpe.submit(() -> {});
int count = countExecutorThreads();
if (millisElapsedSince(startTime) < timeoutMillis)
equal(count, i + 1);
}
while (countExecutorThreads() > 0 &&
millisElapsedSince(t0) < 10 * 1000);
millisElapsedSince(startTime) < LONG_DELAY_MS)
Thread.yield();
equal(countExecutorThreads(), 0);
check(millisElapsedSince(startTime) >= timeoutMillis);
tpe.shutdown();
check(tpe.allowsCoreThreadTimeOut());
check(tpe.awaitTermination(LONG_DELAY_MS, MILLISECONDS));

View File

@ -303,7 +303,7 @@ public class AtomicIntegerArrayTest extends JSR166TestCase {
class Counter extends CheckedRunnable {
final AtomicIntegerArray aa;
volatile int counts;
int decs;
Counter(AtomicIntegerArray a) { aa = a; }
public void realRun() {
for (;;) {
@ -314,7 +314,7 @@ public class AtomicIntegerArrayTest extends JSR166TestCase {
if (v != 0) {
done = false;
if (aa.compareAndSet(i, v, v - 1))
++counts;
decs++;
}
}
if (done)
@ -334,13 +334,11 @@ public class AtomicIntegerArrayTest extends JSR166TestCase {
aa.set(i, countdown);
Counter c1 = new Counter(aa);
Counter c2 = new Counter(aa);
Thread t1 = new Thread(c1);
Thread t2 = new Thread(c2);
t1.start();
t2.start();
Thread t1 = newStartedThread(c1);
Thread t2 = newStartedThread(c2);
t1.join();
t2.join();
assertEquals(c1.counts+c2.counts, SIZE * countdown);
assertEquals(c1.decs + c2.decs, SIZE * countdown);
}
/**

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