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 a71210c0d9800eb6925b61ecd6198abd554f90ee jdk-9+134
e384420383a5b79fa0012ebcb25d8f83cff7f777 jdk-9+135 e384420383a5b79fa0012ebcb25d8f83cff7f777 jdk-9+135
1b4b5d01aa11edf24b6fadbe3d2f3e411e3b02cd jdk-9+136 1b4b5d01aa11edf24b6fadbe3d2f3e411e3b02cd jdk-9+136
9cb87c88ed851c0575b8ead753ea238ed5b544e9 jdk-9+137

View File

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

View File

@ -28,8 +28,8 @@
### It also performs some sanity checks on make. ### 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. # The shell code below will be executed on /usr/bin/make on Solaris, but not in GNU Make.
# /usr/ccs/bin/make lacks basically every other flow control mechanism. # /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 .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. # 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 <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 OpenJDK on Solaris and Linux. The Solaris header files can be obtained by
installing the package <strong>SFWcups</strong> from the Solaris Software Companion installing the package <strong>print/cups</strong>.</p>
CD/DVD, these often will be installed into the directory <code>/opt/sfw/cups</code>.</p>
<p>The CUPS header files can always be downloaded from <p>The CUPS header files can always be downloaded from
<a href="http://www.cups.org">www.cups.org</a>.</p> <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>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 <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 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>, should try and use <code>/usr/bin/gmake</code> or <code>/usr/gnu/bin/make</code>.</li>
<code>/opt/sfw/bin</code> or <code>/usr/sfw/bin</code> directory.</li>
<li><strong>Windows:</strong> Make sure you start your build inside a bash shell.</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> <li><strong>Mac OS X:</strong> The XCode "command line tools" must be installed on your Mac.</li>
</ul> </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 > 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 OpenJDK on Solaris and Linux. The Solaris header files can be obtained by
installing the package **SFWcups** from the Solaris Software Companion installing the package **print/cups**.
CD/DVD, these often will be installed into the directory `/opt/sfw/cups`.
> The CUPS header files can always be downloaded from > The CUPS header files can always be downloaded from
[www.cups.org](http://www.cups.org). [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`. * Place the location of the GNU make binary in the `PATH`.
* **Solaris:** Do NOT use `/usr/bin/make` on Solaris. If your Solaris system * **Solaris:** Do NOT use `/usr/bin/make` on Solaris. If your Solaris system
has the software from the Solaris Developer Companion CD installed, you 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`, should try and use `/usr/bin/gmake` or `/usr/gnu/bin/make`.
`/opt/sfw/bin` or `/usr/sfw/bin` directory.
* **Windows:** Make sure you start your build inside a bash shell. * **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. * **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 # Prepend the extra path to the global path
BASIC_PREPEND_TO_PATH([PATH],$EXTRA_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_CHECKING([for sysroot])
AC_MSG_RESULT([$SYSROOT]) AC_MSG_RESULT([$SYSROOT])
AC_MSG_CHECKING([for toolchain path]) AC_MSG_CHECKING([for toolchain path])

View File

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

View File

@ -926,9 +926,7 @@ COMPRESS_JARS
INCLUDE_SA INCLUDE_SA
UNLIMITED_CRYPTO UNLIMITED_CRYPTO
CACERTS_FILE CACERTS_FILE
BUILD_HEADLESS ENABLE_HEADLESS_ONLY
SUPPORT_HEADFUL
SUPPORT_HEADLESS
DEFAULT_MAKE_TARGET DEFAULT_MAKE_TARGET
OS_VERSION_MICRO OS_VERSION_MICRO
OS_VERSION_MINOR OS_VERSION_MINOR
@ -1153,7 +1151,7 @@ with_sdk_name
with_conf_name with_conf_name
with_output_sync with_output_sync
with_default_make_target with_default_make_target
enable_headful enable_headless_only
with_cacerts_file with_cacerts_file
enable_unlimited_crypto enable_unlimited_crypto
with_copyright_year with_copyright_year
@ -1976,8 +1974,7 @@ Optional Features:
[disabled] [disabled]
--enable-debug set the debug level to fastdebug (shorthand for --enable-debug set the debug level to fastdebug (shorthand for
--with-debug-level=fastdebug) [disabled] --with-debug-level=fastdebug) [disabled]
--disable-headful disable building headful support (graphical UI --enable-headless-only only build headless (no GUI) support [disabled]
support) [enabled]
--enable-unlimited-crypto --enable-unlimited-crypto
Enable unlimited crypto policy [disabled] Enable unlimited crypto policy [disabled]
--disable-keep-packaged-modules --disable-keep-packaged-modules
@ -5095,7 +5092,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE #CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks: # 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 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 "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
$as_echo_n "checking for sysroot... " >&6; } $as_echo_n "checking for sysroot... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSROOT" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSROOT" >&5
@ -24197,37 +24189,31 @@ fi
# We need build & target for this. # We need build & target for this.
# Should we build a JDK/JVM with headful support (ie a graphical ui)? # Should we build a JDK without a graphical UI?
# We always build headless support. { $as_echo "$as_me:${as_lineno-$LINENO}: checking headless only" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking headful support" >&5 $as_echo_n "checking headless only... " >&6; }
$as_echo_n "checking headful support... " >&6; } # Check whether --enable-headless-only was given.
# Check whether --enable-headful was given. if test "${enable_headless_only+set}" = set; then :
if test "${enable_headful+set}" = set; then : enableval=$enable_headless_only;
enableval=$enable_headful; SUPPORT_HEADFUL=${enable_headful}
else
SUPPORT_HEADFUL=yes
fi fi
SUPPORT_HEADLESS=yes if test "x$enable_headless_only" = "xyes"; then
BUILD_HEADLESS="BUILD_HEADLESS:=true" ENABLE_HEADLESS_ONLY="true"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
if test "x$SUPPORT_HEADFUL" = xyes; then $as_echo "yes" >&6; }
# We are building both headful and headless. elif test "x$enable_headless_only" = "xno"; then
headful_msg="include support for both headful and headless" 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 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 # Choose cacerts source file
@ -31475,8 +31461,7 @@ fi
# inlining of system functions and intrinsics. # inlining of system functions and intrinsics.
SYSROOT_CFLAGS="-I-xbuiltin -I$SYSROOT/usr/include" SYSROOT_CFLAGS="-I-xbuiltin -I$SYSROOT/usr/include"
SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \ SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \ -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
-L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
fi fi
elif test "x$TOOLCHAIN_TYPE" = xgcc; then elif test "x$TOOLCHAIN_TYPE" = xgcc; then
SYSROOT_CFLAGS="--sysroot=$SYSROOT" 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 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 # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to
# override all other locations. # override all other locations.
if test "x$TOOLCHAIN_PATH" != x; then if test "x$TOOLCHAIN_PATH" != x; then
@ -44000,8 +43977,7 @@ $as_echo "$BUILD_DEVKIT_ROOT" >&6; }
# inlining of system functions and intrinsics. # inlining of system functions and intrinsics.
BUILD_SYSROOT_CFLAGS="-I-xbuiltin -I$BUILD_SYSROOT/usr/include" BUILD_SYSROOT_CFLAGS="-I-xbuiltin -I$BUILD_SYSROOT/usr/include"
BUILD_SYSROOT_LDFLAGS="-L$BUILD_SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \ BUILD_SYSROOT_LDFLAGS="-L$BUILD_SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$BUILD_SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \ -L$BUILD_SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
-L$BUILD_SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
fi fi
elif test "x$TOOLCHAIN_TYPE" = xgcc; then elif test "x$TOOLCHAIN_TYPE" = xgcc; then
BUILD_SYSROOT_CFLAGS="--sysroot=$BUILD_SYSROOT" BUILD_SYSROOT_CFLAGS="--sysroot=$BUILD_SYSROOT"
@ -53060,13 +53036,9 @@ $as_echo "yes" >&6; }
# No X11 support on windows or macosx # No X11 support on windows or macosx
NEEDS_LIB_X11=false NEEDS_LIB_X11=false
else else
if test "x$SUPPORT_HEADFUL" = xno; then # All other instances need X11, even if building headless only, libawt still
# No X11 support if building headless-only # needs X11 headers.
NEEDS_LIB_X11=false NEEDS_LIB_X11=true
else
# All other instances need X11
NEEDS_LIB_X11=true
fi
fi fi
# Check if cups is needed # Check if cups is needed
@ -56730,9 +56702,7 @@ fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then if test "x$OPENJDK_TARGET_OS" = xsolaris; then
OPENWIN_HOME="/usr/openwin" OPENWIN_HOME="/usr/openwin"
X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions" 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 \ X_LIBS="-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR" -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
fi fi
@ -56909,23 +56879,6 @@ fi
done 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 fi
if test "x$CUPS_FOUND" = xno; then if test "x$CUPS_FOUND" = xno; then
@ -61166,346 +61119,6 @@ $as_echo "$FREETYPE_LIB_PATH" >&6; }
fi fi
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 if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$SYSROOT/usr" FREETYPE_BASE_DIR="$SYSROOT/usr"
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 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], AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
[ [
# Should we build a JDK/JVM with headful support (ie a graphical ui)? # Should we build a JDK without a graphical UI?
# We always build headless support. AC_MSG_CHECKING([headless only])
AC_MSG_CHECKING([headful support]) AC_ARG_ENABLE([headless-only], [AS_HELP_STRING([--enable-headless-only],
AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful], [only build headless (no GUI) support @<:@disabled@:>@])])
[disable building headful support (graphical UI support) @<:@enabled@:>@])],
[SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes])
SUPPORT_HEADLESS=yes if test "x$enable_headless_only" = "xyes"; then
BUILD_HEADLESS="BUILD_HEADLESS:=true" ENABLE_HEADLESS_ONLY="true"
AC_MSG_RESULT([yes])
if test "x$SUPPORT_HEADFUL" = xyes; then elif test "x$enable_headless_only" = "xno"; then
# We are building both headful and headless. ENABLE_HEADLESS_ONLY="false"
headful_msg="include support for both headful and headless" 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 fi
if test "x$SUPPORT_HEADFUL" = xno; then AC_SUBST(ENABLE_HEADLESS_ONLY)
# 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)
# Choose cacerts source file # Choose cacerts source file
AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-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 DEFAULT_CUPS=yes
]) ])
fi 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 if test "x$CUPS_FOUND" = xno; then
HELP_MSG_MISSING_DEPENDENCY([cups]) HELP_MSG_MISSING_DEPENDENCY([cups])
AC_MSG_ERROR([Could not find cups! $HELP_MSG ]) AC_MSG_ERROR([Could not find cups! $HELP_MSG ])

View File

@ -357,11 +357,6 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
fi fi
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 if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$SYSROOT/usr" FREETYPE_BASE_DIR="$SYSROOT/usr"
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 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 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
OPENWIN_HOME="/usr/openwin" OPENWIN_HOME="/usr/openwin"
X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions" 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 \ X_LIBS="-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR" -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
fi fi

View File

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

View File

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

View File

@ -294,14 +294,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
fi fi
AC_SUBST(TOOLCHAIN_VERSION) 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 # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to
# override all other locations. # override all other locations.
if test "x$TOOLCHAIN_PATH" != x; then 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.configure_args_slowdebug = ["--with-debug-level=slowdebug"],
common.organization = "jpg.infra.builddeps" 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; return common;
}; };
@ -333,8 +350,11 @@ var getJibProfilesProfiles = function (input, common) {
"run-test": { "run-test": {
target_os: input.build_os, target_os: input.build_os,
target_cpu: input.build_cpu, target_cpu: input.build_cpu,
dependencies: [ "jtreg", "gnumake" ], dependencies: [ "jtreg", "gnumake", "boot_jdk" ],
labels: "test" labels: "test",
environment: {
"JT_JAVA": common.boot_jdk_home
}
} }
}; };
profiles = concatObjects(profiles, testOnlyProfiles); profiles = concatObjects(profiles, testOnlyProfiles);
@ -357,18 +377,6 @@ var getJibProfilesDependencies = function (input, common) {
var boot_jdk_platform = input.build_os + "-" var boot_jdk_platform = input.build_os + "-"
+ (input.build_cpu == "x86" ? "i586" : input.build_cpu); + (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 = { var devkit_platform_revisions = {
linux_x64: "gcc4.9.2-OEL6.4+1.0", linux_x64: "gcc4.9.2-OEL6.4+1.0",
macosx_x64: "Xcode6.3-MacOSX10.9+1.0", macosx_x64: "Xcode6.3-MacOSX10.9+1.0",
@ -386,12 +394,12 @@ var getJibProfilesDependencies = function (input, common) {
boot_jdk: { boot_jdk: {
server: "javare", server: "javare",
module: "jdk", module: "jdk",
revision: boot_jdk_revision, revision: common.boot_jdk_revision,
checksum_file: boot_jdk_platform + "/MD5_VALUES", checksum_file: boot_jdk_platform + "/MD5_VALUES",
file: boot_jdk_platform + "/jdk-" + boot_jdk_revision + "-" + boot_jdk_platform + ".tar.gz", file: boot_jdk_platform + "/jdk-" + common.boot_jdk_revision
configure_args: (input.build_os == "macosx" + "-" + boot_jdk_platform + ".tar.gz",
? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart + ".jdk/Contents/Home" configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
: "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk" + boot_jdk_subdirpart) environment_path: common.boot_jdk_home
}, },
devkit: { devkit: {
@ -420,7 +428,8 @@ var getJibProfilesDependencies = function (input, common) {
build_number: "b03", build_number: "b03",
checksum_file: "MD5_VALUES", checksum_file: "MD5_VALUES",
file: "jtreg_bin-4.2.zip", file: "jtreg_bin-4.2.zip",
environment_name: "JT_HOME" environment_name: "JT_HOME",
environment_path: input.get("jtreg", "install_path") + "/jtreg/bin"
}, },
gnumake: { gnumake: {

View File

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

View File

@ -539,3 +539,5 @@ a25e0fb6033245ab075136e744d362ce765464cd jdk-9+133
b8b694c6b4d2ab0939aed7adaf0eec1ac321a085 jdk-9+134 b8b694c6b4d2ab0939aed7adaf0eec1ac321a085 jdk-9+134
3b1c4562953db47e36b237a500f368d5c9746d47 jdk-9+135 3b1c4562953db47e36b237a500f368d5c9746d47 jdk-9+135
a20da289f646ee44440695b81abc0548330e4ca7 jdk-9+136 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 1c6c21d87aa459d82425e1fddc9ce8647aebde34 jdk-9+134
f695240370c77a25fed88225a392e7d530cb4d78 jdk-9+135 f695240370c77a25fed88225a392e7d530cb4d78 jdk-9+135
f1eafcb0eb7182b937bc93f214d8cabd01ec4d59 jdk-9+136 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); staxInputSource = new StaxXMLInputSource(xmlInputSource, fISCreatedByResolver);
} }
if (staxInputSource == null) { if (staxInputSource == null && fUseCatalog) {
if (fCatalogFeatures == null) { if (fCatalogFeatures == null) {
fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve); fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
} }
fCatalogFile = fCatalogFeatures.get(Feature.FILES); fCatalogFile = fCatalogFeatures.get(Feature.FILES);
if (fUseCatalog && fCatalogFile != null) { if (fCatalogFile != null) {
try { try {
if (fCatalogResolver == null) { if (fCatalogResolver == null) {
fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures); fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
@ -1133,12 +1133,12 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
xmlInputSource = fEntityResolver.resolveEntity(resourceIdentifier); xmlInputSource = fEntityResolver.resolveEntity(resourceIdentifier);
} }
if (xmlInputSource == null) { if (xmlInputSource == null && fUseCatalog) {
if (fCatalogFeatures == null) { if (fCatalogFeatures == null) {
fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve); fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
} }
fCatalogFile = fCatalogFeatures.get(Feature.FILES); fCatalogFile = fCatalogFeatures.get(Feature.FILES);
if (fUseCatalog && fCatalogFile != null) { if (fCatalogFile != null) {
/* /*
since the method can be called from various processors, both since the method can be called from various processors, both
EntityResolver and URIResolver are used to attempt to find 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.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException; 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.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.AugmentationsImpl;
import com.sun.org.apache.xerces.internal.util.HTTPInputSource; import com.sun.org.apache.xerces.internal.util.HTTPInputSource;
import com.sun.org.apache.xerces.internal.util.IntStack; import com.sun.org.apache.xerces.internal.util.IntStack;
@ -129,8 +131,6 @@ import org.xml.sax.InputSource;
public class XIncludeHandler public class XIncludeHandler
implements XMLComponent, XMLDocumentFilter, XMLDTDFilter { 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 = "Accept";
public final static String HTTP_ACCEPT_LANGUAGE = "Accept-Language"; public final static String HTTP_ACCEPT_LANGUAGE = "Accept-Language";
public final static String XPOINTER = "xpointer"; public final static String XPOINTER = "xpointer";
@ -1624,12 +1624,12 @@ public class XIncludeHandler
includedSource = includedSource =
fEntityResolver.resolveEntity(resourceIdentifier); fEntityResolver.resolveEntity(resourceIdentifier);
if (includedSource == null) { if (includedSource == null && fUseCatalog) {
if (fCatalogFeatures == null) { if (fCatalogFeatures == null) {
fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve); fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
} }
fCatalogFile = fCatalogFeatures.get(CatalogFeatures.Feature.FILES); fCatalogFile = fCatalogFeatures.get(CatalogFeatures.Feature.FILES);
if (fUseCatalog && fCatalogFile != null) { if (fCatalogFile != null) {
/* /*
Although URI entry is preferred for resolving XInclude, system entry Although URI entry is preferred for resolving XInclude, system entry
is allowed as well. is allowed as well.
@ -1690,14 +1690,11 @@ public class XIncludeHandler
if ((xpointer != null && fXPointerChildConfig == null) if ((xpointer != null && fXPointerChildConfig == null)
|| (xpointer == null && fXIncludeChildConfig == null) ) { || (xpointer == null && fXIncludeChildConfig == null) ) {
String parserName = XINCLUDE_DEFAULT_CONFIGURATION; if (xpointer == null) {
if (xpointer != null) fChildConfig = new XIncludeParserConfiguration();
parserName = "com.sun.org.apache.xerces.internal.parsers.XPointerParserConfiguration"; } else {
fChildConfig = new XPointerParserConfiguration();
fChildConfig = }
(XMLParserConfiguration)ObjectFactory.newInstance(
parserName,
true);
// use the same symbol table, error reporter, entity resolver, security manager and buffer size. // use the same symbol table, error reporter, entity resolver, security manager and buffer size.
if (fSymbolTable != null) fChildConfig.setProperty(SYMBOL_TABLE, fSymbolTable); 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.sax.SAXSource;
import javax.xml.transform.stax.StAXSource; import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Listeners; import org.testng.annotations.Listeners;
@ -42,7 +41,7 @@ import org.xml.sax.InputSource;
/** /**
* @test * @test
* @bug 8158084 8162438 8162442 8166220 * @bug 8158084 8162438 8162442 8166220 8166398
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
* @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport
* @run testng/othervm 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 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 * A Catalog is used when there's no custom resolver, and the USE_CATALOG
* is true (which is the case by default). * is true (which is the case by default).
*/ */
/** /**
* Support Catalog: * Support Catalog:
@ -177,13 +176,13 @@ public class CatalogSupport extends CatalogSupportBase {
*/ */
@DataProvider(name = "data_SAXA") @DataProvider(name = "data_SAXA")
public Object[][] getDataSAX() { public Object[][] getDataSAX() {
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[][]{ return new Object[][]{
{false, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}, {false, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog},
{false, true, xml_catalog, xml_system, entityHandler, expectedWResolver}, {false, true, xml_catalog, xml_system, getMyEntityHandler(elementInSystem, systemIds,
{true, true, xml_catalog, xml_system, entityHandler, expectedWResolver} 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") @DataProvider(name = "data_DOMA")
public Object[][] getDataDOM() { public Object[][] getDataDOM() {
String[] systemIds = {"system.xsd"}; String[] systemIds = {"system.dtd"};
InputSource[] returnValues = {new InputSource(new StringReader(dtd_systemResolved))}; InputSource[] returnValues = {new InputSource(new StringReader(dtd_systemResolved))};
MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInSystem); MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInSystem);
return new Object[][]{ return new Object[][]{
@ -230,8 +229,8 @@ public class CatalogSupport extends CatalogSupportBase {
return new Object[][]{ return new Object[][]{
{false, true, xml_catalog, xml_system, null, expectedWCatalog}, {false, true, xml_catalog, xml_system, null, expectedWCatalog},
{false, true, xml_catalog, xml_system, null, expectedWResolver}, {false, true, xml_catalog, xml_system, new MyStaxEntityResolver(), expectedWResolver},
{true, true, xml_catalog, xml_system, null, 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_utf8.xml" uri="XI_utf8.xml"/>
<system systemId="XI_utf8Catalog.xml" uri="XI_utf8Catalog.xml"/> <system systemId="XI_utf8Catalog.xml" uri="XI_utf8Catalog.xml"/>
<system systemId="XI_test2.xml" uri="XI_test2.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"/> <system systemId="XI_red.dtd" uri="XI_red.dtd"/>
<!-- xsd import can be mapped using the namespace or systemId --> <!-- 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); SAXParser parser = getSAXParser(setUseCatalog, useCatalog, catalog);
parser.parse(xml, handler); 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); XMLReader reader = getXMLReader(setUseCatalog, useCatalog, catalog);
reader.setContentHandler(handler); reader.setContentHandler(handler);
reader.setEntityResolver(handler);
reader.parse(xml); 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); parser.parse(new InputSource(new StringReader(xml)), handler);
debugPrint("handler.result:" + handler.getResult()); 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); Node node = doc.getElementsByTagName(elementInSystem).item(0);
String result = node.getFirstChild().getTextContent(); String result = node.getFirstChild().getTextContent();
Assert.assertEquals(result.trim(), expected);
assertEquals(expected, result.trim(), "Catalog support for DOM");
} }
/* /*
@ -327,7 +327,7 @@ public class CatalogSupportBase {
XMLStreamReader streamReader = getStreamReader( XMLStreamReader streamReader = getStreamReader(
setUseCatalog, useCatalog, catalog, xml, resolver); setUseCatalog, useCatalog, catalog, xml, resolver);
String text = getText(streamReader, XMLStreamConstants.CHARACTERS); 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( XMLStreamReader streamReader = getStreamReader(
setUseCatalog, useCatalog, catalog, xml, resolver); setUseCatalog, useCatalog, catalog, xml, resolver);
String text = getText(streamReader, XMLStreamConstants.ENTITY_REFERENCE); 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 * @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 * @throws XMLStreamException
*/ */
String getText(XMLStreamReader streamReader, int type) throws XMLStreamException { String getText(XMLStreamReader streamReader, int type) throws XMLStreamException {
@ -662,24 +664,6 @@ public class CatalogSupportBase {
return factory; 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) { void fail(String msg) {
System.out.println("Test failed:"); System.out.println("Test failed:");
System.out.println(msg); System.out.println(msg);

View File

@ -9,7 +9,7 @@
</another> </another>
</latin1> </latin1>
<test2> <test2>
<xinclude:include href="XI_test2.xml"/> <xinclude:include href="XI_test2Catalog.xml"/>
</test2> </test2>
<test3> <test3>
<!-- <xinclude:include href="XI_roottest.xml"/> --> <!-- <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 ab1d78d395d4cb8be426ff181211da1a4085cf01 jdk-9+134
22631824f55128a7ab6605493b3001a37af6a168 jdk-9+135 22631824f55128a7ab6605493b3001a37af6a168 jdk-9+135
09ec13a99f50a4a346180d1e3b0fd8bc1ee399ce jdk-9+136 09ec13a99f50a4a346180d1e3b0fd8bc1ee399ce jdk-9+136
297c16d401c534cb879809d2a746d21ca99d2954 jdk-9+137

View File

@ -379,3 +379,4 @@ d5c70818cd8a82e76632c8c815bdb4f75f53aeaf jdk-9+132
803adcd526d74ae0b64948d1f8260c2dbe514779 jdk-9+134 803adcd526d74ae0b64948d1f8260c2dbe514779 jdk-9+134
021369229cfd0b5feb76834b2ea498f47f43c0f3 jdk-9+135 021369229cfd0b5feb76834b2ea498f47f43c0f3 jdk-9+135
54c5931849a33a363e03fdffa141503f5cc4779d jdk-9+136 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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ include LauncherCommon.gmk
# Hook to include the corresponding custom file, if present. # Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, jdk, launcher/Launcher-java.desktop.gmk)) $(eval $(call IncludeCustomExtension, jdk, launcher/Launcher-java.desktop.gmk))
ifndef BUILD_HEADLESS_ONLY ifeq ($(ENABLE_HEADLESS_ONLY), false)
$(eval $(call SetupBuildLauncher, appletviewer, \ $(eval $(call SetupBuildLauncher, appletviewer, \
MAIN_CLASS := sun.applet.Main, \ MAIN_CLASS := sun.applet.Main, \
JAVA_ARGS := --add-modules ALL-DEFAULT, \ 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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
include LauncherCommon.gmk include LauncherCommon.gmk
ifndef BUILD_HEADLESS_ONLY ifeq ($(ENABLE_HEADLESS_ONLY), false)
$(eval $(call SetupBuildLauncher, policytool, \ $(eval $(call SetupBuildLauncher, policytool, \
MAIN_CLASS := sun.security.tools.policytool.PolicyTool, \ MAIN_CLASS := sun.security.tools.policytool.PolicyTool, \
LIBS_unix := $(X_LIBS), \ LIBS_unix := $(X_LIBS), \

View File

@ -280,7 +280,7 @@ TARGETS += $(BUILD_LIBAWT)
################################################################################ ################################################################################
ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),) ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
ifndef BUILD_HEADLESS_ONLY ifeq ($(ENABLE_HEADLESS_ONLY), false)
LIBAWT_XAWT_DIRS := \ LIBAWT_XAWT_DIRS := \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \ $(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
# Mac and Windows only use the native AWT lib, do not build libawt_headless ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \ 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/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/opengl \
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \ $(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/java2d/opengl \
$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
# #
LIBAWT_HEADLESS_EXCLUDES := medialib LIBAWT_HEADLESS_EXCLUDES := medialib
LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \ LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
$(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \ $(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 \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \ -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/awt/image/cvutils \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ -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/share/native/libawt/awt/image \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \ -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/font \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ -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/common/font \
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
$(LIBJAVA_HEADER_FLAGS) \ $(LIBJAVA_HEADER_FLAGS) \
# #
LIBAWT_HEADLESS_REORDER := LIBAWT_HEADLESS_REORDER :=
ifeq ($(OPENJDK_TARGET_OS), solaris) ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64) ifneq ($(OPENJDK_TARGET_CPU), x86_64)
LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU) LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
endif
endif 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 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 endif
################################################################################ ################################################################################
@ -780,7 +778,7 @@ else # OPENJDK_TARGET_OS not windows
ifneq ($(OPENJDK_TARGET_OS), solaris) ifneq ($(OPENJDK_TARGET_OS), solaris)
JAWT_LIBS += -lawt JAWT_LIBS += -lawt
endif endif
ifndef BUILD_HEADLESS_ONLY ifeq ($(ENABLE_HEADLESS_ONLY), false)
JAWT_LIBS += -lawt_xawt JAWT_LIBS += -lawt_xawt
else else
JAWT_LIBS += -lawt_headless JAWT_LIBS += -lawt_headless
@ -809,7 +807,7 @@ else # OPENJDK_TARGET_OS not windows
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
)) ))
ifndef BUILD_HEADLESS_ONLY ifeq ($(ENABLE_HEADLESS_ONLY), false)
$(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT) $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
else else
$(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX) $(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 := \ LIBSPLASHSCREEN_DIRS := \
$(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg \ $(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 // These flags must match the values maintained in the VM
@Native private static final int DEFAULT_MODE = 0x0; @Native private static final int DEFAULT_MODE = 0x0;
@Native private static final int FILL_CLASS_REFS_ONLY = 0x2; @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 SHOW_HIDDEN_FRAMES = 0x20; // LambdaForms are hidden by the VM
@Native private static final int FILL_LIVE_STACK_FRAMES = 0x100; @Native private static final int FILL_LIVE_STACK_FRAMES = 0x100;
/* /*
@ -614,9 +615,7 @@ final class StackStreamFactory {
private Class<?> caller; private Class<?> caller;
CallerClassFinder(StackWalker walker) { CallerClassFinder(StackWalker walker) {
super(walker, FILL_CLASS_REFS_ONLY); super(walker, FILL_CLASS_REFS_ONLY|GET_CALLER_CLASS);
assert (mode & FILL_CLASS_REFS_ONLY) == FILL_CLASS_REFS_ONLY
: "mode should contain FILL_CLASS_REFS_ONLY";
} }
final class ClassBuffer extends FrameBuffer<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_LLL() { return checkCache(3, "LLL"); }
static SpeciesData speciesData_LLLL() { return checkCache(4, "LLLL"); } static SpeciesData speciesData_LLLL() { return checkCache(4, "LLLL"); }
static SpeciesData speciesData_LLLLL() { return checkCache(5, "LLLLL"); } 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.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.stream.Stream; 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.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.MethodHandleNatives.Constants.*;
import static java.lang.invoke.MethodHandleStatics.*; import static java.lang.invoke.MethodHandleStatics.*;
@ -65,6 +65,9 @@ class InvokerBytecodeGenerator {
private static final String OBJ = "java/lang/Object"; private static final String OBJ = "java/lang/Object";
private static final String OBJARY = "[Ljava/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 LF_SIG = "L" + LF + ";";
private static final String LFN_SIG = "L" + LFN + ";"; private static final String LFN_SIG = "L" + LFN + ";";
private static final String LL_SIG = "(L" + OBJ + ";)L" + OBJ + ";"; private static final String LL_SIG = "(L" + OBJ + ";)L" + OBJ + ";";
@ -1319,38 +1322,43 @@ class InvokerBytecodeGenerator {
* The pattern looks like (Cf. MethodHandleImpl.loop): * The pattern looks like (Cf. MethodHandleImpl.loop):
* <blockquote><pre>{@code * <blockquote><pre>{@code
* // a0: BMH * // a0: BMH
* // a1: inits, a2: steps, a3: preds, a4: finis * // a1: LoopClauses (containing an array of arrays: inits, steps, preds, finis)
* // a5: box, a6: unbox * // a2: box, a3: unbox
* // a7 (and following): arguments * // a4 (and following): arguments
* loop=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L,a5:L,a6:L,a7:L)=>{ * loop=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L)=>{
* t8:L=MethodHandle.invokeBasic(a5:L,a7:L); // box the arguments into an Object[] * t5:L=MethodHandle.invokeBasic(a2:L,a4: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) * t6:L=MethodHandleImpl.loop(bt:L,a1:L,t5: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 * t7:L=MethodHandle.invokeBasic(a3:L,t6:L);t7:L} // unbox the result; return the result
* }</pre></blockquote> * }</pre></blockquote>
* <p> * <p>
* It is compiled into bytecode equivalent to the code seen in {@link MethodHandleImpl#loop(BasicType[], * 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. * will be used for local state storage. Instead, the local state will be mapped to actual stack slots.
* <p> * <p>
* Bytecode generation applies an unrolling scheme to enable better bytecode generation regarding local state type * 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). * 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. * Assume there are {@code C} clauses in the loop.
* <blockquote><pre>{@code * <blockquote><pre>{@code
* INIT: (INIT_SEQ for clause 1) * PREINIT: ALOAD_1
* ... * CHECKCAST LoopClauses
* (INIT_SEQ for clause C) * GETFIELD LoopClauses.clauses
* LOOP: (LOOP_SEQ for clause 1) * ASTORE clauseDataIndex // place the clauses 2-dimensional array on the stack
* ... * INIT: (INIT_SEQ for clause 1)
* (LOOP_SEQ for clause C) * ...
* GOTO LOOP * (INIT_SEQ for clause C)
* DONE: ... * LOOP: (LOOP_SEQ for clause 1)
* ...
* (LOOP_SEQ for clause C)
* GOTO LOOP
* DONE: ...
* }</pre></blockquote> * }</pre></blockquote>
* <p> * <p>
* The {@code INIT_SEQ_x} sequence for clause {@code x} (with {@code x} ranging from {@code 0} to {@code C-1}) has * 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}. * the following shape. Assume slot {@code vx} is used to hold the state for clause {@code x}.
* <blockquote><pre>{@code * <blockquote><pre>{@code
* INIT_SEQ_x: ALOAD inits * INIT_SEQ_x: ALOAD clauseDataIndex
* CHECKCAST MethodHandle[] * ICONST_0
* AALOAD // load the inits array
* ICONST x * ICONST x
* AALOAD // load the init handle for clause x * AALOAD // load the init handle for clause x
* load args * 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 {@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}. * the following shape. Again, assume slot {@code vx} is used to hold the state for clause {@code x}.
* <blockquote><pre>{@code * <blockquote><pre>{@code
* LOOP_SEQ_x: ALOAD steps * LOOP_SEQ_x: ALOAD clauseDataIndex
* CHECKCAST MethodHandle[] * ICONST_1
* AALOAD // load the steps array
* ICONST x * ICONST x
* AALOAD // load the step handle for clause x * AALOAD // load the step handle for clause x
* load locals * load locals
* load args * load args
* INVOKEVIRTUAL MethodHandle.invokeBasic * INVOKEVIRTUAL MethodHandle.invokeBasic
* store vx * store vx
* ALOAD preds * ALOAD clauseDataIndex
* CHECKCAST MethodHandle[] * ICONST_2
* AALOAD // load the preds array
* ICONST x * ICONST x
* AALOAD // load the pred handle for clause x * AALOAD // load the pred handle for clause x
* load locals * load locals
* load args * load args
* INVOKEVIRTUAL MethodHandle.invokeBasic * INVOKEVIRTUAL MethodHandle.invokeBasic
* IFNE LOOP_SEQ_x+1 // predicate returned false -> jump to next clause * IFNE LOOP_SEQ_x+1 // predicate returned false -> jump to next clause
* ALOAD finis * ALOAD clauseDataIndex
* CHECKCAST MethodHandle[] * ICONST_3
* AALOAD // load the finis array
* ICONST x * ICONST x
* AALOAD // load the fini handle for clause x * AALOAD // load the fini handle for clause x
* load locals * load locals
@ -1397,8 +1408,12 @@ class InvokerBytecodeGenerator {
BasicType[] loopClauseTypes = (BasicType[]) invoker.arguments[0]; BasicType[] loopClauseTypes = (BasicType[]) invoker.arguments[0];
Class<?>[] loopLocalStateTypes = Stream.of(loopClauseTypes). Class<?>[] loopLocalStateTypes = Stream.of(loopClauseTypes).
filter(bt -> bt != BasicType.V_TYPE).map(BasicType::basicTypeClass).toArray(Class<?>[]::new); 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(); Class<?> returnType = result.function.resolvedHandle().type().returnType();
MethodType loopType = args.function.resolvedHandle().type() MethodType loopType = args.function.resolvedHandle().type()
@ -1420,10 +1435,16 @@ class InvokerBytecodeGenerator {
Label lDone = new Label(); Label lDone = new Label();
Label lNext; Label lNext;
// PREINIT:
emitPushArgument(MethodHandleImpl.LoopClauses.class, invoker.arguments[1]);
mv.visitFieldInsn(Opcodes.GETFIELD, LOOP_CLAUSES, "clauses", MHARY2);
emitAstoreInsn(clauseDataIndex);
// INIT: // INIT:
for (int c = 0, state = 0; c < nClauses; ++c) { for (int c = 0, state = 0; c < nClauses; ++c) {
MethodType cInitType = loopType.changeReturnType(loopClauseTypes[c].basicTypeClass()); 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) { if (cInitType.returnType() != void.class) {
emitStoreInsn(BasicType.basicType(cInitType.returnType()), firstLoopStateIndex + state); emitStoreInsn(BasicType.basicType(cInitType.returnType()), firstLoopStateIndex + state);
++state; ++state;
@ -1440,18 +1461,21 @@ class InvokerBytecodeGenerator {
boolean isVoid = stepType.returnType() == void.class; boolean isVoid = stepType.returnType() == void.class;
// invoke loop step // invoke loop step
emitLoopHandleInvoke(invoker, steps, c, args, true, stepType, loopLocalStateTypes, firstLoopStateIndex); emitLoopHandleInvoke(invoker, steps, c, args, true, stepType, loopLocalStateTypes, clauseDataIndex,
firstLoopStateIndex);
if (!isVoid) { if (!isVoid) {
emitStoreInsn(BasicType.basicType(stepType.returnType()), firstLoopStateIndex + state); emitStoreInsn(BasicType.basicType(stepType.returnType()), firstLoopStateIndex + state);
++state; ++state;
} }
// invoke loop predicate // 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); mv.visitJumpInsn(Opcodes.IFNE, lNext);
// invoke fini // 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); mv.visitJumpInsn(Opcodes.GOTO, lDone);
// this is the beginning of the next loop clause // 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, 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 // load handle for clause
emitPushArgument(holder, handles); emitPushClauseArray(clauseDataSlot, handles);
emitIconstInsn(clause); emitIconstInsn(clause);
mv.visitInsn(Opcodes.AALOAD); mv.visitInsn(Opcodes.AALOAD);
// load loop state (preceding the other arguments) // load loop state (preceding the other arguments)
@ -1499,6 +1524,12 @@ class InvokerBytecodeGenerator {
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", type.toMethodDescriptorString(), false); 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) { private void emitZero(BasicType type) {
switch (type) { switch (type) {
case I_TYPE: mv.visitInsn(Opcodes.ICONST_0); break; 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.LambdaForm.BasicType.*;
import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic; import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
import static java.lang.invoke.MethodHandleStatics.*; import static java.lang.invoke.MethodHandleStatics.*;
import java.util.Objects;
/** /**
* The symbolic, non-executable form of a method handle's invocation semantics. * The symbolic, non-executable form of a method handle's invocation semantics.
@ -732,9 +731,9 @@ class LambdaForm {
boolean isLoop(int pos) { boolean isLoop(int pos) {
// loop idiom: // loop idiom:
// t_{n}:L=MethodHandle.invokeBasic(...) // 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}) // 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 NF_tryFinally = new NamedFunction(MethodHandleImpl.class
.getDeclaredMethod("tryFinally", MethodHandle.class, MethodHandle.class, Object[].class)); .getDeclaredMethod("tryFinally", MethodHandle.class, MethodHandle.class, Object[].class));
NF_loop = new NamedFunction(MethodHandleImpl.class NF_loop = new NamedFunction(MethodHandleImpl.class
.getDeclaredMethod("loop", BasicType[].class, MethodHandle[].class, MethodHandle[].class, .getDeclaredMethod("loop", BasicType[].class, LoopClauses.class, Object[].class));
MethodHandle[].class, MethodHandle[].class, Object[].class));
NF_throwException = new NamedFunction(MethodHandleImpl.class NF_throwException = new NamedFunction(MethodHandleImpl.class
.getDeclaredMethod("throwException", Throwable.class)); .getDeclaredMethod("throwException", Throwable.class));
NF_profileBoolean = new NamedFunction(MethodHandleImpl.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 collectArgs = varargsArray(type.parameterCount()).asType(varargsType);
MethodHandle unboxResult = unboxResultHandle(tloop); 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; BoundMethodHandle mh;
try { try {
mh = (BoundMethodHandle) data.constructor().invokeBasic(type, form, (Object) toArray(init), mh = (BoundMethodHandle) data.constructor().invokeBasic(type, form, (Object) clauseData,
(Object) toArray(step), (Object) toArray(pred), (Object) toArray(fini), (Object) collectArgs, (Object) collectArgs, (Object) unboxResult);
(Object) unboxResult);
} catch (Throwable ex) { } catch (Throwable ex) {
throw uncaughtException(ex); throw uncaughtException(ex);
} }
@ -1818,23 +1818,20 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
* {@code t12}): * {@code t12}):
* <blockquote><pre>{@code * <blockquote><pre>{@code
* loop=Lambda(a0:L,a1:L)=>{ * loop=Lambda(a0:L,a1:L)=>{
* t2:L=BoundMethodHandle$Species_L6.argL0(a0:L); // array of init method handles * t2:L=BoundMethodHandle$Species_L3.argL0(a0:L); // LoopClauses holding init, step, pred, fini handles
* t3:L=BoundMethodHandle$Species_L6.argL1(a0:L); // array of step method handles * t3:L=BoundMethodHandle$Species_L3.argL1(a0:L); // helper handle to box the arguments into an Object[]
* t4:L=BoundMethodHandle$Species_L6.argL2(a0:L); // array of pred method handles * t4:L=BoundMethodHandle$Species_L3.argL2(a0:L); // helper handle to unbox the result
* t5:L=BoundMethodHandle$Species_L6.argL3(a0:L); // array of fini method handles * t5:L=MethodHandle.invokeBasic(t3:L,a1:L); // box the arguments into an Object[]
* t6:L=BoundMethodHandle$Species_L6.argL4(a0:L); // helper handle to box the arguments into an Object[] * t6:L=MethodHandleImpl.loop(null,t2:L,t3:L); // call the loop executor
* t7:L=BoundMethodHandle$Species_L6.argL5(a0:L); // helper handle to unbox the result * t7:L=MethodHandle.invokeBasic(t4:L,t6:L);t7:L} // unbox the result; return 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
* }</pre></blockquote> * }</pre></blockquote>
* <p> * <p>
* {@code argL0} through {@code argL3} are the arrays of init, step, pred, and fini method handles. * {@code argL0} is a LoopClauses instance holding, in a 2-dimensional array, the init, step, pred, and fini method
* {@code argL4} and {@code argL5} are auxiliary method handles: {@code argL2} boxes arguments and wraps them into * handles. {@code argL1} and {@code argL2} are auxiliary method handles: {@code argL1} boxes arguments and wraps
* {@code Object[]} ({@code ValueConversions.array()}), and {@code argL3} unboxes the result if necessary * them into {@code Object[]} ({@code ValueConversions.array()}), and {@code argL2} unboxes the result if necessary
* ({@code ValueConversions.unbox()}). * ({@code ValueConversions.unbox()}).
* <p> * <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. * forms among loop combinators with the same basic type.
* <p> * <p>
* The above template is instantiated by using the {@link LambdaFormEditor} to replace the {@code null} argument to * 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) { private static LambdaForm makeLoopForm(MethodType basicType, BasicType[] localVarTypes) {
MethodType lambdaType = basicType.invokerType(); 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_BASE = 1; // start of incoming arguments
final int ARG_LIMIT = ARG_BASE + basicType.parameterCount(); final int ARG_LIMIT = ARG_BASE + basicType.parameterCount();
int nameCursor = ARG_LIMIT; int nameCursor = ARG_LIMIT;
final int GET_INITS = nameCursor++; final int GET_CLAUSE_DATA = nameCursor++;
final int GET_STEPS = nameCursor++;
final int GET_PREDS = nameCursor++;
final int GET_FINIS = nameCursor++;
final int GET_COLLECT_ARGS = nameCursor++; final int GET_COLLECT_ARGS = nameCursor++;
final int GET_UNBOX_RESULT = nameCursor++; final int GET_UNBOX_RESULT = nameCursor++;
final int BOXED_ARGS = nameCursor++; final int BOXED_ARGS = nameCursor++;
@ -1864,14 +1858,11 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
if (lform == null) { if (lform == null) {
Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType); 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[THIS_MH] = names[THIS_MH].withConstraint(data);
names[GET_INITS] = new Name(data.getterFunction(0), names[THIS_MH]); names[GET_CLAUSE_DATA] = new Name(data.getterFunction(0), names[THIS_MH]);
names[GET_STEPS] = new Name(data.getterFunction(1), names[THIS_MH]); names[GET_COLLECT_ARGS] = new Name(data.getterFunction(1), names[THIS_MH]);
names[GET_PREDS] = new Name(data.getterFunction(2), names[THIS_MH]); names[GET_UNBOX_RESULT] = 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]);
// t_{i}:L=MethodHandle.invokeBasic(collectArgs:L,a1:L,...); // t_{i}:L=MethodHandle.invokeBasic(collectArgs:L,a1:L,...);
MethodType collectArgsType = basicType.changeReturnType(Object.class); 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); System.arraycopy(names, ARG_BASE, args, 1, ARG_LIMIT - ARG_BASE);
names[BOXED_ARGS] = new Name(makeIntrinsic(invokeBasic, Intrinsic.LOOP), args); 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 = Object[] lArgs =
new Object[]{null, // placeholder for BasicType[] localTypes - will be added by LambdaFormEditor 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); names[LOOP] = new Name(NF_loop, lArgs);
// t_{i+2}:I=MethodHandle.invokeBasic(unbox:L,t_{i+1}:L); // 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); 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 * Intrinsified during LambdaForm compilation
* (see {@link InvokerBytecodeGenerator#emitLoop(int)}). * (see {@link InvokerBytecodeGenerator#emitLoop(int)}).
*/ */
@LambdaForm.Hidden @LambdaForm.Hidden
static Object loop(BasicType[] localTypes, MethodHandle[] init, MethodHandle[] step, MethodHandle[] pred, static Object loop(BasicType[] localTypes, LoopClauses clauseData, Object... av) throws Throwable {
MethodHandle[] fini, 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 varSize = (int) Stream.of(init).filter(h -> h.type().returnType() != void.class).count();
int nArgs = init[0].type().parameterCount(); int nArgs = init[0].type().parameterCount();
Object[] varsAndArgs = new Object[varSize + nArgs]; Object[] varsAndArgs = new Object[varSize + nArgs];
for (int i = 0, v = 0; i < init.length; ++i) { for (int i = 0, v = 0; i < init.length; ++i) {
if (init[i].type().returnType() == void.class) { MethodHandle ih = init[i];
init[i].asFixedArity().invokeWithArguments(av); if (ih.type().returnType() == void.class) {
ih.invokeWithArguments(av);
} else { } else {
varsAndArgs[v++] = init[i].asFixedArity().invokeWithArguments(av); varsAndArgs[v++] = ih.invokeWithArguments(av);
} }
} }
System.arraycopy(av, 0, varsAndArgs, varSize, nArgs); System.arraycopy(av, 0, varsAndArgs, varSize, nArgs);
@ -1926,12 +1947,12 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
MethodHandle s = step[i]; MethodHandle s = step[i];
MethodHandle f = fini[i]; MethodHandle f = fini[i];
if (s.type().returnType() == void.class) { if (s.type().returnType() == void.class) {
s.asFixedArity().invokeWithArguments(varsAndArgs); s.invokeWithArguments(varsAndArgs);
} else { } else {
varsAndArgs[v++] = s.asFixedArity().invokeWithArguments(varsAndArgs); varsAndArgs[v++] = s.invokeWithArguments(varsAndArgs);
} }
if (!(boolean) p.asFixedArity().invokeWithArguments(varsAndArgs)) { if (!(boolean) p.invokeWithArguments(varsAndArgs)) {
return f.asFixedArity().invokeWithArguments(varsAndArgs); return f.invokeWithArguments(varsAndArgs);
} }
} }
} }
@ -2122,14 +2143,13 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
Throwable t = null; Throwable t = null;
Object r = null; Object r = null;
try { try {
// Use asFixedArity() to avoid unnecessary boxing of last argument for VarargsCollector case. r = target.invokeWithArguments(av);
r = target.asFixedArity().invokeWithArguments(av);
} catch (Throwable thrown) { } catch (Throwable thrown) {
t = thrown; t = thrown;
throw t; throw t;
} finally { } finally {
Object[] args = target.type().returnType() == void.class ? prepend(av, t) : prepend(av, t, r); 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; return r;
} }

View File

@ -4368,10 +4368,11 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
} }
// Step 4: fill in missing parameter types. // Step 4: fill in missing parameter types.
List<MethodHandle> finit = fillParameterTypes(init, commonSuffix); // Also convert all handles to fixed-arity handles.
List<MethodHandle> fstep = fillParameterTypes(step, commonParameterSequence); List<MethodHandle> finit = fixArities(fillParameterTypes(init, commonSuffix));
List<MethodHandle> fpred = fillParameterTypes(pred, commonParameterSequence); List<MethodHandle> fstep = fixArities(fillParameterTypes(step, commonParameterSequence));
List<MethodHandle> ffini = fillParameterTypes(fini, commonParameterSequence); List<MethodHandle> fpred = fixArities(fillParameterTypes(pred, commonParameterSequence));
List<MethodHandle> ffini = fixArities(fillParameterTypes(fini, commonParameterSequence));
assert finit.stream().map(MethodHandle::type).map(MethodType::parameterList). assert finit.stream().map(MethodHandle::type).map(MethodType::parameterList).
allMatch(pl -> pl.equals(commonSuffix)); allMatch(pl -> pl.equals(commonSuffix));
@ -4389,6 +4390,10 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
}).collect(Collectors.toList()); }).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 * 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}. * the {@linkplain #loop(MethodHandle[][]) generic loop combinator}.
@ -4887,7 +4892,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
// target parameter list. // target parameter list.
cleanup = dropArgumentsToMatch(cleanup, (rtype == void.class ? 1 : 2), targetParamTypes, 0); 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 { try {
bb.get(b, off, len); bb.get(b, off, len);
} catch (BufferUnderflowException e) { } catch (BufferUnderflowException e) {
throw new EOFException(); throw new EOFException(e.getMessage());
} }
} }
@ -681,7 +681,7 @@ final class ModuleInfo {
int ch = bb.get(); int ch = bb.get();
return (ch != 0); return (ch != 0);
} catch (BufferUnderflowException e) { } catch (BufferUnderflowException e) {
throw new EOFException(); throw new EOFException(e.getMessage());
} }
} }
@ -690,7 +690,7 @@ final class ModuleInfo {
try { try {
return bb.get(); return bb.get();
} catch (BufferUnderflowException e) { } catch (BufferUnderflowException e) {
throw new EOFException(); throw new EOFException(e.getMessage());
} }
} }
@ -699,7 +699,7 @@ final class ModuleInfo {
try { try {
return ((int) bb.get()) & 0xff; return ((int) bb.get()) & 0xff;
} catch (BufferUnderflowException e) { } catch (BufferUnderflowException e) {
throw new EOFException(); throw new EOFException(e.getMessage());
} }
} }
@ -708,7 +708,7 @@ final class ModuleInfo {
try { try {
return bb.getShort(); return bb.getShort();
} catch (BufferUnderflowException e) { } catch (BufferUnderflowException e) {
throw new EOFException(); throw new EOFException(e.getMessage());
} }
} }
@ -717,7 +717,7 @@ final class ModuleInfo {
try { try {
return ((int) bb.getShort()) & 0xffff; return ((int) bb.getShort()) & 0xffff;
} catch (BufferUnderflowException e) { } catch (BufferUnderflowException e) {
throw new EOFException(); throw new EOFException(e.getMessage());
} }
} }
@ -726,7 +726,7 @@ final class ModuleInfo {
try { try {
return bb.getChar(); return bb.getChar();
} catch (BufferUnderflowException e) { } catch (BufferUnderflowException e) {
throw new EOFException(); throw new EOFException(e.getMessage());
} }
} }
@ -735,7 +735,7 @@ final class ModuleInfo {
try { try {
return bb.getInt(); return bb.getInt();
} catch (BufferUnderflowException e) { } catch (BufferUnderflowException e) {
throw new EOFException(); throw new EOFException(e.getMessage());
} }
} }
@ -744,7 +744,7 @@ final class ModuleInfo {
try { try {
return bb.getLong(); return bb.getLong();
} catch (BufferUnderflowException e) { } catch (BufferUnderflowException e) {
throw new EOFException(); throw new EOFException(e.getMessage());
} }
} }
@ -753,7 +753,7 @@ final class ModuleInfo {
try { try {
return bb.getFloat(); return bb.getFloat();
} catch (BufferUnderflowException e) { } catch (BufferUnderflowException e) {
throw new EOFException(); throw new EOFException(e.getMessage());
} }
} }
@ -762,7 +762,7 @@ final class ModuleInfo {
try { try {
return bb.getDouble(); return bb.getDouble();
} catch (BufferUnderflowException e) { } 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; private final Module module;
ProxyBuilder(ClassLoader loader, List<Class<?>> interfaces) { ProxyBuilder(ClassLoader loader, List<Class<?>> interfaces) {
if (!VM.isModuleSystemInited()) { 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) { if (interfaces.size() > 65535) {
throw new IllegalArgumentException("interface limit exceeded"); throw new IllegalArgumentException("interface limit exceeded: " + interfaces.size());
} }
Set<Class<?>> refTypes = referencedTypes(loader, interfaces); 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 * exceptionally with a CompletionException with this exception as
* cause. * 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 * @return the new CompletionStage
* @since 9 * @since 9
*/ */
@ -2853,6 +2860,16 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
@Override public CompletableFuture<T> completeOnTimeout @Override public CompletableFuture<T> completeOnTimeout
(T value, long timeout, TimeUnit unit) { (T value, long timeout, TimeUnit unit) {
throw new UnsupportedOperationException(); } 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 // VarHandle mechanics

View File

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

View File

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

View File

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

View File

@ -186,7 +186,9 @@ public class BasicImageReader implements AutoCloseable {
if (result.getMajorVersion() != ImageHeader.MAJOR_VERSION || if (result.getMajorVersion() != ImageHeader.MAJOR_VERSION ||
result.getMinorVersion() != ImageHeader.MINOR_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; return result;
@ -318,11 +320,11 @@ public class BasicImageReader implements AutoCloseable {
private ByteBuffer readBuffer(long offset, long size) { private ByteBuffer readBuffer(long offset, long size) {
if (offset < 0 || Integer.MAX_VALUE <= offset) { if (offset < 0 || Integer.MAX_VALUE <= offset) {
throw new IndexOutOfBoundsException("offset"); throw new IndexOutOfBoundsException("Bad offset: " + offset);
} }
if (size < 0 || Integer.MAX_VALUE <= size) { if (size < 0 || Integer.MAX_VALUE <= size) {
throw new IndexOutOfBoundsException("size"); throw new IndexOutOfBoundsException("Bad size: " + size);
} }
if (MAP_ALL) { if (MAP_ALL) {
@ -382,11 +384,13 @@ public class BasicImageReader implements AutoCloseable {
long uncompressedSize = loc.getUncompressedSize(); long uncompressedSize = loc.getUncompressedSize();
if (compressedSize < 0 || Integer.MAX_VALUE < compressedSize) { 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) { if (uncompressedSize < 0 || Integer.MAX_VALUE < uncompressedSize) {
throw new IndexOutOfBoundsException("Uncompressed size"); throw new IndexOutOfBoundsException(
"Bad uncompressed size: " + uncompressedSize);
} }
if (compressedSize == 0) { if (compressedSize == 0) {

View File

@ -79,7 +79,8 @@ public final class ImageHeader {
Objects.requireNonNull(buffer); Objects.requireNonNull(buffer);
if (buffer.capacity() != HEADER_SLOTS) { 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); int magic = buffer.get(0);

View File

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

View File

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

View File

@ -151,7 +151,7 @@ public class ImageStringsReader implements ImageStrings {
try { try {
charsFromMUTF8(chars, bytes, offset, count); charsFromMUTF8(chars, bytes, offset, count);
} catch (UTFDataFormatException ex) { } 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); return new String(chars);
@ -199,7 +199,8 @@ public class ImageStringsReader implements ImageStrings {
ch = buffer.get(); ch = buffer.get();
if ((ch & 0xC0) != 0x80) { 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); uch = ((uch & ~mask) << 6) | (ch & 0x3F);
@ -208,7 +209,8 @@ public class ImageStringsReader implements ImageStrings {
} }
if ((uch & 0xFFFF) != uch) { 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; chars[j++] = (char)uch;

View File

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

View File

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

View File

@ -1603,11 +1603,50 @@ public final class Unsafe {
return weakCompareAndSwapShort(o, offset, c2s(expected), c2s(x)); 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 @ForceInline
private boolean byte2bool(byte b) { 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 @ForceInline
private byte bool2byte(boolean b) { private byte bool2byte(boolean b) {
return b ? (byte)1 : (byte)0; return b ? (byte)1 : (byte)0;

View File

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

View File

@ -153,27 +153,24 @@ public final class ModuleBootstrap {
boolean addAllDefaultModules = false; boolean addAllDefaultModules = false;
boolean addAllSystemModules = false; boolean addAllSystemModules = false;
boolean addAllApplicationModules = false; boolean addAllApplicationModules = false;
String propValue = getAndRemoveProperty("jdk.module.addmods"); for (String mod: getExtraAddModules()) {
if (propValue != null) { switch (mod) {
for (String mod: propValue.split(",")) { case ALL_DEFAULT:
switch (mod) { addAllDefaultModules = true;
case ALL_DEFAULT: break;
addAllDefaultModules = true; case ALL_SYSTEM:
break; addAllSystemModules = true;
case ALL_SYSTEM: break;
addAllSystemModules = true; case ALL_MODULE_PATH:
break; addAllApplicationModules = true;
case ALL_MODULE_PATH: break;
addAllApplicationModules = true; default :
break; roots.add(mod);
default :
roots.add(mod);
}
} }
} }
// --limit-modules // --limit-modules
propValue = getAndRemoveProperty("jdk.module.limitmods"); String propValue = getAndRemoveProperty("jdk.module.limitmods");
if (propValue != null) { if (propValue != null) {
Set<String> mods = new HashSet<>(); Set<String> mods = new HashSet<>();
for (String mod: propValue.split(",")) { 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 * Process the --add-reads options to add any additional read edges that
@ -514,7 +537,7 @@ public final class ModuleBootstrap {
// value is <module>(,<module>)* // value is <module>(,<module>)*
if (map.containsKey(key)) if (map.containsKey(key))
fail(key + " specified more than once"); fail(key + " specified more than once");
Set<String> values = new HashSet<>(); Set<String> values = new HashSet<>();
map.put(key, values); map.put(key, values);

View File

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

View File

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

View File

@ -616,8 +616,6 @@ class SocketChannelImpl
} }
public boolean connect(SocketAddress sa) throws IOException { public boolean connect(SocketAddress sa) throws IOException {
int localPort = 0;
synchronized (readLock) { synchronized (readLock) {
synchronized (writeLock) { synchronized (writeLock) {
ensureOpenAndUnconnected(); 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -344,7 +344,8 @@ abstract class SeedGenerator {
try { try {
BogusThread bt = new BogusThread(); BogusThread bt = new BogusThread();
Thread t = new Thread Thread t = new Thread
(seedGroup, bt, "SeedGenerator Thread", 0, false); (seedGroup, bt, "SeedGenerator Thread", 0,
false);
t.start(); t.start();
} catch (Exception e) { } catch (Exception e) {
throw new InternalError("internal error: " + throw new InternalError("internal error: " +
@ -357,7 +358,8 @@ abstract class SeedGenerator {
long startTime = System.nanoTime(); long startTime = System.nanoTime();
while (System.nanoTime() - startTime < 250000000) { while (System.nanoTime() - startTime < 250000000) {
synchronized(this){}; synchronized(this){};
latch++; // Mask the sign bit and keep latch non-negative
latch = (latch + 1) & 0x1FFFFFFF;
} }
// Translate the value using the permutation, and xor // Translate the value using the permutation, and xor
@ -431,7 +433,7 @@ abstract class SeedGenerator {
// data and using it to mix the trivial permutation. // data and using it to mix the trivial permutation.
// It should be evenly distributed. The specific values // It should be evenly distributed. The specific values
// are not crucial to the security of this class. // 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, 56, 30, -107, -6, -86, 25, -83, 75, -12, -64,
5, -128, 78, 21, 16, 32, 70, -81, 37, -51, 5, -128, 78, 21, 16, 32, 70, -81, 37, -51,
-43, -46, -108, 87, 29, 17, -55, 22, -11, -111, -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 { enum {
JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2, JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2,
JVM_STACKWALK_GET_CALLER_CLASS = 0x04,
JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20, JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20,
JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100 JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100
}; };

View File

@ -152,8 +152,8 @@ defaultPath(void)
#ifdef __solaris__ #ifdef __solaris__
/* These really are the Solaris defaults! */ /* These really are the Solaris defaults! */
return (geteuid() == 0 || getuid() == 0) ? return (geteuid() == 0 || getuid() == 0) ?
"/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" : "/usr/xpg4/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:";
#else #else
return ":/bin:/usr/bin"; /* glibc */ return ":/bin:/usr/bin"; /* glibc */
#endif #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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -35,12 +35,12 @@
#include "manifest_info.h" #include "manifest_info.h"
#include "jli_util.h" #include "jli_util.h"
#define PATH_SEPARATOR ':' #define PATH_SEPARATOR ':'
#define FILESEP "/" #define FILESEP "/"
#define FILE_SEPARATOR '/' #define FILE_SEPARATOR '/'
#define IS_FILE_SEPARATOR(c) ((c) == '/') #define IS_FILE_SEPARATOR(c) ((c) == '/')
#ifndef MAXNAMELEN #ifndef MAXNAMELEN
#define MAXNAMELEN PATH_MAX #define MAXNAMELEN PATH_MAX
#endif #endif
#ifdef _LP64 #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, static jboolean GetJREPath(char *path, jint pathsize, const char * arch,
jboolean speculative); jboolean speculative);
#if defined(_AIX)
#include "java_md_aix.h"
#endif
#ifdef MACOSX #ifdef MACOSX
#include "java_md_macosx.h" #include "java_md_macosx.h"
#else /* !MACOSX */ #else /* !MACOSX */
#include "java_md_solinux.h" #include "java_md_solinux.h"
#endif /* MACOSX */ #endif /* MACOSX */
#endif /* JAVA_MD_H */ #endif /* JAVA_MD_H */

View File

@ -33,6 +33,7 @@
#include <process.h> #include <process.h>
#include <iphlpapi.h> #include <iphlpapi.h>
#include <icmpapi.h> #include <icmpapi.h>
#include <WinError.h>
#include "java_net_InetAddress.h" #include "java_net_InetAddress.h"
#include "java_net_Inet4AddressImpl.h" #include "java_net_Inet4AddressImpl.h"
@ -442,7 +443,15 @@ ping4(JNIEnv *env,
DWORD ReplySize = 0; DWORD ReplySize = 0;
jboolean ret = JNI_FALSE; 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); ReplyBuffer = (VOID*) malloc(ReplySize);
if (ReplyBuffer == NULL) { if (ReplyBuffer == NULL) {
IcmpCloseHandle(hIcmpFile); IcmpCloseHandle(hIcmpFile);
@ -478,10 +487,47 @@ ping4(JNIEnv *env,
(timeout < 1000) ? 1000 : timeout); // DWORD Timeout (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; 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; ret = JNI_TRUE;
}
} }
free(ReplyBuffer); 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 { public static Constructor<?> findConstructor(Class<?> type, Class<?>...args) throws NoSuchMethodException {
if (type.isPrimitive()) { 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()) { 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)) { 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())) { 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)) { 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); PrimitiveWrapperMap.replacePrimitivesWithWrappers(args);
Signature signature = new Signature(type, args); Signature signature = new Signature(type, args);

View File

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

View File

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

View File

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

View File

@ -39,6 +39,10 @@ DEF_STATIC_JNI_OnLoad
*/ */
JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt) 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) { if (awt == NULL) {
return JNI_FALSE; return JNI_FALSE;
} }
@ -64,4 +68,5 @@ JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
} }
return JNI_TRUE; 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -68,8 +68,8 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
// master secret as a P11Key // master secret as a P11Key
private P11Key p11Key; private P11Key p11Key;
// version, e.g. 0x0301 // whether SSLv3 is supported
private int version; private final boolean supportSSLv3;
P11TlsKeyMaterialGenerator(Token token, String algorithm, long mechanism) P11TlsKeyMaterialGenerator(Token token, String algorithm, long mechanism)
throws PKCS11Exception { throws PKCS11Exception {
@ -77,6 +77,11 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
this.token = token; this.token = token;
this.algorithm = algorithm; this.algorithm = algorithm;
this.mechanism = mechanism; 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) { protected void engineInit(SecureRandom random) {
@ -89,20 +94,26 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
if (params instanceof TlsKeyMaterialParameterSpec == false) { if (params instanceof TlsKeyMaterialParameterSpec == false) {
throw new InvalidAlgorithmParameterException(MSG); 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 { try {
p11Key = P11SecretKeyFactory.convertKey p11Key = P11SecretKeyFactory.convertKey
(token, spec.getMasterSecret(), "TlsMasterSecret"); (token, spec.getMasterSecret(), "TlsMasterSecret");
} catch (InvalidKeyException e) { } catch (InvalidKeyException e) {
throw new InvalidAlgorithmParameterException("init() failed", e); throw new InvalidAlgorithmParameterException("init() failed", e);
} }
version = (spec.getMajorVersion() << 8) | spec.getMinorVersion(); this.spec = spec;
if ((version < 0x0300) && (version > 0x0302)) { this.mechanism = (version == 0x0300)?
throw new InvalidAlgorithmParameterException CKM_SSL3_KEY_AND_MAC_DERIVE : CKM_TLS_KEY_AND_MAC_DERIVE;
("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
} }
protected void engineInit(int keysize, SecureRandom random) { protected void engineInit(int keysize, SecureRandom random) {
@ -115,8 +126,6 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
throw new IllegalStateException throw new IllegalStateException
("TlsKeyMaterialGenerator must be initialized"); ("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 macBits = spec.getMacKeyLength() << 3;
int ivBits = spec.getIvLength() << 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -61,7 +61,10 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
private TlsMasterSecretParameterSpec spec; private TlsMasterSecretParameterSpec spec;
private P11Key p11Key; private P11Key p11Key;
int version; CK_VERSION ckVersion;
// whether SSLv3 is supported
private final boolean supportSSLv3;
P11TlsMasterSecretGenerator(Token token, String algorithm, long mechanism) P11TlsMasterSecretGenerator(Token token, String algorithm, long mechanism)
throws PKCS11Exception { throws PKCS11Exception {
@ -69,6 +72,11 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
this.token = token; this.token = token;
this.algorithm = algorithm; this.algorithm = algorithm;
this.mechanism = mechanism; 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) { protected void engineInit(SecureRandom random) {
@ -81,7 +89,17 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
if (params instanceof TlsMasterSecretParameterSpec == false) { if (params instanceof TlsMasterSecretParameterSpec == false) {
throw new InvalidAlgorithmParameterException(MSG); 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(); SecretKey key = spec.getPremasterSecret();
// algorithm should be either TlsRsaPremasterSecret or TlsPremasterSecret, // algorithm should be either TlsRsaPremasterSecret or TlsPremasterSecret,
// but we omit the check // but we omit the check
@ -90,25 +108,7 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
} catch (InvalidKeyException e) { } catch (InvalidKeyException e) {
throw new InvalidAlgorithmParameterException("init() failed", e); throw new InvalidAlgorithmParameterException("init() failed", e);
} }
version = (spec.getMajorVersion() << 8) | spec.getMinorVersion(); this.spec = spec;
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;
if (p11Key.getAlgorithm().equals("TlsRsaPremasterSecret")) { if (p11Key.getAlgorithm().equals("TlsRsaPremasterSecret")) {
mechanism = (version == 0x0300) ? CKM_SSL3_MASTER_KEY_DERIVE mechanism = (version == 0x0300) ? CKM_SSL3_MASTER_KEY_DERIVE
: CKM_TLS_MASTER_KEY_DERIVE; : CKM_TLS_MASTER_KEY_DERIVE;
@ -124,6 +124,17 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
: CKM_TLS_MASTER_KEY_DERIVE_DH; : CKM_TLS_MASTER_KEY_DERIVE_DH;
ckVersion = null; 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[] clientRandom = spec.getClientRandom();
byte[] serverRandom = spec.getServerRandom(); byte[] serverRandom = spec.getServerRandom();
CK_SSL3_RANDOM_DATA random = CK_SSL3_RANDOM_DATA random =
@ -139,13 +150,12 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
long keyID = token.p11.C_DeriveKey(session.id(), long keyID = token.p11.C_DeriveKey(session.id(),
new CK_MECHANISM(mechanism, params), p11Key.keyID, attributes); new CK_MECHANISM(mechanism, params), p11Key.keyID, attributes);
int major, minor; int major, minor;
ckVersion = params.pVersion; if (params.pVersion == null) {
if (ckVersion == null) {
major = -1; major = -1;
minor = -1; minor = -1;
} else { } else {
major = ckVersion.major; major = params.pVersion.major;
minor = ckVersion.minor; minor = params.pVersion.minor;
} }
SecretKey key = P11Key.masterSecretKey(session, keyID, SecretKey key = P11Key.masterSecretKey(session, keyID,
"TlsMasterSecret", 48 << 3, attributes, major, minor); "TlsMasterSecret", 48 << 3, attributes, major, minor);
@ -156,5 +166,4 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
token.releaseSession(session); 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -60,12 +60,20 @@ final class P11TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
private TlsRsaPremasterSecretParameterSpec spec; private TlsRsaPremasterSecretParameterSpec spec;
// whether SSLv3 is supported
private final boolean supportSSLv3;
P11TlsRsaPremasterSecretGenerator(Token token, String algorithm, long mechanism) P11TlsRsaPremasterSecretGenerator(Token token, String algorithm, long mechanism)
throws PKCS11Exception { throws PKCS11Exception {
super(); super();
this.token = token; this.token = token;
this.algorithm = algorithm; this.algorithm = algorithm;
this.mechanism = mechanism; 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) { protected void engineInit(SecureRandom random) {
@ -78,7 +86,20 @@ final class P11TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi {
if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) { if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) {
throw new InvalidAlgorithmParameterException(MSG); 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) { protected void engineInit(int keysize, SecureRandom random) {

View File

@ -45,7 +45,7 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
* <pre> * <pre>
* Secmod secmod = Secmod.getInstance(); * Secmod secmod = Secmod.getInstance();
* if (secmod.isInitialized() == false) { * 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(); * 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -145,6 +145,7 @@ public class Test5 extends Test {
socket.close(); socket.close();
s = new String (b,0,count, "ISO8859_1"); s = new String (b,0,count, "ISO8859_1");
if (!compare (s, result)) { if (!compare (s, result)) {
System.err.println(" Expected [" + result + "]\n actual [" + s + "]");
throw new RuntimeException ("wrong string result"); throw new RuntimeException ("wrong string result");
} }
} }

View File

@ -21,10 +21,11 @@
* questions. * questions.
*/ */
/** /*
* @test * @test
* @bug 8146156 * @bug 8146156
* @summary test whether conversion follows Locale.Category.FORMAT locale. * @summary test whether conversion follows Locale.Category.FORMAT locale.
* @modules jdk.localedata
* @run main/othervm FormatLocale * @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 { public void testFindVirtualClone0() throws Throwable {
if (CAN_SKIP_WORKING) return;
// test some ad hoc system methods // test some ad hoc system methods
testFindVirtual(false, PUBLIC, Object.class, Object.class, "clone"); testFindVirtual(false, PUBLIC, Object.class, Object.class, "clone");
@ -2798,11 +2799,17 @@ public class MethodHandlesTest {
toClauseMajor(postClauses, inits, steps, usePreds, finis); toClauseMajor(postClauses, inits, steps, usePreds, finis);
MethodHandle pre = MethodHandles.loop(preClauses); MethodHandle pre = MethodHandles.loop(preClauses);
MethodHandle post = MethodHandles.loop(postClauses); MethodHandle post = MethodHandles.loop(postClauses);
if (verbosity >= 6) {
System.out.println("pre-handle: " + pre);
}
Object[] preResults = (Object[]) pre.invokeWithArguments(args); Object[] preResults = (Object[]) pre.invokeWithArguments(args);
if (verbosity >= 4) { if (verbosity >= 4) {
System.out.println("pre-checked: expected " + Arrays.asList(preCheckedResults[i]) + ", actual " + System.out.println("pre-checked: expected " + Arrays.asList(preCheckedResults[i]) + ", actual " +
Arrays.asList(preResults)); Arrays.asList(preResults));
} }
if (verbosity >= 6) {
System.out.println("post-handle: " + post);
}
Object[] postResults = (Object[]) post.invokeWithArguments(args); Object[] postResults = (Object[]) post.invokeWithArguments(args);
if (verbosity >= 4) { if (verbosity >= 4) {
System.out.println("post-checked: expected " + Arrays.asList(postCheckedResults[i]) + ", actual " + 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,26 +37,27 @@ public class TimeToLive {
static int[] bad_ttls = { -1, 256 }; static int[] bad_ttls = { -1, 256 };
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
MulticastSocket socket = new MulticastSocket(6789); try (MulticastSocket socket = new MulticastSocket()) {
int ttl = socket.getTimeToLive(); int ttl = socket.getTimeToLive();
System.out.println("default ttl: " + ttl); System.out.println("default ttl: " + ttl);
for (int i = 0; i < new_ttls.length; i++) { for (int i = 0; i < new_ttls.length; i++) {
socket.setTimeToLive(new_ttls[i]); socket.setTimeToLive(new_ttls[i]);
if (!(new_ttls[i] == socket.getTimeToLive())) { if (!(new_ttls[i] == socket.getTimeToLive())) {
throw new RuntimeException("test failure, set/get differ: " + throw new RuntimeException("test failure, set/get differ: " +
new_ttls[i] + " / " + new_ttls[i] + " / " +
socket.getTimeToLive()); socket.getTimeToLive());
}
} }
} for (int j = 0; j < bad_ttls.length; j++) {
for (int j = 0; j < bad_ttls.length; j++) { boolean exception = false;
boolean exception = false; try {
try { socket.setTimeToLive(bad_ttls[j]);
socket.setTimeToLive(bad_ttls[j]); } catch (IllegalArgumentException e) {
} catch (IllegalArgumentException e) { exception = true;
exception = true; }
} if (!exception) {
if (!exception) { throw new RuntimeException("bad argument accepted: " + bad_ttls[j]);
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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -68,23 +68,23 @@ public class ThreadStop {
thr.start(); thr.start();
// give server time to block in ServerSocket.accept() // give server time to block in ServerSocket.accept()
Thread.currentThread().sleep(2000); Thread.sleep(2000);
// "stop" the thread // "stop" the thread
thr.stop(); thr.stop();
// give thread time to stop // give thread time to stop
Thread.currentThread().sleep(2000); Thread.sleep(2000);
// it's platform specific if Thread.stop interrupts the // it's platform specific if Thread.stop interrupts the
// thread - on Linux/Windows most likely that thread is // thread - on Linux/Windows most likely that thread is
// still in accept() so we connect to server which causes // still in accept() so we connect to server which causes
// it to unblock and do JNI-stuff with a pending exception // it to unblock and do JNI-stuff with a pending exception
try { try (Socket s = new Socket("localhost", svr.localPort())) {
Socket s = new Socket("localhost", svr.localPort()); } catch (IOException ioe) {
} 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@
@author Chris Hegarty @author Chris Hegarty
*/ */
import java.net.BindException;
import java.net.ServerSocket; import java.net.ServerSocket;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -74,6 +75,11 @@ public class InheritHandle
} catch (IOException ioe) { } catch (IOException ioe) {
System.out.println("Cannot create process"); System.out.println("Cannot create process");
ioe.printStackTrace(); ioe.printStackTrace();
try {
ss.close();
} catch (IOException e) {
e.printStackTrace();
}
return; return;
} }
@ -85,9 +91,18 @@ public class InheritHandle
System.out.println("Now close the socket and try to create another" + System.out.println("Now close the socket and try to create another" +
" one listening on the same port"); " one listening on the same port");
ss.close(); ss.close();
ss = new ServerSocket(port); int retries = 0;
System.out.println("Second ServerSocket created successfully"); while (retries < 5) {
ss.close(); 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 (InterruptedException ie) {
} catch (IOException ioe) { } catch (IOException ioe) {

View File

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

View File

@ -37,6 +37,7 @@ public class LookupTest {
String url, boolean throwsSecException, boolean throwsIOException) String url, boolean throwsSecException, boolean throwsIOException)
{ {
try { try {
ProxySelector.setDefault(null);
URL u = new URL(url); URL u = new URL(url);
System.err.println ("Connecting to " + u); System.err.println ("Connecting to " + u);
URLConnection urlc = u.openConnection(); URLConnection urlc = u.openConnection();
@ -71,7 +72,7 @@ public class LookupTest {
System.out.print(port); System.out.print(port);
} else if (cmd.equals("-runtest")) { } else if (cmd.equals("-runtest")) {
port = Integer.parseInt(args[1]); 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); System.setProperty("jdk.net.hosts.file", hostsFileName);
addMappingToHostsFile("allowedAndFound.com", "127.0.0.1", hostsFileName, false); addMappingToHostsFile("allowedAndFound.com", "127.0.0.1", hostsFileName, false);
addMappingToHostsFile("notAllowedButFound.com", "99.99.99.99", hostsFileName, true); 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 { grant {
permission java.net.URLPermission "http://allowedAndFound.com:${port}/-", "*:*"; permission java.net.URLPermission "http://allowedAndFound.com:${port}/-", "*:*";
permission java.net.URLPermission "http://allowedButNotfound.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.io.FilePermission "<<ALL FILES>>", "read,write,delete";
permission java.util.PropertyPermission "java.io.tmpdir", "read"; permission java.util.PropertyPermission "java.io.tmpdir", "read";

View File

@ -23,9 +23,11 @@
* questions. * questions.
*/ */
/** /*
* @test * @test
* @bug 8153142 * @bug 8153142
* @modules java.httpclient
* jdk.httpserver
* @run main/othervm HeadersTest1 * @run main/othervm HeadersTest1
* @summary HeadersTest1 * @summary HeadersTest1
*/ */
@ -39,9 +41,11 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.URI; 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.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.List; import java.util.List;

View File

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

View File

@ -24,5 +24,6 @@
/* /*
* @test * @test
* @bug 8151299 * @bug 8151299
* @modules java.httpclient
* @run testng java.httpclient/java.net.http.SelectorTest * @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.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.NavigableMap; import java.util.NavigableMap;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
@ -41,10 +40,8 @@ import org.testng.annotations.Test;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import static org.testng.Assert.fail; import static org.testng.Assert.fail;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertSame;
public class EmptyNavigableMap { public class EmptyNavigableMap {

View File

@ -41,10 +41,9 @@ import org.testng.annotations.Test;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import static org.testng.Assert.fail; 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.assertFalse;
import static org.testng.Assert.assertSame; import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
public class EmptyNavigableSet { public class EmptyNavigableSet {

View File

@ -28,8 +28,14 @@
* @author Martin Buchholz * @author Martin Buchholz
*/ */
import java.util.*; import java.util.ArrayDeque;
import java.util.concurrent.*; 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 { public class ChorusLine {
private interface Tweaker { private interface Tweaker {

View File

@ -28,7 +28,11 @@
* @author Martin Buchholz * @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 { public class ForgetMeNot {
private static void checkQ(PriorityQueue<Integer> q, Integer...elts) { 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 * @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 { public class PriorityQueueSort {

View File

@ -28,8 +28,17 @@
* @author Martin Buchholz * @author Martin Buchholz
*/ */
import java.util.*; import java.util.ArrayDeque;
import java.util.concurrent.*; 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 { public class RemoveContains {
static volatile int passed = 0, failed = 0; 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.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.Executors.newSingleThreadExecutor;
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;

View File

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

View File

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