--- a/.hgtags-top-repo Thu Jun 18 10:24:57 2015 -0700
+++ b/.hgtags-top-repo Wed Jul 05 20:38:32 2017 +0200
@@ -311,3 +311,4 @@
dc6e8336f51bb6b67b7245766179eab5ca7720b4 jdk9-b66
f546760134eb861fcfecd4ce611b0040b0d25a6a jdk9-b67
70e4272790b6199e9ca89df2758ff9cb58ec4125 jdk9-b68
+1bcfd6b8726582cff5a42dbfc75903e36f9dd4fe jdk9-b69
--- a/common/autoconf/basics.m4 Thu Jun 18 10:24:57 2015 -0700
+++ b/common/autoconf/basics.m4 Wed Jul 05 20:38:32 2017 +0200
@@ -436,7 +436,6 @@
BASIC_PATH_PROGS(CYGPATH, cygpath)
BASIC_PATH_PROGS(READLINK, [greadlink readlink])
BASIC_PATH_PROGS(DF, df)
- BASIC_PATH_PROGS(SETFILE, SetFile)
BASIC_PATH_PROGS(CPIO, [cpio bsdcpio])
])
@@ -574,10 +573,11 @@
)
if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
- # detect if Xcode is installed by running xcodebuild -version
+ # If a devkit has been supplied, find xcodebuild in the toolchain_path.
+ # If not, detect if Xcode is installed by running xcodebuild -version
# if no Xcode installed, xcodebuild exits with 1
# if Xcode is installed, even if xcode-select is misconfigured, then it exits with 0
- if /usr/bin/xcodebuild -version >/dev/null 2>&1; then
+ if test "x$DEVKIT_ROOT" != x || /usr/bin/xcodebuild -version >/dev/null 2>&1; then
# We need to use xcodebuild in the toolchain dir provided by the user, this will
# fall back on the stub binary in /usr/bin/xcodebuild
AC_PATH_PROG([XCODEBUILD], [xcodebuild], [/usr/bin/xcodebuild], [$TOOLCHAIN_PATH])
@@ -961,6 +961,7 @@
AC_MSG_RESULT([yes])
fi
fi
+ BASIC_REQUIRE_PROGS(SETFILE, SetFile)
fi
])
--- a/common/autoconf/build-aux/config.guess Thu Jun 18 10:24:57 2015 -0700
+++ b/common/autoconf/build-aux/config.guess Wed Jul 05 20:38:32 2017 +0200
@@ -86,4 +86,11 @@
fi
fi
+# Test and fix cpu on Macosx when C preprocessor is not on the path
+echo $OUT | grep i386-apple-darwin > /dev/null 2> /dev/null
+if test $? = 0; then
+ REAL_CPU=`uname -m`
+ OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
+fi
+
echo $OUT
--- a/common/autoconf/generated-configure.sh Thu Jun 18 10:24:57 2015 -0700
+++ b/common/autoconf/generated-configure.sh Wed Jul 05 20:38:32 2017 +0200
@@ -855,6 +855,7 @@
OS_VERSION_MAJOR
PKG_CONFIG
BASH_ARGS
+SETFILE
CODESIGN
XATTR
DSYMUTIL
@@ -946,7 +947,6 @@
build_cpu
build
CPIO
-SETFILE
DF
READLINK
CYGPATH
@@ -1167,7 +1167,6 @@
CYGPATH
READLINK
DF
-SETFILE
CPIO
UNZIP
ZIP
@@ -1180,6 +1179,7 @@
DSYMUTIL
XATTR
CODESIGN
+SETFILE
PKG_CONFIG
JAVA
JAVAC
@@ -2049,7 +2049,6 @@
CYGPATH Override default value for CYGPATH
READLINK Override default value for READLINK
DF Override default value for DF
- SETFILE Override default value for SETFILE
CPIO Override default value for CPIO
UNZIP Override default value for UNZIP
ZIP Override default value for ZIP
@@ -2062,6 +2061,7 @@
DSYMUTIL Override default value for DSYMUTIL
XATTR Override default value for XATTR
CODESIGN Override default value for CODESIGN
+ SETFILE Override default value for SETFILE
PKG_CONFIG path to pkg-config utility
JAVA Override default value for JAVA
JAVAC Override default value for JAVAC
@@ -4364,7 +4364,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1433337614
+DATE_WHEN_GENERATED=1434614912
###############################################################################
#
@@ -13058,192 +13058,6 @@
# Publish this variable in the help.
- if test "x$SETFILE" = x; then
- # The variable is not set by user, try to locate tool using the code snippet
- for ac_prog in SetFile
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_SETFILE+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $SETFILE in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_SETFILE="$SETFILE" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_SETFILE="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-SETFILE=$ac_cv_path_SETFILE
-if test -n "$SETFILE"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SETFILE" >&5
-$as_echo "$SETFILE" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$SETFILE" && break
-done
-
- else
- # The variable is set, but is it from the command line or the environment?
-
- # Try to remove the string !SETFILE! from our list.
- try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!SETFILE!/}
- if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
- # If it failed, the variable was not from the command line. Ignore it,
- # but warn the user (except for BASH, which is always set by the calling BASH).
- if test "xSETFILE" != xBASH; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of SETFILE from the environment. Use command line variables instead." >&5
-$as_echo "$as_me: WARNING: Ignoring value of SETFILE from the environment. Use command line variables instead." >&2;}
- fi
- # Try to locate tool using the code snippet
- for ac_prog in SetFile
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_SETFILE+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $SETFILE in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_SETFILE="$SETFILE" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_SETFILE="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-SETFILE=$ac_cv_path_SETFILE
-if test -n "$SETFILE"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SETFILE" >&5
-$as_echo "$SETFILE" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$SETFILE" && break
-done
-
- else
- # If it succeeded, then it was overridden by the user. We will use it
- # for the tool.
-
- # First remove it from the list of overridden variables, so we can test
- # for unknown variables in the end.
- CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
-
- # Check if the provided tool contains a complete path.
- tool_specified="$SETFILE"
- tool_basename="${tool_specified##*/}"
- if test "x$tool_basename" = "x$tool_specified"; then
- # A command without a complete path is provided, search $PATH.
- { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool SETFILE=$tool_basename" >&5
-$as_echo "$as_me: Will search for user supplied tool SETFILE=$tool_basename" >&6;}
- # Extract the first word of "$tool_basename", so it can be a program name with args.
-set dummy $tool_basename; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_SETFILE+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $SETFILE in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_SETFILE="$SETFILE" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_SETFILE="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-SETFILE=$ac_cv_path_SETFILE
-if test -n "$SETFILE"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SETFILE" >&5
-$as_echo "$SETFILE" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- if test "x$SETFILE" = x; then
- as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
- fi
- else
- # Otherwise we believe it is a complete path. Use it as it is.
- { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool SETFILE=$tool_specified" >&5
-$as_echo "$as_me: Will use user supplied tool SETFILE=$tool_specified" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SETFILE" >&5
-$as_echo_n "checking for SETFILE... " >&6; }
- if test ! -x "$tool_specified"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
- as_fn_error $? "User supplied tool SETFILE=$tool_specified does not exist or is not executable" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
-$as_echo "$tool_specified" >&6; }
- fi
- fi
- fi
-
-
-
-
- # Publish this variable in the help.
-
-
if test "x$CPIO" = x; then
# The variable is not set by user, try to locate tool using the code snippet
for ac_prog in cpio bsdcpio
@@ -15140,10 +14954,11 @@
if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
- # detect if Xcode is installed by running xcodebuild -version
+ # If a devkit has been supplied, find xcodebuild in the toolchain_path.
+ # If not, detect if Xcode is installed by running xcodebuild -version
# if no Xcode installed, xcodebuild exits with 1
# if Xcode is installed, even if xcode-select is misconfigured, then it exits with 0
- if /usr/bin/xcodebuild -version >/dev/null 2>&1; then
+ if test "x$DEVKIT_ROOT" != x || /usr/bin/xcodebuild -version >/dev/null 2>&1; then
# We need to use xcodebuild in the toolchain dir provided by the user, this will
# fall back on the stub binary in /usr/bin/xcodebuild
# Extract the first word of "xcodebuild", so it can be a program name with args.
@@ -19653,6 +19468,199 @@
$as_echo "yes" >&6; }
fi
fi
+
+
+
+ # Publish this variable in the help.
+
+
+ if test "x$SETFILE" = x; then
+ # The variable is not set by user, try to locate tool using the code snippet
+ for ac_prog in SetFile
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_SETFILE+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $SETFILE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SETFILE="$SETFILE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_SETFILE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+SETFILE=$ac_cv_path_SETFILE
+if test -n "$SETFILE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SETFILE" >&5
+$as_echo "$SETFILE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$SETFILE" && break
+done
+
+ else
+ # The variable is set, but is it from the command line or the environment?
+
+ # Try to remove the string !SETFILE! from our list.
+ try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!SETFILE!/}
+ if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+ # If it failed, the variable was not from the command line. Ignore it,
+ # but warn the user (except for BASH, which is always set by the calling BASH).
+ if test "xSETFILE" != xBASH; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of SETFILE from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of SETFILE from the environment. Use command line variables instead." >&2;}
+ fi
+ # Try to locate tool using the code snippet
+ for ac_prog in SetFile
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_SETFILE+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $SETFILE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SETFILE="$SETFILE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_SETFILE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+SETFILE=$ac_cv_path_SETFILE
+if test -n "$SETFILE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SETFILE" >&5
+$as_echo "$SETFILE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$SETFILE" && break
+done
+
+ else
+ # If it succeeded, then it was overridden by the user. We will use it
+ # for the tool.
+
+ # First remove it from the list of overridden variables, so we can test
+ # for unknown variables in the end.
+ CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+ # Check if the provided tool contains a complete path.
+ tool_specified="$SETFILE"
+ tool_basename="${tool_specified##*/}"
+ if test "x$tool_basename" = "x$tool_specified"; then
+ # A command without a complete path is provided, search $PATH.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool SETFILE=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool SETFILE=$tool_basename" >&6;}
+ # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_SETFILE+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $SETFILE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SETFILE="$SETFILE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_SETFILE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+SETFILE=$ac_cv_path_SETFILE
+if test -n "$SETFILE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SETFILE" >&5
+$as_echo "$SETFILE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test "x$SETFILE" = x; then
+ as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+ fi
+ else
+ # Otherwise we believe it is a complete path. Use it as it is.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool SETFILE=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool SETFILE=$tool_specified" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SETFILE" >&5
+$as_echo_n "checking for SETFILE... " >&6; }
+ if test ! -x "$tool_specified"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ as_fn_error $? "User supplied tool SETFILE=$tool_specified does not exist or is not executable" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+ fi
+ fi
+ fi
+
+
+
+ if test "x$SETFILE" = x; then
+ as_fn_error $? "Could not find required tool for SETFILE" "$LINENO" 5
+ fi
+
+
fi
--- a/hotspot/.hgtags Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/.hgtags Wed Jul 05 20:38:32 2017 +0200
@@ -471,3 +471,4 @@
197e94e0dacddd16816f101d24fc0442ab518326 jdk9-b66
d47dfabd16d48eb96a451edd1b61194a39ee0eb5 jdk9-b67
11af3990d56c97b40318bc1f20608e86f051a3f7 jdk9-b68
+ff0929a59ced0e144201aa05819ae2e47d6f2c61 jdk9-b69
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -2813,6 +2813,13 @@
emit_arith(0x0B, 0xC0, dst, src);
}
+void Assembler::orl(Address dst, Register src) {
+ InstructionMark im(this);
+ prefix(dst, src);
+ emit_int8(0x09);
+ emit_operand(src, dst);
+}
+
void Assembler::packuswb(XMMRegister dst, Address src) {
NOT_LP64(assert(VM_Version::supports_sse2(), ""));
assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
@@ -6907,6 +6914,19 @@
}
}
+void Assembler::rcrq(Register dst, int imm8) {
+ assert(isShiftCount(imm8 >> 1), "illegal shift count");
+ int encode = prefixq_and_encode(dst->encoding());
+ if (imm8 == 1) {
+ emit_int8((unsigned char)0xD1);
+ emit_int8((unsigned char)(0xD8 | encode));
+ } else {
+ emit_int8((unsigned char)0xC1);
+ emit_int8((unsigned char)(0xD8 | encode));
+ emit_int8(imm8);
+ }
+}
+
void Assembler::rorq(Register dst, int imm8) {
assert(isShiftCount(imm8 >> 1), "illegal shift count");
int encode = prefixq_and_encode(dst->encoding());
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp Wed Jul 05 20:38:32 2017 +0200
@@ -1594,6 +1594,7 @@
void orl(Register dst, int32_t imm32);
void orl(Register dst, Address src);
void orl(Register dst, Register src);
+ void orl(Address dst, Register src);
void orq(Address dst, int32_t imm32);
void orq(Register dst, int32_t imm32);
@@ -1694,6 +1695,8 @@
void rclq(Register dst, int imm8);
+ void rcrq(Register dst, int imm8);
+
void rdtsc();
void ret(int imm16);
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -7750,6 +7750,503 @@
pop(tmp2);
pop(tmp1);
}
+
+//Helper functions for square_to_len()
+
+/**
+ * Store the squares of x[], right shifted one bit (divided by 2) into z[]
+ * Preserves x and z and modifies rest of the registers.
+ */
+
+void MacroAssembler::square_rshift(Register x, Register xlen, Register z, Register tmp1, Register tmp3, Register tmp4, Register tmp5, Register rdxReg, Register raxReg) {
+ // Perform square and right shift by 1
+ // Handle odd xlen case first, then for even xlen do the following
+ // jlong carry = 0;
+ // for (int j=0, i=0; j < xlen; j+=2, i+=4) {
+ // huge_128 product = x[j:j+1] * x[j:j+1];
+ // z[i:i+1] = (carry << 63) | (jlong)(product >>> 65);
+ // z[i+2:i+3] = (jlong)(product >>> 1);
+ // carry = (jlong)product;
+ // }
+
+ xorq(tmp5, tmp5); // carry
+ xorq(rdxReg, rdxReg);
+ xorl(tmp1, tmp1); // index for x
+ xorl(tmp4, tmp4); // index for z
+
+ Label L_first_loop, L_first_loop_exit;
+
+ testl(xlen, 1);
+ jccb(Assembler::zero, L_first_loop); //jump if xlen is even
+
+ // Square and right shift by 1 the odd element using 32 bit multiply
+ movl(raxReg, Address(x, tmp1, Address::times_4, 0));
+ imulq(raxReg, raxReg);
+ shrq(raxReg, 1);
+ adcq(tmp5, 0);
+ movq(Address(z, tmp4, Address::times_4, 0), raxReg);
+ incrementl(tmp1);
+ addl(tmp4, 2);
+
+ // Square and right shift by 1 the rest using 64 bit multiply
+ bind(L_first_loop);
+ cmpptr(tmp1, xlen);
+ jccb(Assembler::equal, L_first_loop_exit);
+
+ // Square
+ movq(raxReg, Address(x, tmp1, Address::times_4, 0));
+ rorq(raxReg, 32); // convert big-endian to little-endian
+ mulq(raxReg); // 64-bit multiply rax * rax -> rdx:rax
+
+ // Right shift by 1 and save carry
+ shrq(tmp5, 1); // rdx:rax:tmp5 = (tmp5:rdx:rax) >>> 1
+ rcrq(rdxReg, 1);
+ rcrq(raxReg, 1);
+ adcq(tmp5, 0);
+
+ // Store result in z
+ movq(Address(z, tmp4, Address::times_4, 0), rdxReg);
+ movq(Address(z, tmp4, Address::times_4, 8), raxReg);
+
+ // Update indices for x and z
+ addl(tmp1, 2);
+ addl(tmp4, 4);
+ jmp(L_first_loop);
+
+ bind(L_first_loop_exit);
+}
+
+
+/**
+ * Perform the following multiply add operation using BMI2 instructions
+ * carry:sum = sum + op1*op2 + carry
+ * op2 should be in rdx
+ * op2 is preserved, all other registers are modified
+ */
+void MacroAssembler::multiply_add_64_bmi2(Register sum, Register op1, Register op2, Register carry, Register tmp2) {
+ // assert op2 is rdx
+ mulxq(tmp2, op1, op1); // op1 * op2 -> tmp2:op1
+ addq(sum, carry);
+ adcq(tmp2, 0);
+ addq(sum, op1);
+ adcq(tmp2, 0);
+ movq(carry, tmp2);
+}
+
+/**
+ * Perform the following multiply add operation:
+ * carry:sum = sum + op1*op2 + carry
+ * Preserves op1, op2 and modifies rest of registers
+ */
+void MacroAssembler::multiply_add_64(Register sum, Register op1, Register op2, Register carry, Register rdxReg, Register raxReg) {
+ // rdx:rax = op1 * op2
+ movq(raxReg, op2);
+ mulq(op1);
+
+ // rdx:rax = sum + carry + rdx:rax
+ addq(sum, carry);
+ adcq(rdxReg, 0);
+ addq(sum, raxReg);
+ adcq(rdxReg, 0);
+
+ // carry:sum = rdx:sum
+ movq(carry, rdxReg);
+}
+
+/**
+ * Add 64 bit long carry into z[] with carry propogation.
+ * Preserves z and carry register values and modifies rest of registers.
+ *
+ */
+void MacroAssembler::add_one_64(Register z, Register zlen, Register carry, Register tmp1) {
+ Label L_fourth_loop, L_fourth_loop_exit;
+
+ movl(tmp1, 1);
+ subl(zlen, 2);
+ addq(Address(z, zlen, Address::times_4, 0), carry);
+
+ bind(L_fourth_loop);
+ jccb(Assembler::carryClear, L_fourth_loop_exit);
+ subl(zlen, 2);
+ jccb(Assembler::negative, L_fourth_loop_exit);
+ addq(Address(z, zlen, Address::times_4, 0), tmp1);
+ jmp(L_fourth_loop);
+ bind(L_fourth_loop_exit);
+}
+
+/**
+ * Shift z[] left by 1 bit.
+ * Preserves x, len, z and zlen registers and modifies rest of the registers.
+ *
+ */
+void MacroAssembler::lshift_by_1(Register x, Register len, Register z, Register zlen, Register tmp1, Register tmp2, Register tmp3, Register tmp4) {
+
+ Label L_fifth_loop, L_fifth_loop_exit;
+
+ // Fifth loop
+ // Perform primitiveLeftShift(z, zlen, 1)
+
+ const Register prev_carry = tmp1;
+ const Register new_carry = tmp4;
+ const Register value = tmp2;
+ const Register zidx = tmp3;
+
+ // int zidx, carry;
+ // long value;
+ // carry = 0;
+ // for (zidx = zlen-2; zidx >=0; zidx -= 2) {
+ // (carry:value) = (z[i] << 1) | carry ;
+ // z[i] = value;
+ // }
+
+ movl(zidx, zlen);
+ xorl(prev_carry, prev_carry); // clear carry flag and prev_carry register
+
+ bind(L_fifth_loop);
+ decl(zidx); // Use decl to preserve carry flag
+ decl(zidx);
+ jccb(Assembler::negative, L_fifth_loop_exit);
+
+ if (UseBMI2Instructions) {
+ movq(value, Address(z, zidx, Address::times_4, 0));
+ rclq(value, 1);
+ rorxq(value, value, 32);
+ movq(Address(z, zidx, Address::times_4, 0), value); // Store back in big endian form
+ }
+ else {
+ // clear new_carry
+ xorl(new_carry, new_carry);
+
+ // Shift z[i] by 1, or in previous carry and save new carry
+ movq(value, Address(z, zidx, Address::times_4, 0));
+ shlq(value, 1);
+ adcl(new_carry, 0);
+
+ orq(value, prev_carry);
+ rorq(value, 0x20);
+ movq(Address(z, zidx, Address::times_4, 0), value); // Store back in big endian form
+
+ // Set previous carry = new carry
+ movl(prev_carry, new_carry);
+ }
+ jmp(L_fifth_loop);
+
+ bind(L_fifth_loop_exit);
+}
+
+
+/**
+ * Code for BigInteger::squareToLen() intrinsic
+ *
+ * rdi: x
+ * rsi: len
+ * r8: z
+ * rcx: zlen
+ * r12: tmp1
+ * r13: tmp2
+ * r14: tmp3
+ * r15: tmp4
+ * rbx: tmp5
+ *
+ */
+void MacroAssembler::square_to_len(Register x, Register len, Register z, Register zlen, Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5, Register rdxReg, Register raxReg) {
+
+ Label L_second_loop, L_second_loop_exit, L_third_loop, L_third_loop_exit, fifth_loop, fifth_loop_exit, L_last_x, L_multiply;
+ push(tmp1);
+ push(tmp2);
+ push(tmp3);
+ push(tmp4);
+ push(tmp5);
+
+ // First loop
+ // Store the squares, right shifted one bit (i.e., divided by 2).
+ square_rshift(x, len, z, tmp1, tmp3, tmp4, tmp5, rdxReg, raxReg);
+
+ // Add in off-diagonal sums.
+ //
+ // Second, third (nested) and fourth loops.
+ // zlen +=2;
+ // for (int xidx=len-2,zidx=zlen-4; xidx > 0; xidx-=2,zidx-=4) {
+ // carry = 0;
+ // long op2 = x[xidx:xidx+1];
+ // for (int j=xidx-2,k=zidx; j >= 0; j-=2) {
+ // k -= 2;
+ // long op1 = x[j:j+1];
+ // long sum = z[k:k+1];
+ // carry:sum = multiply_add_64(sum, op1, op2, carry, tmp_regs);
+ // z[k:k+1] = sum;
+ // }
+ // add_one_64(z, k, carry, tmp_regs);
+ // }
+
+ const Register carry = tmp5;
+ const Register sum = tmp3;
+ const Register op1 = tmp4;
+ Register op2 = tmp2;
+
+ push(zlen);
+ push(len);
+ addl(zlen,2);
+ bind(L_second_loop);
+ xorq(carry, carry);
+ subl(zlen, 4);
+ subl(len, 2);
+ push(zlen);
+ push(len);
+ cmpl(len, 0);
+ jccb(Assembler::lessEqual, L_second_loop_exit);
+
+ // Multiply an array by one 64 bit long.
+ if (UseBMI2Instructions) {
+ op2 = rdxReg;
+ movq(op2, Address(x, len, Address::times_4, 0));
+ rorxq(op2, op2, 32);
+ }
+ else {
+ movq(op2, Address(x, len, Address::times_4, 0));
+ rorq(op2, 32);
+ }
+
+ bind(L_third_loop);
+ decrementl(len);
+ jccb(Assembler::negative, L_third_loop_exit);
+ decrementl(len);
+ jccb(Assembler::negative, L_last_x);
+
+ movq(op1, Address(x, len, Address::times_4, 0));
+ rorq(op1, 32);
+
+ bind(L_multiply);
+ subl(zlen, 2);
+ movq(sum, Address(z, zlen, Address::times_4, 0));
+
+ // Multiply 64 bit by 64 bit and add 64 bits lower half and upper 64 bits as carry.
+ if (UseBMI2Instructions) {
+ multiply_add_64_bmi2(sum, op1, op2, carry, tmp2);
+ }
+ else {
+ multiply_add_64(sum, op1, op2, carry, rdxReg, raxReg);
+ }
+
+ movq(Address(z, zlen, Address::times_4, 0), sum);
+
+ jmp(L_third_loop);
+ bind(L_third_loop_exit);
+
+ // Fourth loop
+ // Add 64 bit long carry into z with carry propogation.
+ // Uses offsetted zlen.
+ add_one_64(z, zlen, carry, tmp1);
+
+ pop(len);
+ pop(zlen);
+ jmp(L_second_loop);
+
+ // Next infrequent code is moved outside loops.
+ bind(L_last_x);
+ movl(op1, Address(x, 0));
+ jmp(L_multiply);
+
+ bind(L_second_loop_exit);
+ pop(len);
+ pop(zlen);
+ pop(len);
+ pop(zlen);
+
+ // Fifth loop
+ // Shift z left 1 bit.
+ lshift_by_1(x, len, z, zlen, tmp1, tmp2, tmp3, tmp4);
+
+ // z[zlen-1] |= x[len-1] & 1;
+ movl(tmp3, Address(x, len, Address::times_4, -4));
+ andl(tmp3, 1);
+ orl(Address(z, zlen, Address::times_4, -4), tmp3);
+
+ pop(tmp5);
+ pop(tmp4);
+ pop(tmp3);
+ pop(tmp2);
+ pop(tmp1);
+}
+
+/**
+ * Helper function for mul_add()
+ * Multiply the in[] by int k and add to out[] starting at offset offs using
+ * 128 bit by 32 bit multiply and return the carry in tmp5.
+ * Only quad int aligned length of in[] is operated on in this function.
+ * k is in rdxReg for BMI2Instructions, for others it is in tmp2.
+ * This function preserves out, in and k registers.
+ * len and offset point to the appropriate index in "in" & "out" correspondingly
+ * tmp5 has the carry.
+ * other registers are temporary and are modified.
+ *
+ */
+void MacroAssembler::mul_add_128_x_32_loop(Register out, Register in,
+ Register offset, Register len, Register tmp1, Register tmp2, Register tmp3,
+ Register tmp4, Register tmp5, Register rdxReg, Register raxReg) {
+
+ Label L_first_loop, L_first_loop_exit;
+
+ movl(tmp1, len);
+ shrl(tmp1, 2);
+
+ bind(L_first_loop);
+ subl(tmp1, 1);
+ jccb(Assembler::negative, L_first_loop_exit);
+
+ subl(len, 4);
+ subl(offset, 4);
+
+ Register op2 = tmp2;
+ const Register sum = tmp3;
+ const Register op1 = tmp4;
+ const Register carry = tmp5;
+
+ if (UseBMI2Instructions) {
+ op2 = rdxReg;
+ }
+
+ movq(op1, Address(in, len, Address::times_4, 8));
+ rorq(op1, 32);
+ movq(sum, Address(out, offset, Address::times_4, 8));
+ rorq(sum, 32);
+ if (UseBMI2Instructions) {
+ multiply_add_64_bmi2(sum, op1, op2, carry, raxReg);
+ }
+ else {
+ multiply_add_64(sum, op1, op2, carry, rdxReg, raxReg);
+ }
+ // Store back in big endian from little endian
+ rorq(sum, 0x20);
+ movq(Address(out, offset, Address::times_4, 8), sum);
+
+ movq(op1, Address(in, len, Address::times_4, 0));
+ rorq(op1, 32);
+ movq(sum, Address(out, offset, Address::times_4, 0));
+ rorq(sum, 32);
+ if (UseBMI2Instructions) {
+ multiply_add_64_bmi2(sum, op1, op2, carry, raxReg);
+ }
+ else {
+ multiply_add_64(sum, op1, op2, carry, rdxReg, raxReg);
+ }
+ // Store back in big endian from little endian
+ rorq(sum, 0x20);
+ movq(Address(out, offset, Address::times_4, 0), sum);
+
+ jmp(L_first_loop);
+ bind(L_first_loop_exit);
+}
+
+/**
+ * Code for BigInteger::mulAdd() intrinsic
+ *
+ * rdi: out
+ * rsi: in
+ * r11: offs (out.length - offset)
+ * rcx: len
+ * r8: k
+ * r12: tmp1
+ * r13: tmp2
+ * r14: tmp3
+ * r15: tmp4
+ * rbx: tmp5
+ * Multiply the in[] by word k and add to out[], return the carry in rax
+ */
+void MacroAssembler::mul_add(Register out, Register in, Register offs,
+ Register len, Register k, Register tmp1, Register tmp2, Register tmp3,
+ Register tmp4, Register tmp5, Register rdxReg, Register raxReg) {
+
+ Label L_carry, L_last_in, L_done;
+
+// carry = 0;
+// for (int j=len-1; j >= 0; j--) {
+// long product = (in[j] & LONG_MASK) * kLong +
+// (out[offs] & LONG_MASK) + carry;
+// out[offs--] = (int)product;
+// carry = product >>> 32;
+// }
+//
+ push(tmp1);
+ push(tmp2);
+ push(tmp3);
+ push(tmp4);
+ push(tmp5);
+
+ Register op2 = tmp2;
+ const Register sum = tmp3;
+ const Register op1 = tmp4;
+ const Register carry = tmp5;
+
+ if (UseBMI2Instructions) {
+ op2 = rdxReg;
+ movl(op2, k);
+ }
+ else {
+ movl(op2, k);
+ }
+
+ xorq(carry, carry);
+
+ //First loop
+
+ //Multiply in[] by k in a 4 way unrolled loop using 128 bit by 32 bit multiply
+ //The carry is in tmp5
+ mul_add_128_x_32_loop(out, in, offs, len, tmp1, tmp2, tmp3, tmp4, tmp5, rdxReg, raxReg);
+
+ //Multiply the trailing in[] entry using 64 bit by 32 bit, if any
+ decrementl(len);
+ jccb(Assembler::negative, L_carry);
+ decrementl(len);
+ jccb(Assembler::negative, L_last_in);
+
+ movq(op1, Address(in, len, Address::times_4, 0));
+ rorq(op1, 32);
+
+ subl(offs, 2);
+ movq(sum, Address(out, offs, Address::times_4, 0));
+ rorq(sum, 32);
+
+ if (UseBMI2Instructions) {
+ multiply_add_64_bmi2(sum, op1, op2, carry, raxReg);
+ }
+ else {
+ multiply_add_64(sum, op1, op2, carry, rdxReg, raxReg);
+ }
+
+ // Store back in big endian from little endian
+ rorq(sum, 0x20);
+ movq(Address(out, offs, Address::times_4, 0), sum);
+
+ testl(len, len);
+ jccb(Assembler::zero, L_carry);
+
+ //Multiply the last in[] entry, if any
+ bind(L_last_in);
+ movl(op1, Address(in, 0));
+ movl(sum, Address(out, offs, Address::times_4, -4));
+
+ movl(raxReg, k);
+ mull(op1); //tmp4 * eax -> edx:eax
+ addl(sum, carry);
+ adcl(rdxReg, 0);
+ addl(sum, raxReg);
+ adcl(rdxReg, 0);
+ movl(carry, rdxReg);
+
+ movl(Address(out, offs, Address::times_4, -4), sum);
+
+ bind(L_carry);
+ //return tmp5/carry as carry in rax
+ movl(rax, carry);
+
+ bind(L_done);
+ pop(tmp5);
+ pop(tmp4);
+ pop(tmp3);
+ pop(tmp2);
+ pop(tmp1);
+}
#endif
/**
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Wed Jul 05 20:38:32 2017 +0200
@@ -1241,6 +1241,25 @@
Register carry2);
void multiply_to_len(Register x, Register xlen, Register y, Register ylen, Register z, Register zlen,
Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5);
+
+ void square_rshift(Register x, Register len, Register z, Register tmp1, Register tmp3,
+ Register tmp4, Register tmp5, Register rdxReg, Register raxReg);
+ void multiply_add_64_bmi2(Register sum, Register op1, Register op2, Register carry,
+ Register tmp2);
+ void multiply_add_64(Register sum, Register op1, Register op2, Register carry,
+ Register rdxReg, Register raxReg);
+ void add_one_64(Register z, Register zlen, Register carry, Register tmp1);
+ void lshift_by_1(Register x, Register len, Register z, Register zlen, Register tmp1, Register tmp2,
+ Register tmp3, Register tmp4);
+ void square_to_len(Register x, Register len, Register z, Register zlen, Register tmp1, Register tmp2,
+ Register tmp3, Register tmp4, Register tmp5, Register rdxReg, Register raxReg);
+
+ void mul_add_128_x_32_loop(Register out, Register in, Register offset, Register len, Register tmp1,
+ Register tmp2, Register tmp3, Register tmp4, Register tmp5, Register rdxReg,
+ Register raxReg);
+ void mul_add(Register out, Register in, Register offset, Register len, Register k, Register tmp1,
+ Register tmp2, Register tmp3, Register tmp4, Register tmp5, Register rdxReg,
+ Register raxReg);
#endif
// CRC32 code for java.util.zip.CRC32::updateBytes() instrinsic.
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -3785,6 +3785,107 @@
return start;
}
+/**
+ * Arguments:
+ *
+ // Input:
+ // c_rarg0 - x address
+ // c_rarg1 - x length
+ // c_rarg2 - z address
+ // c_rarg3 - z lenth
+ *
+ */
+ address generate_squareToLen() {
+
+ __ align(CodeEntryAlignment);
+ StubCodeMark mark(this, "StubRoutines", "squareToLen");
+
+ address start = __ pc();
+ // Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
+ // Unix: rdi, rsi, rdx, rcx (c_rarg0, c_rarg1, ...)
+ const Register x = rdi;
+ const Register len = rsi;
+ const Register z = r8;
+ const Register zlen = rcx;
+
+ const Register tmp1 = r12;
+ const Register tmp2 = r13;
+ const Register tmp3 = r14;
+ const Register tmp4 = r15;
+ const Register tmp5 = rbx;
+
+ BLOCK_COMMENT("Entry:");
+ __ enter(); // required for proper stackwalking of RuntimeStub frame
+
+ setup_arg_regs(4); // x => rdi, len => rsi, z => rdx
+ // zlen => rcx
+ // r9 and r10 may be used to save non-volatile registers
+ __ movptr(r8, rdx);
+ __ square_to_len(x, len, z, zlen, tmp1, tmp2, tmp3, tmp4, tmp5, rdx, rax);
+
+ restore_arg_regs();
+
+ __ leave(); // required for proper stackwalking of RuntimeStub frame
+ __ ret(0);
+
+ return start;
+ }
+
+ /**
+ * Arguments:
+ *
+ * Input:
+ * c_rarg0 - out address
+ * c_rarg1 - in address
+ * c_rarg2 - offset
+ * c_rarg3 - len
+ * not Win64
+ * c_rarg4 - k
+ * Win64
+ * rsp+40 - k
+ */
+ address generate_mulAdd() {
+ __ align(CodeEntryAlignment);
+ StubCodeMark mark(this, "StubRoutines", "mulAdd");
+
+ address start = __ pc();
+ // Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
+ // Unix: rdi, rsi, rdx, rcx, r8, r9 (c_rarg0, c_rarg1, ...)
+ const Register out = rdi;
+ const Register in = rsi;
+ const Register offset = r11;
+ const Register len = rcx;
+ const Register k = r8;
+
+ // Next registers will be saved on stack in mul_add().
+ const Register tmp1 = r12;
+ const Register tmp2 = r13;
+ const Register tmp3 = r14;
+ const Register tmp4 = r15;
+ const Register tmp5 = rbx;
+
+ BLOCK_COMMENT("Entry:");
+ __ enter(); // required for proper stackwalking of RuntimeStub frame
+
+ setup_arg_regs(4); // out => rdi, in => rsi, offset => rdx
+ // len => rcx, k => r8
+ // r9 and r10 may be used to save non-volatile registers
+#ifdef _WIN64
+ // last argument is on stack on Win64
+ __ movl(k, Address(rsp, 6 * wordSize));
+#endif
+ __ movptr(r11, rdx); // move offset in rdx to offset(r11)
+ __ mul_add(out, in, offset, len, k, tmp1, tmp2, tmp3, tmp4, tmp5, rdx, rax);
+
+ restore_arg_regs();
+
+ __ leave(); // required for proper stackwalking of RuntimeStub frame
+ __ ret(0);
+
+ return start;
+ }
+
+
#undef __
#define __ masm->
@@ -4030,6 +4131,12 @@
if (UseMultiplyToLenIntrinsic) {
StubRoutines::_multiplyToLen = generate_multiplyToLen();
}
+ if (UseSquareToLenIntrinsic) {
+ StubRoutines::_squareToLen = generate_squareToLen();
+ }
+ if (UseMulAddIntrinsic) {
+ StubRoutines::_mulAdd = generate_mulAdd();
+ }
#endif
}
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp Wed Jul 05 20:38:32 2017 +0200
@@ -33,7 +33,7 @@
enum platform_dependent_constants {
code_size1 = 19000, // simply increase if too small (assembler will crash if too small)
- code_size2 = 22000 // simply increase if too small (assembler will crash if too small)
+ code_size2 = 23000 // simply increase if too small (assembler will crash if too small)
};
class x86 {
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -790,6 +790,12 @@
if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
UseMultiplyToLenIntrinsic = true;
}
+ if (FLAG_IS_DEFAULT(UseSquareToLenIntrinsic)) {
+ UseSquareToLenIntrinsic = true;
+ }
+ if (FLAG_IS_DEFAULT(UseMulAddIntrinsic)) {
+ UseMulAddIntrinsic = true;
+ }
#else
if (UseMultiplyToLenIntrinsic) {
if (!FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
@@ -797,6 +803,18 @@
}
FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, false);
}
+ if (UseSquareToLenIntrinsic) {
+ if (!FLAG_IS_DEFAULT(UseSquareToLenIntrinsic)) {
+ warning("squareToLen intrinsic is not available in 32-bit VM");
+ }
+ FLAG_SET_DEFAULT(UseSquareToLenIntrinsic, false);
+ }
+ if (UseMulAddIntrinsic) {
+ if (!FLAG_IS_DEFAULT(UseMulAddIntrinsic)) {
+ warning("mulAdd intrinsic is not available in 32-bit VM");
+ }
+ FLAG_SET_DEFAULT(UseMulAddIntrinsic, false);
+ }
#endif
#endif // COMPILER2
--- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -59,8 +59,8 @@
extern sigjmp_buf* get_jmp_buf_for_continuation();
address os::current_stack_pointer() {
- address dummy = (address) &dummy;
- return dummy;
+ // return the address of the current function
+ return (address)__builtin_frame_address(0);
}
frame os::get_sender_for_C_frame(frame* fr) {
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Wed Jul 05 20:38:32 2017 +0200
@@ -799,6 +799,14 @@
do_name( multiplyToLen_name, "multiplyToLen") \
do_signature(multiplyToLen_signature, "([II[II[I)[I") \
\
+ do_intrinsic(_squareToLen, java_math_BigInteger, squareToLen_name, squareToLen_signature, F_S) \
+ do_name( squareToLen_name, "implSquareToLen") \
+ do_signature(squareToLen_signature, "([II[II)[I") \
+ \
+ do_intrinsic(_mulAdd, java_math_BigInteger, mulAdd_name, mulAdd_signature, F_S) \
+ do_name( mulAdd_name, "implMulAdd") \
+ do_signature(mulAdd_signature, "([I[IIII)I") \
+ \
/* java/lang/ref/Reference */ \
do_intrinsic(_Reference_get, java_lang_ref_Reference, get_name, void_object_signature, F_R) \
\
--- a/hotspot/src/share/vm/opto/c2_globals.hpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp Wed Jul 05 20:38:32 2017 +0200
@@ -665,6 +665,12 @@
product(bool, UseMultiplyToLenIntrinsic, false, \
"Enables intrinsification of BigInteger.multiplyToLen()") \
\
+ product(bool, UseSquareToLenIntrinsic, false, \
+ "Enables intrinsification of BigInteger.squareToLen()") \
+ \
+ product(bool, UseMulAddIntrinsic, false, \
+ "Enables intrinsification of BigInteger.mulAdd()") \
+ \
product(bool, UseTypeSpeculation, true, \
"Speculatively propagate types from profiles") \
\
--- a/hotspot/src/share/vm/opto/escape.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/escape.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -972,7 +972,9 @@
strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 ||
strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 ||
strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 ||
- strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0)
+ strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 ||
+ strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 ||
+ strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0)
))) {
call->dump();
fatal(err_msg_res("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name));
--- a/hotspot/src/share/vm/opto/ifnode.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/ifnode.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -817,19 +817,78 @@
BoolTest::mask hi_test = this_bool->_test._test;
BoolTest::mask cond = hi_test;
+ // convert:
+ //
+ // dom_bool = x {<,<=,>,>=} a
+ // / \
+ // proj = {True,False} / \ otherproj = {False,True}
+ // /
+ // this_bool = x {<,<=} b
+ // / \
+ // fail = {True,False} / \ success = {False,True}
+ // /
+ //
+ // (Second test guaranteed canonicalized, first one may not have
+ // been canonicalized yet)
+ //
+ // into:
+ //
+ // cond = (x - lo) {<u,<=u,>u,>=u} adjusted_lim
+ // / \
+ // fail / \ success
+ // /
+ //
+
// Figure out which of the two tests sets the upper bound and which
// sets the lower bound if any.
+ Node* adjusted_lim = NULL;
if (hi_type->_lo > lo_type->_hi && hi_type->_hi == max_jint && lo_type->_lo == min_jint) {
-
assert((dom_bool->_test.is_less() && !proj->_con) ||
(dom_bool->_test.is_greater() && proj->_con), "incorrect test");
// this test was canonicalized
assert(this_bool->_test.is_less() && fail->_con, "incorrect test");
+ // this_bool = <
+ // dom_bool = >= (proj = True) or dom_bool = < (proj = False)
+ // x in [a, b[ on the fail (= True) projection, b > a-1 (because of hi_type->_lo > lo_type->_hi test above):
+ // lo = a, hi = b, adjusted_lim = b-a, cond = <u
+ // dom_bool = > (proj = True) or dom_bool = <= (proj = False)
+ // x in ]a, b[ on the fail (= True) projection, b > a:
+ // lo = a+1, hi = b, adjusted_lim = b-a-1, cond = <u
+ // this_bool = <=
+ // dom_bool = >= (proj = True) or dom_bool = < (proj = False)
+ // x in [a, b] on the fail (= True) projection, b+1 > a-1:
+ // lo = a, hi = b, adjusted_lim = b-a, cond = <=u
+ // dom_bool = > (proj = True) or dom_bool = <= (proj = False)
+ // x in ]a, b] on the fail (= True) projection b+1 > a:
+ // lo = a+1, hi = b, adjusted_lim = b-a, cond = <u
+ // lo = a+1, hi = b, adjusted_lim = b-a-1, cond = <=u doesn't work because a = b is possible, then hi-lo = -1
+
if (lo_test == BoolTest::gt || lo_test == BoolTest::le) {
+ if (hi_test == BoolTest::le) {
+ adjusted_lim = igvn->transform(new SubINode(hi, lo));
+ cond = BoolTest::lt;
+ }
lo = igvn->transform(new AddINode(lo, igvn->intcon(1)));
}
} else if (lo_type->_lo > hi_type->_hi && lo_type->_hi == max_jint && hi_type->_lo == min_jint) {
+
+ // this_bool = <
+ // dom_bool = < (proj = True) or dom_bool = >= (proj = False)
+ // x in [b, a[ on the fail (= False) projection, a > b-1 (because of lo_type->_lo > hi_type->_hi above):
+ // lo = b, hi = a, adjusted_lim = a-b, cond = >=u
+ // dom_bool = <= (proj = True) or dom_bool = > (proj = False)
+ // x in [b, a] on the fail (= False) projection, a+1 > b-1:
+ // lo = b, hi = a, adjusted_lim = a-b, cond = >u
+ // this_bool = <=
+ // dom_bool = < (proj = True) or dom_bool = >= (proj = False)
+ // x in ]b, a[ on the fail (= False) projection, a > b:
+ // lo = b+1, hi = a, adjusted_lim = a-b-1, cond = >=u
+ // dom_bool = <= (proj = True) or dom_bool = > (proj = False)
+ // x in ]b, a] on the fail (= False) projection, a+1 > b:
+ // lo = b+1, hi = a, adjusted_lim = a-b, cond = >=u
+ // lo = b+1, hi = a, adjusted_lim = a-b-1, cond = >u doesn't work because a = b is possible, then hi-lo = -1
+
swap(lo, hi);
swap(lo_type, hi_type);
swap(lo_test, hi_test);
@@ -842,6 +901,10 @@
cond = (hi_test == BoolTest::le || hi_test == BoolTest::gt) ? BoolTest::gt : BoolTest::ge;
if (lo_test == BoolTest::le) {
+ if (cond == BoolTest::gt) {
+ adjusted_lim = igvn->transform(new SubINode(hi, lo));
+ cond = BoolTest::ge;
+ }
lo = igvn->transform(new AddINode(lo, igvn->intcon(1)));
}
@@ -860,7 +923,6 @@
}
}
}
-
lo = NULL;
hi = NULL;
}
@@ -868,12 +930,13 @@
if (lo && hi) {
// Merge the two compares into a single unsigned compare by building (CmpU (n - lo) (hi - lo))
Node* adjusted_val = igvn->transform(new SubINode(n, lo));
- Node* adjusted_lim = igvn->transform(new SubINode(hi, lo));
+ if (adjusted_lim == NULL) {
+ adjusted_lim = igvn->transform(new SubINode(hi, lo));
+ }
Node* newcmp = igvn->transform(new CmpUNode(adjusted_val, adjusted_lim));
Node* newbool = igvn->transform(new BoolNode(newcmp, cond));
- igvn->is_IterGVN()->replace_input_of(dom_iff, 1, igvn->intcon(proj->_con));
- igvn->hash_delete(this);
+ igvn->replace_input_of(dom_iff, 1, igvn->intcon(proj->_con));
set_req(1, newbool);
return true;
--- a/hotspot/src/share/vm/opto/library_call.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -291,6 +291,8 @@
bool inline_updateBytesCRC32();
bool inline_updateByteBufferCRC32();
bool inline_multiplyToLen();
+ bool inline_squareToLen();
+ bool inline_mulAdd();
bool inline_profileBoolean();
bool inline_isCompileConstant();
@@ -494,6 +496,14 @@
if (!UseMultiplyToLenIntrinsic) return NULL;
break;
+ case vmIntrinsics::_squareToLen:
+ if (!UseSquareToLenIntrinsic) return NULL;
+ break;
+
+ case vmIntrinsics::_mulAdd:
+ if (!UseMulAddIntrinsic) return NULL;
+ break;
+
case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
if (!UseAESIntrinsics) return NULL;
@@ -913,6 +923,12 @@
case vmIntrinsics::_multiplyToLen:
return inline_multiplyToLen();
+ case vmIntrinsics::_squareToLen:
+ return inline_squareToLen();
+
+ case vmIntrinsics::_mulAdd:
+ return inline_mulAdd();
+
case vmIntrinsics::_encodeISOArray:
return inline_encodeISOArray();
@@ -5306,6 +5322,100 @@
return true;
}
+//-------------inline_squareToLen------------------------------------
+bool LibraryCallKit::inline_squareToLen() {
+ assert(UseSquareToLenIntrinsic, "not implementated on this platform");
+
+ address stubAddr = StubRoutines::squareToLen();
+ if (stubAddr == NULL) {
+ return false; // Intrinsic's stub is not implemented on this platform
+ }
+ const char* stubName = "squareToLen";
+
+ assert(callee()->signature()->size() == 4, "implSquareToLen has 4 parameters");
+
+ Node* x = argument(0);
+ Node* len = argument(1);
+ Node* z = argument(2);
+ Node* zlen = argument(3);
+
+ const Type* x_type = x->Value(&_gvn);
+ const Type* z_type = z->Value(&_gvn);
+ const TypeAryPtr* top_x = x_type->isa_aryptr();
+ const TypeAryPtr* top_z = z_type->isa_aryptr();
+ if (top_x == NULL || top_x->klass() == NULL ||
+ top_z == NULL || top_z->klass() == NULL) {
+ // failed array check
+ return false;
+ }
+
+ BasicType x_elem = x_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
+ BasicType z_elem = z_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
+ if (x_elem != T_INT || z_elem != T_INT) {
+ return false;
+ }
+
+
+ Node* x_start = array_element_address(x, intcon(0), x_elem);
+ Node* z_start = array_element_address(z, intcon(0), z_elem);
+
+ Node* call = make_runtime_call(RC_LEAF|RC_NO_FP,
+ OptoRuntime::squareToLen_Type(),
+ stubAddr, stubName, TypePtr::BOTTOM,
+ x_start, len, z_start, zlen);
+
+ set_result(z);
+ return true;
+}
+
+//-------------inline_mulAdd------------------------------------------
+bool LibraryCallKit::inline_mulAdd() {
+ assert(UseMulAddIntrinsic, "not implementated on this platform");
+
+ address stubAddr = StubRoutines::mulAdd();
+ if (stubAddr == NULL) {
+ return false; // Intrinsic's stub is not implemented on this platform
+ }
+ const char* stubName = "mulAdd";
+
+ assert(callee()->signature()->size() == 5, "mulAdd has 5 parameters");
+
+ Node* out = argument(0);
+ Node* in = argument(1);
+ Node* offset = argument(2);
+ Node* len = argument(3);
+ Node* k = argument(4);
+
+ const Type* out_type = out->Value(&_gvn);
+ const Type* in_type = in->Value(&_gvn);
+ const TypeAryPtr* top_out = out_type->isa_aryptr();
+ const TypeAryPtr* top_in = in_type->isa_aryptr();
+ if (top_out == NULL || top_out->klass() == NULL ||
+ top_in == NULL || top_in->klass() == NULL) {
+ // failed array check
+ return false;
+ }
+
+ BasicType out_elem = out_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
+ BasicType in_elem = in_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
+ if (out_elem != T_INT || in_elem != T_INT) {
+ return false;
+ }
+
+ Node* outlen = load_array_length(out);
+ Node* new_offset = _gvn.transform(new SubINode(outlen, offset));
+ Node* out_start = array_element_address(out, intcon(0), out_elem);
+ Node* in_start = array_element_address(in, intcon(0), in_elem);
+
+ Node* call = make_runtime_call(RC_LEAF|RC_NO_FP,
+ OptoRuntime::mulAdd_Type(),
+ stubAddr, stubName, TypePtr::BOTTOM,
+ out_start,in_start, new_offset, len, k);
+ Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
+ set_result(result);
+ return true;
+}
+
/**
* Calculate CRC32 for byte.
--- a/hotspot/src/share/vm/opto/loopTransform.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -475,7 +475,7 @@
C->set_major_progress();
// Peeling a 'main' loop in a pre/main/post situation obfuscates the
- // 'pre' loop from the main and the 'pre' can no longer have it's
+ // 'pre' loop from the main and the 'pre' can no longer have its
// iterations adjusted. Therefore, we need to declare this loop as
// no longer a 'main' loop; it will need new pre and post loops before
// we can do further RCE.
@@ -1911,10 +1911,13 @@
return;
assert(opqzm->in(1) == main_limit, "do not understand situation");
- // Find the pre-loop limit; we will expand it's iterations to
+ // Find the pre-loop limit; we will expand its iterations to
// not ever trip low tests.
Node *p_f = iffm->in(0);
- assert(p_f->Opcode() == Op_IfFalse, "");
+ // pre loop may have been optimized out
+ if (p_f->Opcode() != Op_IfFalse) {
+ return;
+ }
CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd();
assert(pre_end->loopnode()->is_pre_loop(), "");
Node *pre_opaq1 = pre_end->limit();
@@ -2215,6 +2218,56 @@
}
}
+#ifdef ASSERT
+static CountedLoopNode* locate_pre_from_main(CountedLoopNode *cl) {
+ Node *ctrl = cl->in(LoopNode::EntryControl);
+ assert(ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, "");
+ Node *iffm = ctrl->in(0);
+ assert(iffm->Opcode() == Op_If, "");
+ Node *p_f = iffm->in(0);
+ assert(p_f->Opcode() == Op_IfFalse, "");
+ CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd();
+ assert(pre_end->loopnode()->is_pre_loop(), "");
+ return pre_end->loopnode();
+}
+#endif
+
+// Remove the main and post loops and make the pre loop execute all
+// iterations. Useful when the pre loop is found empty.
+void IdealLoopTree::remove_main_post_loops(CountedLoopNode *cl, PhaseIdealLoop *phase) {
+ CountedLoopEndNode* pre_end = cl->loopexit();
+ Node* pre_cmp = pre_end->cmp_node();
+ if (pre_cmp->in(2)->Opcode() != Op_Opaque1) {
+ // Only safe to remove the main loop if the compiler optimized it
+ // out based on an unknown number of iterations
+ return;
+ }
+
+ // Can we find the main loop?
+ if (_next == NULL) {
+ return;
+ }
+
+ Node* next_head = _next->_head;
+ if (!next_head->is_CountedLoop()) {
+ return;
+ }
+
+ CountedLoopNode* main_head = next_head->as_CountedLoop();
+ if (!main_head->is_main_loop()) {
+ return;
+ }
+
+ assert(locate_pre_from_main(main_head) == cl, "bad main loop");
+ Node* main_iff = main_head->in(LoopNode::EntryControl)->in(0);
+
+ // Remove the Opaque1Node of the pre loop and make it execute all iterations
+ phase->_igvn.replace_input_of(pre_cmp, 2, pre_cmp->in(2)->in(2));
+ // Remove the Opaque1Node of the main loop so it can be optimized out
+ Node* main_cmp = main_iff->in(1)->in(1);
+ assert(main_cmp->in(2)->Opcode() == Op_Opaque1, "main loop has no opaque node?");
+ phase->_igvn.replace_input_of(main_cmp, 2, main_cmp->in(2)->in(1));
+}
//------------------------------policy_do_remove_empty_loop--------------------
// Micro-benchmark spamming. Policy is to always remove empty loops.
@@ -2233,6 +2286,12 @@
if (!phase->is_member(this, phase->get_ctrl(cl->loopexit()->in(CountedLoopEndNode::TestValue))))
return false; // Infinite loop
+ if (cl->is_pre_loop()) {
+ // If the loop we are removing is a pre-loop then the main and
+ // post loop can be removed as well
+ remove_main_post_loops(cl, phase);
+ }
+
#ifdef ASSERT
// Ensure only one phi which is the iv.
Node* iv = NULL;
--- a/hotspot/src/share/vm/opto/loopnode.hpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/loopnode.hpp Wed Jul 05 20:38:32 2017 +0200
@@ -485,6 +485,8 @@
bool is_inner() { return is_loop() && _child == NULL; }
bool is_counted() { return is_loop() && _head != NULL && _head->is_CountedLoop(); }
+ void remove_main_post_loops(CountedLoopNode *cl, PhaseIdealLoop *phase);
+
#ifndef PRODUCT
void dump_head( ) const; // Dump loop head only
void dump() const; // Dump this loop recursively
--- a/hotspot/src/share/vm/opto/runtime.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/runtime.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -945,6 +945,48 @@
return TypeFunc::make(domain, range);
}
+const TypeFunc* OptoRuntime::squareToLen_Type() {
+ // create input type (domain)
+ int num_args = 4;
+ int argcnt = num_args;
+ const Type** fields = TypeTuple::fields(argcnt);
+ int argp = TypeFunc::Parms;
+ fields[argp++] = TypePtr::NOTNULL; // x
+ fields[argp++] = TypeInt::INT; // len
+ fields[argp++] = TypePtr::NOTNULL; // z
+ fields[argp++] = TypeInt::INT; // zlen
+ assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
+ const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
+
+ // no result type needed
+ fields = TypeTuple::fields(1);
+ fields[TypeFunc::Parms+0] = NULL;
+ const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields);
+ return TypeFunc::make(domain, range);
+}
+
+// for mulAdd calls, 2 pointers and 3 ints, returning int
+const TypeFunc* OptoRuntime::mulAdd_Type() {
+ // create input type (domain)
+ int num_args = 5;
+ int argcnt = num_args;
+ const Type** fields = TypeTuple::fields(argcnt);
+ int argp = TypeFunc::Parms;
+ fields[argp++] = TypePtr::NOTNULL; // out
+ fields[argp++] = TypePtr::NOTNULL; // in
+ fields[argp++] = TypeInt::INT; // offset
+ fields[argp++] = TypeInt::INT; // len
+ fields[argp++] = TypeInt::INT; // k
+ assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
+ const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
+
+ // returning carry (int)
+ fields = TypeTuple::fields(1);
+ fields[TypeFunc::Parms+0] = TypeInt::INT;
+ const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields);
+ return TypeFunc::make(domain, range);
+}
+
//------------- Interpreter state access for on stack replacement
--- a/hotspot/src/share/vm/opto/runtime.hpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/runtime.hpp Wed Jul 05 20:38:32 2017 +0200
@@ -312,6 +312,10 @@
static const TypeFunc* multiplyToLen_Type();
+ static const TypeFunc* squareToLen_Type();
+
+ static const TypeFunc* mulAdd_Type();
+
static const TypeFunc* updateBytesCRC32_Type();
// leaf on stack replacement interpreter accessor types
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -137,6 +137,8 @@
address StubRoutines::_crc_table_adr = NULL;
address StubRoutines::_multiplyToLen = NULL;
+address StubRoutines::_squareToLen = NULL;
+address StubRoutines::_mulAdd = NULL;
double (* StubRoutines::_intrinsic_log )(double) = NULL;
double (* StubRoutines::_intrinsic_log10 )(double) = NULL;
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp Wed Jul 05 20:38:32 2017 +0200
@@ -197,6 +197,8 @@
static address _crc_table_adr;
static address _multiplyToLen;
+ static address _squareToLen;
+ static address _mulAdd;
// These are versions of the java.lang.Math methods which perform
// the same operations as the intrinsic version. They are used for
@@ -356,6 +358,8 @@
static address crc_table_addr() { return _crc_table_adr; }
static address multiplyToLen() {return _multiplyToLen; }
+ static address squareToLen() {return _squareToLen; }
+ static address mulAdd() {return _mulAdd; }
static address select_fill_function(BasicType t, bool aligned, const char* &name);
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -831,6 +831,8 @@
static_field(StubRoutines, _updateBytesCRC32, address) \
static_field(StubRoutines, _crc_table_adr, address) \
static_field(StubRoutines, _multiplyToLen, address) \
+ static_field(StubRoutines, _squareToLen, address) \
+ static_field(StubRoutines, _mulAdd, address) \
\
/*****************/ \
/* SharedRuntime */ \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/muladd/TestMulAdd.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8081778
+ * @summary Add C2 x86 intrinsic for BigInteger::mulAdd() method
+ *
+ * @run main/othervm/timeout=600 -XX:-TieredCompilation -Xbatch
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:-UseSquareToLenIntrinsic -XX:-UseMultiplyToLenIntrinsic
+ * -XX:CompileCommand=dontinline,TestMulAdd::main
+ * -XX:CompileCommand=option,TestMulAdd::base_multiply,ccstr,DisableIntrinsic,_mulAdd
+ * -XX:CompileCommand=option,java.math.BigInteger::multiply,ccstr,DisableIntrinsic,_mulAdd
+ * -XX:CompileCommand=option,java.math.BigInteger::square,ccstr,DisableIntrinsic,_mulAdd
+ * -XX:CompileCommand=option,java.math.BigInteger::squareToLen,ccstr,DisableIntrinsic,_mulAdd
+ * -XX:CompileCommand=option,java.math.BigInteger::mulAdd,ccstr,DisableIntrinsic,_mulAdd
+ * -XX:CompileCommand=inline,java.math.BigInteger::multiply
+ * -XX:CompileCommand=inline,java.math.BigInteger::square
+ * -XX:CompileCommand=inline,java.math.BigInteger::squareToLen
+ * -XX:CompileCommand=inline,java.math.BigInteger::mulAdd TestMulAdd
+ */
+
+import java.util.Random;
+import java.math.*;
+
+public class TestMulAdd {
+
+ // Avoid intrinsic by preventing inlining multiply() and mulAdd().
+ public static BigInteger base_multiply(BigInteger op1) {
+ return op1.multiply(op1);
+ }
+
+ // Generate mulAdd() intrinsic by inlining multiply().
+ public static BigInteger new_multiply(BigInteger op1) {
+ return op1.multiply(op1);
+ }
+
+ public static boolean bytecompare(BigInteger b1, BigInteger b2) {
+ byte[] data1 = b1.toByteArray();
+ byte[] data2 = b2.toByteArray();
+ if (data1.length != data2.length)
+ return false;
+ for (int i = 0; i < data1.length; i++) {
+ if (data1[i] != data2[i])
+ return false;
+ }
+ return true;
+ }
+
+ public static String stringify(BigInteger b) {
+ String strout= "";
+ byte [] data = b.toByteArray();
+ for (int i = 0; i < data.length; i++) {
+ strout += (String.format("%02x",data[i]) + " ");
+ }
+ return strout;
+ }
+
+ public static void main(String args[]) throws Exception {
+
+ BigInteger oldsum = new BigInteger("0");
+ BigInteger newsum = new BigInteger("0");
+
+ BigInteger b1, b2, oldres, newres;
+
+ Random rand = new Random();
+ long seed = System.nanoTime();
+ Random rand1 = new Random();
+ long seed1 = System.nanoTime();
+ rand.setSeed(seed);
+ rand1.setSeed(seed1);
+
+ for (int j = 0; j < 100000; j++) {
+ int rand_int = rand1.nextInt(3136)+32;
+ b1 = new BigInteger(rand_int, rand);
+
+ oldres = base_multiply(b1);
+ newres = new_multiply(b1);
+
+ oldsum = oldsum.add(oldres);
+ newsum = newsum.add(newres);
+
+ if (!bytecompare(oldres,newres)) {
+ System.out.print("mismatch for:b1:" + stringify(b1) + " :oldres:" + stringify(oldres) + " :newres:" + stringify(newres));
+ System.out.println(b1);
+ throw new Exception("Failed");
+ }
+ }
+ if (!bytecompare(oldsum,newsum)) {
+ System.out.println("Failure: oldsum:" + stringify(oldsum) + " newsum:" + stringify(newsum));
+ throw new Exception("Failed");
+ } else {
+ System.out.println("Success");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/squaretolen/TestSquareToLen.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8081778
+ * @summary Add C2 x86 intrinsic for BigInteger::squareToLen() method
+ *
+ * @run main/othervm/timeout=600 -XX:-TieredCompilation -Xbatch
+ * -XX:CompileCommand=exclude,TestSquareToLen::main
+ * -XX:CompileCommand=option,TestSquareToLen::base_multiply,ccstr,DisableIntrinsic,_squareToLen
+ * -XX:CompileCommand=option,java.math.BigInteger::multiply,ccstr,DisableIntrinsic,_squareToLen
+ * -XX:CompileCommand=option,java.math.BigInteger::square,ccstr,DisableIntrinsic,_squareToLen
+ * -XX:CompileCommand=option,java.math.BigInteger::squareToLen,ccstr,DisableIntrinsic,_squareToLen
+ * -XX:CompileCommand=inline,java.math.BigInteger::multiply
+ * -XX:CompileCommand=inline,java.math.BigInteger::square
+ * -XX:CompileCommand=inline,java.math.BigInteger::squareToLen TestSquareToLen
+ */
+
+import java.util.Random;
+import java.math.*;
+
+public class TestSquareToLen {
+
+ // Avoid intrinsic by preventing inlining multiply() and squareToLen().
+ public static BigInteger base_multiply(BigInteger op1) {
+ return op1.multiply(op1);
+ }
+
+ // Generate squareToLen() intrinsic by inlining multiply().
+ public static BigInteger new_multiply(BigInteger op1) {
+ return op1.multiply(op1);
+ }
+
+ public static boolean bytecompare(BigInteger b1, BigInteger b2) {
+ byte[] data1 = b1.toByteArray();
+ byte[] data2 = b2.toByteArray();
+ if (data1.length != data2.length)
+ return false;
+ for (int i = 0; i < data1.length; i++) {
+ if (data1[i] != data2[i])
+ return false;
+ }
+ return true;
+ }
+
+ public static String stringify(BigInteger b) {
+ String strout= "";
+ byte [] data = b.toByteArray();
+ for (int i = 0; i < data.length; i++) {
+ strout += (String.format("%02x",data[i]) + " ");
+ }
+ return strout;
+ }
+
+ public static void main(String args[]) throws Exception {
+
+ BigInteger oldsum = new BigInteger("0");
+ BigInteger newsum = new BigInteger("0");
+
+ BigInteger b1, b2, oldres, newres;
+
+ Random rand = new Random();
+ long seed = System.nanoTime();
+ Random rand1 = new Random();
+ long seed1 = System.nanoTime();
+ rand.setSeed(seed);
+ rand1.setSeed(seed1);
+
+ for (int j = 0; j < 100000; j++) {
+ int rand_int = rand1.nextInt(3136)+32;
+ b1 = new BigInteger(rand_int, rand);
+
+ oldres = base_multiply(b1);
+ newres = new_multiply(b1);
+
+ oldsum = oldsum.add(oldres);
+ newsum = newsum.add(newres);
+
+ if (!bytecompare(oldres,newres)) {
+ System.out.print("mismatch for:b1:" + stringify(b1) + " :oldres:" + stringify(oldres) + " :newres:" + stringify(newres));
+ System.out.println(b1);
+ throw new Exception("Failed");
+ }
+ }
+ if (!bytecompare(oldsum,newsum)) {
+ System.out.println("Failure: oldsum:" + stringify(oldsum) + " newsum:" + stringify(newsum));
+ throw new Exception("Failed");
+ } else {
+ System.out.println("Success");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/rangechecks/TestBadFoldCompare.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085832
+ * @summary x <= 0 || x > 0 wrongly folded as (x-1) >u -1
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestBadFoldCompare
+ */
+
+public class TestBadFoldCompare {
+
+ static boolean test1_taken;
+
+ static void helper1(int i, int a, int b, boolean flag) {
+ if (flag) {
+ if (i <= a || i > b) {
+ test1_taken = true;
+ }
+ }
+ }
+
+ static void test1(int i, boolean flag) {
+ helper1(i, 0, 0, flag);
+ }
+
+ static boolean test2_taken;
+
+ static void helper2(int i, int a, int b, boolean flag) {
+ if (flag) {
+ if (i > b || i <= a) {
+ test2_taken = true;
+ }
+ }
+ }
+
+ static void test2(int i, boolean flag) {
+ helper2(i, 0, 0, flag);
+ }
+
+ static public void main(String[] args) {
+ boolean success = true;
+
+ for (int i = 0; i < 20000; i++) {
+ helper1(5, 0, 10, (i%2)==0);
+ helper1(-1, 0, 10, (i%2)==0);
+ helper1(15, 0, 10, (i%2)==0);
+ test1(0, false);
+ }
+ test1_taken = false;
+ test1(0, true);
+ if (!test1_taken) {
+ System.out.println("Test1 failed");
+ success = false;
+ }
+
+ for (int i = 0; i < 20000; i++) {
+ helper2(5, 0, 10, (i%2)==0);
+ helper2(-1, 0, 10, (i%2)==0);
+ helper2(15, 0, 10, (i%2)==0);
+ test2(0, false);
+ }
+ test2_taken = false;
+ test2(0, true);
+
+ if (!test2_taken) {
+ System.out.println("Test2 failed");
+ success = false;
+ }
+ if (!success) {
+ throw new RuntimeException("Some tests failed");
+ }
+ }
+}
--- a/jdk/.hgtags Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/.hgtags Wed Jul 05 20:38:32 2017 +0200
@@ -311,3 +311,4 @@
4fbcca8ab812198c7fb747ea7b213b6e404f36e9 jdk9-b66
1abd45df5480a04bff98fba1851d66a5230e67d4 jdk9-b67
046fd17bb9a0cdf6681124866df9626d17b0516a jdk9-b68
+551323004d0ce2f1d4b0e99552f7e0cdcebc6fca jdk9-b69
--- a/jdk/make/lib/Awt2dLibraries.gmk Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/make/lib/Awt2dLibraries.gmk Wed Jul 05 20:38:32 2017 +0200
@@ -54,7 +54,7 @@
OPTIMIZATION := HIGHEST, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(BUILD_LIBMLIB_CFLAGS), \
- DISABLED_WARNINGS_gcc := parentheses, \
+ DISABLED_WARNINGS_gcc := parentheses array-bounds, \
DISABLED_WARNINGS_clang := parentheses, \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
@@ -491,10 +491,10 @@
SRC := $(LIBJAVAJPEG_SRC), \
INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
OPTIMIZATION := HIGHEST, \
- CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJAVAJPEG_SRC)) \
+ CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBJAVAJPEG_HEADERS) \
$(LIBJAVA_HEADER_FLAGS) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
- DISABLED_WARNINGS_gcc := clobbered parentheses, \
+ DISABLED_WARNINGS_gcc := clobbered parentheses array-bounds, \
DISABLED_WARNINGS_clang := logical-op-parentheses, \
DISABLED_WARNINGS_microsoft := 4267, \
MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
--- a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1447,7 +1447,7 @@
throw new NullPointerException("package name can't be null");
}
- String[] pkgs;
+ String[] restrictedPkgs;
synchronized (packageAccessLock) {
/*
* Do we need to update our property array?
@@ -1457,8 +1457,7 @@
AccessController.doPrivileged(
new PrivilegedAction<>() {
public String run() {
- return java.security.Security.getProperty(
- "package.access");
+ return Security.getProperty("package.access");
}
}
);
@@ -1468,14 +1467,33 @@
// Using a snapshot of packageAccess -- don't care if static field
// changes afterwards; array contents won't change.
- pkgs = packageAccess;
+ restrictedPkgs = packageAccess;
}
/*
* Traverse the list of packages, check for any matches.
*/
- for (String restrictedPkg : pkgs) {
- if (pkg.startsWith(restrictedPkg) || restrictedPkg.equals(pkg + ".")) {
+ final int plen = pkg.length();
+ for (String restrictedPkg : restrictedPkgs) {
+ final int rlast = restrictedPkg.length() - 1;
+
+ // Optimizations:
+ //
+ // If rlast >= plen then restrictedPkg is longer than pkg by at
+ // least one char. This means pkg cannot start with restrictedPkg,
+ // since restrictedPkg will be longer than pkg.
+ //
+ // Similarly if rlast != plen, then pkg + "." cannot be the same
+ // as restrictedPkg, since pkg + "." will have a different length
+ // than restrictedPkg.
+ //
+ if (rlast < plen && pkg.startsWith(restrictedPkg) ||
+ // The following test is equivalent to
+ // restrictedPkg.equals(pkg + ".") but is noticeably more
+ // efficient:
+ rlast == plen && restrictedPkg.startsWith(pkg) &&
+ restrictedPkg.charAt(rlast) == '.')
+ {
checkPermission(
new RuntimePermission("accessClassInPackage." + pkg));
break; // No need to continue; only need to check this once
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,7 @@
* Returns the potentially annotated generic component type of this array type.
*
* @return the potentially annotated generic component type of this array type
+ * @see GenericArrayType#getGenericComponentType()
*/
AnnotatedType getAnnotatedGenericComponentType();
}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
* Returns the potentially annotated actual type arguments of this parameterized type.
*
* @return the potentially annotated actual type arguments of this parameterized type
+ * @see ParameterizedType#getActualTypeArguments()
*/
AnnotatedType[] getAnnotatedActualTypeArguments();
}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,11 @@
/**
* Returns the potentially annotated bounds of this type variable.
+ * If no bound is explicitly declared, the bound is unannotated
+ * {@code Object}.
*
* @return the potentially annotated bounds of this type variable
+ * @see TypeVariable#getBounds()
*/
AnnotatedType[] getAnnotatedBounds();
}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,15 +36,22 @@
/**
* Returns the potentially annotated lower bounds of this wildcard type.
+ * If no lower bound is explicitly declared, the lower bound is the
+ * type of null. In this case, a zero length array is returned.
*
- * @return the potentially annotated lower bounds of this wildcard type
+ * @return the potentially annotated lower bounds of this wildcard type or
+ * an empty array if no lower bound is explicitly declared.
+ * @see WildcardType#getLowerBounds()
*/
AnnotatedType[] getAnnotatedLowerBounds();
/**
* Returns the potentially annotated upper bounds of this wildcard type.
+ * If no upper bound is explicitly declared, the upper bound is
+ * unannotated {@code Object}
*
* @return the potentially annotated upper bounds of this wildcard type
+ * @see WildcardType#getUpperBounds()
*/
AnnotatedType[] getAnnotatedUpperBounds();
}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/TypeVariable.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/TypeVariable.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
public interface TypeVariable<D extends GenericDeclaration> extends Type, AnnotatedElement {
/**
* Returns an array of {@code Type} objects representing the
- * upper bound(s) of this type variable. Note that if no upper bound is
+ * upper bound(s) of this type variable. If no upper bound is
* explicitly declared, the upper bound is {@code Object}.
*
* <p>For each upper bound B: <ul> <li>if B is a parameterized
@@ -67,7 +67,7 @@
* for any reason
* @return an array of {@code Type}s representing the upper
* bound(s) of this type variable
- */
+ */
Type[] getBounds();
/**
@@ -91,11 +91,11 @@
* Returns an array of AnnotatedType objects that represent the use of
* types to denote the upper bounds of the type parameter represented by
* this TypeVariable. The order of the objects in the array corresponds to
- * the order of the bounds in the declaration of the type parameter.
+ * the order of the bounds in the declaration of the type parameter. Note that
+ * if no upper bound is explicitly declared, the upper bound is unannotated
+ * {@code Object}.
*
- * Returns an array of length 0 if the type parameter declares no bounds.
- *
- * @return an array of objects representing the upper bounds of the type variable
+ * @return an array of objects representing the upper bound(s) of the type variable
* @since 1.8
*/
AnnotatedType[] getAnnotatedBounds();
--- a/jdk/src/java.base/share/classes/java/lang/reflect/WildcardType.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/WildcardType.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
public interface WildcardType extends Type {
/**
* Returns an array of {@code Type} objects representing the upper
- * bound(s) of this type variable. Note that if no upper bound is
+ * bound(s) of this type variable. If no upper bound is
* explicitly declared, the upper bound is {@code Object}.
*
* <p>For each upper bound B :
@@ -57,7 +57,7 @@
/**
* Returns an array of {@code Type} objects representing the
- * lower bound(s) of this type variable. Note that if no lower bound is
+ * lower bound(s) of this type variable. If no lower bound is
* explicitly declared, the lower bound is the type of {@code null}.
* In this case, a zero length array is returned.
*
--- a/jdk/src/java.base/share/classes/java/math/BigInteger.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java Wed Jul 05 20:38:32 2017 +0200
@@ -1963,6 +1963,43 @@
* int array z. The contents of x are not changed.
*/
private static final int[] squareToLen(int[] x, int len, int[] z) {
+ int zlen = len << 1;
+ if (z == null || z.length < zlen)
+ z = new int[zlen];
+
+ // Execute checks before calling intrinsified method.
+ implSquareToLenChecks(x, len, z, zlen);
+ return implSquareToLen(x, len, z, zlen);
+ }
+
+ /**
+ * Parameters validation.
+ */
+ private static void implSquareToLenChecks(int[] x, int len, int[] z, int zlen) throws RuntimeException {
+ if (len < 1) {
+ throw new IllegalArgumentException("invalid input length: " + len);
+ }
+ if (len > x.length) {
+ throw new IllegalArgumentException("input length out of bound: " +
+ len + " > " + x.length);
+ }
+ if (len * 2 > z.length) {
+ throw new IllegalArgumentException("input length out of bound: " +
+ (len * 2) + " > " + z.length);
+ }
+ if (zlen < 1) {
+ throw new IllegalArgumentException("invalid input length: " + zlen);
+ }
+ if (zlen > z.length) {
+ throw new IllegalArgumentException("input length out of bound: " +
+ len + " > " + z.length);
+ }
+ }
+
+ /**
+ * Java Runtime may use intrinsic for this method.
+ */
+ private static final int[] implSquareToLen(int[] x, int len, int[] z, int zlen) {
/*
* The algorithm used here is adapted from Colin Plumb's C library.
* Technique: Consider the partial products in the multiplication
@@ -1997,9 +2034,6 @@
* again. The low bit is simply a copy of the low bit of the
* input, so it doesn't need special care.
*/
- int zlen = len << 1;
- if (z == null || z.length < zlen)
- z = new int[zlen];
// Store the squares, right shifted one bit (i.e., divided by 2)
int lastProductLowWord = 0;
@@ -2857,6 +2891,32 @@
* Multiply an array by one word k and add to result, return the carry
*/
static int mulAdd(int[] out, int[] in, int offset, int len, int k) {
+ implMulAddCheck(out, in, offset, len, k);
+ return implMulAdd(out, in, offset, len, k);
+ }
+
+ /**
+ * Parameters validation.
+ */
+ private static void implMulAddCheck(int[] out, int[] in, int offset, int len, int k) {
+ if (len > in.length) {
+ throw new IllegalArgumentException("input length is out of bound: " + len + " > " + in.length);
+ }
+ if (offset < 0) {
+ throw new IllegalArgumentException("input offset is invalid: " + offset);
+ }
+ if (offset > (out.length - 1)) {
+ throw new IllegalArgumentException("input offset is out of bound: " + offset + " > " + (out.length - 1));
+ }
+ if (len > (out.length - offset)) {
+ throw new IllegalArgumentException("input len is out of bound: " + len + " > " + (out.length - offset));
+ }
+ }
+
+ /**
+ * Java Runtime may use intrinsic for this method.
+ */
+ private static int implMulAdd(int[] out, int[] in, int offset, int len, int k) {
long kLong = k & LONG_MASK;
long carry = 0;
--- a/jdk/src/java.base/share/classes/java/security/CodeSource.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/CodeSource.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.cert.*;
+import sun.net.util.URLUtil;
/**
*
@@ -73,6 +74,15 @@
private transient CertificateFactory factory = null;
/**
+ * A String form of the URL for use as a key in HashMaps/Sets. The String
+ * form should be behave in the same manner as the URL when compared for
+ * equality in a HashMap/Set, except that no nameservice lookup is done
+ * on the hostname (only string comparison), and the fragment is not
+ * considered.
+ */
+ private transient String locationNoFragString;
+
+ /**
* Constructs a CodeSource and associates it with the specified
* location and set of certificates.
*
@@ -83,6 +93,9 @@
*/
public CodeSource(URL url, java.security.cert.Certificate certs[]) {
this.location = url;
+ if (url != null) {
+ this.locationNoFragString = URLUtil.urlNoFragString(url);
+ }
// Copy the supplied certs
if (certs != null) {
@@ -102,6 +115,9 @@
*/
public CodeSource(URL url, CodeSigner[] signers) {
this.location = url;
+ if (url != null) {
+ this.locationNoFragString = URLUtil.urlNoFragString(url);
+ }
// Copy the supplied signers
if (signers != null) {
@@ -169,6 +185,13 @@
}
/**
+ * Returns a String form of the URL for use as a key in HashMaps/Sets.
+ */
+ String getLocationNoFragString() {
+ return locationNoFragString;
+ }
+
+ /**
* Returns the certificates associated with this CodeSource.
* <p>
* If this CodeSource object was created using the
@@ -588,6 +611,10 @@
} catch (IOException ioe) {
// no signers present
}
+
+ if (location != null) {
+ locationNoFragString = URLUtil.urlNoFragString(location);
+ }
}
/*
--- a/jdk/src/java.base/share/classes/java/security/SecureClassLoader.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/SecureClassLoader.java Wed Jul 05 20:38:32 2017 +0200
@@ -25,9 +25,11 @@
package java.security;
-import java.util.HashMap;
+import java.util.Map;
import java.util.ArrayList;
import java.net.URL;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
import sun.security.util.Debug;
@@ -47,10 +49,17 @@
*/
private final boolean initialized;
- // HashMap that maps CodeSource to ProtectionDomain
- // @GuardedBy("pdcache")
- private final HashMap<CodeSource, ProtectionDomain> pdcache =
- new HashMap<>(11);
+ /*
+ * Map that maps the CodeSource URL (as a String) to ProtectionDomain.
+ * We use a String instead of a CodeSource/URL as the key to avoid
+ * potential expensive name service lookups. This does mean that URLs that
+ * are equivalent after nameservice lookup will be placed in separate
+ * ProtectionDomains; however during policy enforcement these URLs will be
+ * canonicalized and resolved resulting in a consistent set of granted
+ * permissions.
+ */
+ private final Map<String, ProtectionDomain> pdcache
+ = new ConcurrentHashMap<>(11);
private static final Debug debug = Debug.getInstance("scl");
@@ -196,23 +205,32 @@
* Returned cached ProtectionDomain for the specified CodeSource.
*/
private ProtectionDomain getProtectionDomain(CodeSource cs) {
- if (cs == null)
+ if (cs == null) {
return null;
+ }
- ProtectionDomain pd = null;
- synchronized (pdcache) {
- pd = pdcache.get(cs);
- if (pd == null) {
- PermissionCollection perms = getPermissions(cs);
- pd = new ProtectionDomain(cs, perms, this, null);
- pdcache.put(cs, pd);
+ // Use a String form of the URL as the key. It should behave in the
+ // same manner as the URL when compared for equality except that no
+ // nameservice lookup is done on the hostname (String comparison
+ // only), and the fragment is not considered.
+ String key = cs.getLocationNoFragString();
+ if (key == null) {
+ key = "<null>";
+ }
+ return pdcache.computeIfAbsent(key, new Function<>() {
+ @Override
+ public ProtectionDomain apply(String key /* not used */) {
+ PermissionCollection perms
+ = SecureClassLoader.this.getPermissions(cs);
+ ProtectionDomain pd = new ProtectionDomain(
+ cs, perms, SecureClassLoader.this, null);
if (debug != null) {
- debug.println(" getPermissions "+ pd);
+ debug.println(" getPermissions " + pd);
debug.println("");
}
+ return pd;
}
- }
- return pd;
+ });
}
/*
--- a/jdk/src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java Wed Jul 05 20:38:32 2017 +0200
@@ -780,7 +780,9 @@
}
/**
- * Version of firstOfMode used by Spliterator
+ * Version of firstOfMode used by Spliterator. Callers must
+ * recheck if the returned node's item field is null or
+ * self-linked before using.
*/
final Node firstDataNode() {
for (Node p = head; p != null;) {
@@ -953,11 +955,12 @@
Object[] a = new Object[n];
int i = 0;
do {
- if ((a[i] = p.item) != null)
+ Object e = p.item;
+ if (e != p && (a[i] = e) != null)
++i;
if (p == (p = p.next))
p = q.firstDataNode();
- } while (p != null && i < n);
+ } while (p != null && i < n && p.isData);
if ((current = p) == null)
exhausted = true;
if (i > 0) {
@@ -980,11 +983,11 @@
exhausted = true;
do {
Object e = p.item;
+ if (e != null && e != p)
+ action.accept((E)e);
if (p == (p = p.next))
p = q.firstDataNode();
- if (e != null)
- action.accept((E)e);
- } while (p != null);
+ } while (p != null && p.isData);
}
}
@@ -997,10 +1000,11 @@
((p = current) != null || (p = q.firstDataNode()) != null)) {
Object e;
do {
- e = p.item;
+ if ((e = p.item) == p)
+ e = null;
if (p == (p = p.next))
p = q.firstDataNode();
- } while (e == null && p != null);
+ } while (e == null && p != null && p.isData);
if ((current = p) == null)
exhausted = true;
if (e != null) {
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -277,8 +277,14 @@
@Override
public AnnotatedType[] getAnnotatedUpperBounds() {
- if (!hasUpperBounds())
- return new AnnotatedType[0];
+ if (!hasUpperBounds()) {
+ return new AnnotatedType[] { buildAnnotatedType(Object.class,
+ LocationInfo.BASE_LOCATION,
+ new TypeAnnotation[0],
+ new TypeAnnotation[0],
+ null)
+ };
+ }
return getAnnotatedBounds(getWildcardType().getUpperBounds());
}
--- a/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Wed Jul 05 20:38:32 2017 +0200
@@ -542,7 +542,22 @@
@Override
public CompletableFuture<Process> onExit() {
return ProcessHandleImpl.completion(pid, false)
- .handleAsync((exitStatus, unusedThrowable) -> this);
+ .handleAsync((exitStatus, unusedThrowable) -> {
+ boolean interrupted = false;
+ while (true) {
+ // Ensure that the concurrent task setting the exit status has completed
+ try {
+ waitFor();
+ break;
+ } catch (InterruptedException ie) {
+ interrupted = true;
+ }
+ }
+ if (interrupted) {
+ Thread.currentThread().interrupt();
+ }
+ return this;
+ });
}
@Override
--- a/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,12 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
+#ifdef MACOSX
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
#include <sys/statvfs.h>
+#endif
#include <string.h>
#include <stdlib.h>
#include <dlfcn.h>
@@ -46,8 +51,10 @@
#define dirent64 dirent
#define readdir64_r readdir_r
#define stat64 stat
+#ifndef MACOSX
#define statvfs64 statvfs
#endif
+#endif
/* -- Field IDs -- */
@@ -432,8 +439,32 @@
jlong rv = 0L;
WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
+#ifdef MACOSX
+ struct statfs fsstat;
+#else
struct statvfs64 fsstat;
+#endif
memset(&fsstat, 0, sizeof(fsstat));
+#ifdef MACOSX
+ if (statfs(path, &fsstat) == 0) {
+ switch(t) {
+ case java_io_FileSystem_SPACE_TOTAL:
+ rv = jlong_mul(long_to_jlong(fsstat.f_bsize),
+ long_to_jlong(fsstat.f_blocks));
+ break;
+ case java_io_FileSystem_SPACE_FREE:
+ rv = jlong_mul(long_to_jlong(fsstat.f_bsize),
+ long_to_jlong(fsstat.f_bfree));
+ break;
+ case java_io_FileSystem_SPACE_USABLE:
+ rv = jlong_mul(long_to_jlong(fsstat.f_bsize),
+ long_to_jlong(fsstat.f_bavail));
+ break;
+ default:
+ assert(0);
+ }
+ }
+#else
if (statvfs64(path, &fsstat) == 0) {
switch(t) {
case java_io_FileSystem_SPACE_TOTAL:
@@ -452,6 +483,7 @@
assert(0);
}
}
+#endif
} END_PLATFORM_STRING(env, path);
return rv;
}
--- a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Wed Jul 05 20:38:32 2017 +0200
@@ -35,7 +35,12 @@
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef MACOSX
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
#include <sys/statvfs.h>
+#endif
#include <sys/time.h>
#ifdef __solaris__
@@ -50,7 +55,9 @@
#include <string.h>
#define stat64 stat
+#ifndef MACOSX
#define statvfs64 statvfs
+#endif
#define open64 open
#define fstat64 fstat
@@ -901,11 +908,18 @@
jlong pathAddress, jobject attrs)
{
int err;
+#ifdef MACOSX
+ struct statfs buf;
+#else
struct statvfs64 buf;
+#endif
const char* path = (const char*)jlong_to_ptr(pathAddress);
-
+#ifdef MACOSX
+ RESTARTABLE(statfs(path, &buf), err);
+#else
RESTARTABLE(statvfs64(path, &buf), err);
+#endif
if (err == -1) {
throwUnixException(env, errno);
} else {
@@ -921,7 +935,11 @@
buf.f_bavail = 0;
}
#endif
+#ifdef MACOSX
+ (*env)->SetLongField(env, attrs, attrs_f_frsize, long_to_jlong(buf.f_bsize));
+#else
(*env)->SetLongField(env, attrs, attrs_f_frsize, long_to_jlong(buf.f_frsize));
+#endif
(*env)->SetLongField(env, attrs, attrs_f_blocks, long_to_jlong(buf.f_blocks));
(*env)->SetLongField(env, attrs, attrs_f_bfree, long_to_jlong(buf.f_bfree));
(*env)->SetLongField(env, attrs, attrs_f_bavail, long_to_jlong(buf.f_bavail));
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Jul 05 20:38:32 2017 +0200
@@ -985,11 +985,13 @@
}
private void checkZoom() {
- int state = peer.getState();
- if (state != Frame.MAXIMIZED_BOTH && isMaximized()) {
- deliverZoom(true);
- } else if (state == Frame.MAXIMIZED_BOTH && !isMaximized()) {
- deliverZoom(false);
+ if (peer != null) {
+ int state = peer.getState();
+ if (state != Frame.MAXIMIZED_BOTH && isMaximized()) {
+ deliverZoom(true);
+ } else if (state == Frame.MAXIMIZED_BOTH && !isMaximized()) {
+ deliverZoom(false);
+ }
}
}
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Jul 05 20:38:32 2017 +0200
@@ -370,8 +370,7 @@
protected void initializeDesktopProperties() {
super.initializeDesktopProperties();
Map <Object, Object> fontHints = new HashMap<>();
- fontHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints);
desktopProperties.put("awt.mouse.numButtons", BUTTONS);
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFRetainedResource.m Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFRetainedResource.m Wed Jul 05 20:38:32 2017 +0200
@@ -23,6 +23,7 @@
* questions.
*/
+#import <Cocoa/Cocoa.h>
#import <JavaNativeFoundation/JavaNativeFoundation.h>
#import "sun_lwawt_macosx_CFRetainedResource.h"
@@ -37,7 +38,10 @@
(JNIEnv *env, jclass clazz, jlong ptr, jboolean releaseOnAppKitThread)
{
if (releaseOnAppKitThread) {
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ // Releasing resources on the main AppKit message loop only
+ // Releasing resources on the nested loops may cause dangling
+ // pointers after the nested loop is exited
+ [NSApp postRunnableEvent:^(){
CFRelease(jlong_to_ptr(ptr));
}];
} else {
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m Wed Jul 05 20:38:32 2017 +0200
@@ -516,8 +516,10 @@
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.010]];
if (processEvents) {
//We do not spin a runloop here as date is nil, so does not matter which mode to use
+ // Processing all events excluding NSApplicationDefined which need to be processed
+ // on the main loop only (those events are intended for disposing resources)
NSEvent *event;
- if ((event = [NSApp nextEventMatchingMask:NSAnyEventMask
+ if ((event = [NSApp nextEventMatchingMask:(NSAnyEventMask & ~NSApplicationDefined)
untilDate:nil
inMode:NSDefaultRunLoopMode
dequeue:YES]) != nil) {
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m Wed Jul 05 20:38:32 2017 +0200
@@ -311,21 +311,26 @@
jlong *glyphInfos =
(*env)->GetPrimitiveArrayCritical(env, glyphInfoLongArray, NULL);
- if (glyphInfos != NULL) {
- jint *rawGlyphCodes =
+
+ jint *rawGlyphCodes =
(*env)->GetPrimitiveArrayCritical(env, glyphCodes, NULL);
-
- if (rawGlyphCodes != NULL) {
+ @try {
+ if (rawGlyphCodes != NULL && glyphInfos != NULL) {
CGGlyphImages_GetGlyphImagePtrs(glyphInfos, awtStrike,
- rawGlyphCodes, len);
-
- (*env)->ReleasePrimitiveArrayCritical(env, glyphCodes,
- rawGlyphCodes, JNI_ABORT);
+ rawGlyphCodes, len);
}
- // Do not use JNI_COMMIT, as that will not free the buffer copy
- // when +ProtectJavaHeap is on.
- (*env)->ReleasePrimitiveArrayCritical(env, glyphInfoLongArray,
- glyphInfos, 0);
+ }
+ @finally {
+ if (rawGlyphCodes != NULL) {
+ (*env)->ReleasePrimitiveArrayCritical(env, glyphCodes,
+ rawGlyphCodes, JNI_ABORT);
+ }
+ if (glyphInfos != NULL) {
+ // Do not use JNI_COMMIT, as that will not free the buffer copy
+ // when +ProtectJavaHeap is on.
+ (*env)->ReleasePrimitiveArrayCritical(env, glyphInfoLongArray,
+ glyphInfos, 0);
+ }
}
JNF_COCOA_EXIT(env);
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m Wed Jul 05 20:38:32 2017 +0200
@@ -195,19 +195,41 @@
#pragma mark --- Font Rendering Mode Descriptors ---
+static Int32 reverseGamma = 0;
+
+static UInt8 reverseGammaLut[256] = { 0 };
+
+static inline UInt8* getReverseGammaLut() {
+ if (reverseGamma == 0) {
+ // initialize gamma lut
+ double gamma;
+ int i;
+ const char* pGammaEnv = getenv("J2D_LCD_REVERSE_GAMMA");
+ if (pGammaEnv != NULL) {
+ reverseGamma = atol(pGammaEnv);
+ }
+
+ if (reverseGamma < 100 || reverseGamma > 250) {
+ reverseGamma = 180;
+ }
+
+ gamma = 100.0 / reverseGamma;
+ for (i = 0; i < 256; i++) {
+ double x = ((double)i) / 255.0;
+ reverseGammaLut[i] = (UInt8)(255 * pow(x, gamma));
+ }
+ }
+ return reverseGammaLut;
+}
static inline void
CGGI_CopyARGBPixelToRGBPixel(const UInt32 p, UInt8 *dst)
{
-#if __LITTLE_ENDIAN__
- *(dst + 2) = 0xFF - (p >> 24 & 0xFF);
- *(dst + 1) = 0xFF - (p >> 16 & 0xFF);
- *(dst) = 0xFF - (p >> 8 & 0xFF);
-#else
- *(dst) = 0xFF - (p >> 16 & 0xFF);
- *(dst + 1) = 0xFF - (p >> 8 & 0xFF);
- *(dst + 2) = 0xFF - (p & 0xFF);
-#endif
+ UInt8* lut = getReverseGammaLut();
+
+ *(dst + 0) = lut[0xFF - (p >> 16 & 0xFF)]; // red
+ *(dst + 1) = lut[0xFF - (p >> 8 & 0xFF)]; // green
+ *(dst + 2) = lut[0xFF - (p & 0xFF)]; // blue
}
static void
@@ -222,17 +244,14 @@
size_t height = info->height;
size_t y;
+
+ // fill empty glyph image with black-on-white glyph
for (y = 0; y < height; y++) {
size_t destRow = y * destRowWidth * 3;
size_t srcRow = y * srcRowWidth;
size_t x;
for (x = 0; x < destRowWidth; x++) {
- // size_t x3 = x * 3;
- // UInt32 p = src[srcRow + x];
- // dest[destRow + x3] = 0xFF - (p >> 16 & 0xFF);
- // dest[destRow + x3 + 1] = 0xFF - (p >> 8 & 0xFF);
- // dest[destRow + x3 + 2] = 0xFF - (p & 0xFF);
CGGI_CopyARGBPixelToRGBPixel(src[srcRow + x],
dest + destRow + x * 3);
}
@@ -260,13 +279,9 @@
//}
static inline UInt8
-CGGI_ConvertPixelToGreyBit(UInt32 p)
+CGGI_ConvertBWPixelToByteGray(UInt32 p)
{
-#ifdef __LITTLE_ENDIAN__
- return 0xFF - ((p >> 24 & 0xFF) + (p >> 16 & 0xFF) + (p >> 8 & 0xFF)) / 3;
-#else
- return 0xFF - ((p >> 16 & 0xFF) + (p >> 8 & 0xFF) + (p & 0xFF)) / 3;
-#endif
+ return 0xFF - (((p >> 24 & 0xFF) + (p >> 16 & 0xFF) + (p >> 8 & 0xFF)) / 3);
}
static void
@@ -281,14 +296,15 @@
size_t height = info->height;
size_t y;
+
+ // fill empty glyph image with black-on-white glyph
for (y = 0; y < height; y++) {
size_t destRow = y * destRowWidth;
size_t srcRow = y * srcRowWidth;
-
size_t x;
for (x = 0; x < destRowWidth; x++) {
UInt32 p = src[srcRow + x];
- dest[destRow + x] = CGGI_ConvertPixelToGreyBit(p);
+ dest[destRow + x] = CGGI_ConvertBWPixelToByteGray(p);
}
}
}
@@ -316,13 +332,11 @@
{
CGGI_RenderingMode mode;
mode.cgFontMode = strike->fStyle;
+ NSException *e = nil;
switch (strike->fAAStyle) {
- case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_DEFAULT:
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_OFF:
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_ON:
- case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_GASP:
- default:
mode.glyphDescriptor = &grey;
break;
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_LCD_HRGB:
@@ -331,6 +345,17 @@
case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_LCD_VBGR:
mode.glyphDescriptor = &rgb;
break;
+ case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_GASP:
+ case sun_awt_SunHints_INTVAL_TEXT_ANTIALIAS_DEFAULT:
+ default:
+ /* we expect that text antialiasing hint has been already
+ * evaluated. Report an error if we get 'unevaluated' hint here.
+ */
+ e = [NSException
+ exceptionWithName:@"IllegalArgumentException"
+ reason:@"Invalid hint value"
+ userInfo:nil];
+ @throw e;
}
return mode;
@@ -345,7 +370,8 @@
*/
static inline void
CGGI_InitCanvas(CGGI_GlyphCanvas *canvas,
- const vImagePixelCount width, const vImagePixelCount height)
+ const vImagePixelCount width, const vImagePixelCount height,
+ const CGGI_RenderingMode* mode)
{
// our canvas is *always* 4-byte ARGB
size_t bytesPerRow = width * sizeof(UInt32);
@@ -356,19 +382,26 @@
canvas->image->height = height;
canvas->image->rowBytes = bytesPerRow;
- canvas->image->data = (void *)calloc(byteCount, sizeof(UInt32));
+ canvas->image->data = (void *)calloc(byteCount, sizeof(UInt8));
if (canvas->image->data == NULL) {
[[NSException exceptionWithName:NSMallocException
reason:@"Failed to allocate memory for the buffer which backs the CGContext for glyph strikes." userInfo:nil] raise];
}
- CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+ uint32_t bmpInfo = kCGImageAlphaPremultipliedFirst;
+ if (mode->glyphDescriptor == &rgb) {
+ bmpInfo |= kCGBitmapByteOrder32Host;
+ }
+
+ CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
canvas->context = CGBitmapContextCreate(canvas->image->data,
width, height, 8, bytesPerRow,
colorSpace,
- kCGImageAlphaPremultipliedFirst);
+ bmpInfo);
+ // set foreground color
CGContextSetRGBFillColor(canvas->context, 0.0f, 0.0f, 0.0f, 1.0f);
+
CGContextSetFontSize(canvas->context, 1);
CGContextSaveGState(canvas->context);
@@ -404,7 +437,9 @@
* Quick and easy inline to check if this canvas is big enough.
*/
static inline void
-CGGI_SizeCanvas(CGGI_GlyphCanvas *canvas, const vImagePixelCount width, const vImagePixelCount height, const JRSFontRenderingStyle style)
+CGGI_SizeCanvas(CGGI_GlyphCanvas *canvas, const vImagePixelCount width,
+ const vImagePixelCount height,
+ const CGGI_RenderingMode* mode)
{
if (canvas->image != NULL &&
width < canvas->image->width &&
@@ -418,8 +453,9 @@
CGGI_FreeCanvas(canvas);
CGGI_InitCanvas(canvas,
width * CGGI_GLYPH_CANVAS_SLACK,
- height * CGGI_GLYPH_CANVAS_SLACK);
- JRSFontSetRenderingStyleOnContext(canvas->context, style);
+ height * CGGI_GLYPH_CANVAS_SLACK,
+ mode);
+ JRSFontSetRenderingStyleOnContext(canvas->context, mode->cgFontMode);
}
/*
@@ -443,6 +479,7 @@
Pixel_8888 opaqueWhite = { 0xFF, 0xFF, 0xFF, 0xFF };
#endif
+ // clear canvas background and set foreground color
vImageBufferFill_ARGB8888(&canvasRectToClear, opaqueWhite, kvImageNoFlags);
}
@@ -577,7 +614,7 @@
GlyphInfo *info = CGGI_CreateNewGlyphInfoFrom(advance, bbox, strike, mode);
// fix the context size, just in case the substituted character is unexpectedly large
- CGGI_SizeCanvas(canvas, info->width, info->height, mode->cgFontMode);
+ CGGI_SizeCanvas(canvas, info->width, info->height, mode);
// align the transform for the real CoreText strike
CGContextSetTextMatrix(canvas->context, strike->fAltTx);
@@ -653,8 +690,11 @@
#endif
}
-static NSString *threadLocalCanvasKey =
- @"Java CoreGraphics Text Renderer Cached Canvas";
+static NSString *threadLocalAACanvasKey =
+ @"Java CoreGraphics Text Renderer Cached Canvas for AA";
+
+static NSString *threadLocalLCDCanvasKey =
+ @"Java CoreGraphics Text Renderer Cached Canvas for LCD";
/*
* This is the maximum length and height times the above slack squared
@@ -678,25 +718,28 @@
CGGI_GLYPH_CANVAS_MAX*CGGI_GLYPH_CANVAS_MAX*CGGI_GLYPH_CANVAS_SLACK*CGGI_GLYPH_CANVAS_SLACK)
{
CGGI_GlyphCanvas *tmpCanvas = [[CGGI_GlyphCanvas alloc] init];
- CGGI_InitCanvas(tmpCanvas, maxWidth, maxHeight);
+ CGGI_InitCanvas(tmpCanvas, maxWidth, maxHeight, mode);
CGGI_FillImagesForGlyphsWithSizedCanvas(tmpCanvas, strike,
- mode, glyphInfos, uniChars,
- glyphs, len);
+ mode, glyphInfos, uniChars,
+ glyphs, len);
CGGI_FreeCanvas(tmpCanvas);
[tmpCanvas release];
return;
}
-
NSMutableDictionary *threadDict =
[[NSThread currentThread] threadDictionary];
- CGGI_GlyphCanvas *canvas = [threadDict objectForKey:threadLocalCanvasKey];
+
+ NSString* theKey = (mode->glyphDescriptor == &rgb) ?
+ threadLocalLCDCanvasKey : threadLocalAACanvasKey;
+
+ CGGI_GlyphCanvas *canvas = [threadDict objectForKey:theKey];
if (canvas == nil) {
canvas = [[CGGI_GlyphCanvas alloc] init];
- [threadDict setObject:canvas forKey:threadLocalCanvasKey];
+ [threadDict setObject:canvas forKey:theKey];
}
- CGGI_SizeCanvas(canvas, maxWidth, maxHeight, mode->cgFontMode);
+ CGGI_SizeCanvas(canvas, maxWidth, maxHeight, mode);
CGGI_FillImagesForGlyphsWithSizedCanvas(canvas, strike, mode,
glyphInfos, uniChars, glyphs, len);
}
--- a/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.h Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.h Wed Jul 05 20:38:32 2017 +0200
@@ -37,6 +37,7 @@
- (void) registerWithProcessManager;
- (void) setDockIconWithEnv:(JNIEnv *)env;
- (void) postDummyEvent;
+- (void) postRunnableEvent:(void (^)())block;
- (void) waitForDummyEvent;
+ (void) runAWTLoopWithApp:(NSApplication*)app;
--- a/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m Wed Jul 05 20:38:32 2017 +0200
@@ -337,9 +337,13 @@
- (void)sendEvent:(NSEvent *)event
{
- if ([event type] == NSApplicationDefined && TS_EQUAL([event timestamp], dummyEventTimestamp)) {
+ if ([event type] == NSApplicationDefined && TS_EQUAL([event timestamp], dummyEventTimestamp) && [event subtype] == 0) {
[seenDummyEventLock lockWhenCondition:NO];
[seenDummyEventLock unlockWithCondition:YES];
+ } else if ([event type] == NSApplicationDefined && [event subtype] == 777) {
+ void (^block)() = (void (^)()) [event data1];
+ block();
+ [block release];
} else if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) {
// Cocoa won't send us key up event when releasing a key while Cmd is down,
// so we have to do it ourselves.
@@ -349,6 +353,33 @@
}
}
+/*
+ * Posts the block to the AppKit event queue which will be executed
+ * on the main AppKit loop.
+ * While running nested loops this event will be ignored.
+ */
+- (void)postRunnableEvent:(void (^)())block
+{
+ void (^copy)() = [block copy];
+ NSInteger encode = (NSInteger) copy;
+ [copy retain];
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSEvent* event = [NSEvent otherEventWithType: NSApplicationDefined
+ location: NSMakePoint(0,0)
+ modifierFlags: 0
+ timestamp: 0
+ windowNumber: 0
+ context: nil
+ subtype: 777
+ data1: encode
+ data2: 0];
+
+ [NSApp postEvent: event atStart: NO];
+ [pool drain];
+}
+
+
+
- (void)postDummyEvent {
seenDummyEventLock = [[NSConditionLock alloc] initWithCondition:NO];
dummyEventTimestamp = [NSProcessInfo processInfo].systemUptime;
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/introspect/PropertyInfo.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/introspect/PropertyInfo.java Wed Jul 05 20:38:32 2017 +0200
@@ -125,38 +125,36 @@
put(Name.visualUpdate, annotation.visualUpdate());
put(Name.description, annotation.description());
String[] values = annotation.enumerationValues();
- if (0 < values.length) {
- try {
- Object[] array = new Object[3 * values.length];
- int index = 0;
- for (String value : values) {
- Class<?> type = info.method.getDeclaringClass();
- String name = value;
- int pos = value.lastIndexOf('.');
- if (pos > 0) {
- name = value.substring(0, pos);
- if (name.indexOf('.') < 0) {
- String pkg = type.getName();
- name = pkg.substring(0, 1 + Math.max(
- pkg.lastIndexOf('.'),
- pkg.lastIndexOf('$'))) + name;
- }
- type = findClass(name);
- name = value.substring(pos + 1);
+ try {
+ Object[] array = new Object[3 * values.length];
+ int index = 0;
+ for (String value : values) {
+ Class<?> type = info.method.getDeclaringClass();
+ String name = value;
+ int pos = value.lastIndexOf('.');
+ if (pos > 0) {
+ name = value.substring(0, pos);
+ if (name.indexOf('.') < 0) {
+ String pkg = type.getName();
+ name = pkg.substring(0, 1 + Math.max(
+ pkg.lastIndexOf('.'),
+ pkg.lastIndexOf('$'))) + name;
}
- Field field = type.getField(name);
- if (Modifier.isStatic(field.getModifiers()) && info.type.isAssignableFrom(field.getType())) {
- array[index++] = name;
- array[index++] = field.get(null);
- array[index++] = value;
- }
+ type = findClass(name);
+ name = value.substring(pos + 1);
}
- if (index == array.length) {
- put(Name.enumerationValues, array);
+ Field field = type.getField(name);
+ if (Modifier.isStatic(field.getModifiers()) && info.type.isAssignableFrom(field.getType())) {
+ array[index++] = name;
+ array[index++] = field.get(null);
+ array[index++] = value;
}
- } catch (Exception ignored) {
- ignored.printStackTrace();
}
+ if (index == array.length) {
+ put(Name.enumerationValues, array);
+ }
+ } catch (Exception ignored) {
+ ignored.printStackTrace();
}
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifBorders.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifBorders.java Wed Jul 05 20:38:32 2017 +0200
@@ -41,7 +41,7 @@
import java.awt.Rectangle;
/**
- * Factory object that can vend Icons appropriate for the basic L & F.
+ * Factory object that can vend Icons appropriate for the basic {@literal L & F}.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifButtonListener.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifButtonListener.java Wed Jul 05 20:38:32 2017 +0200
@@ -34,7 +34,6 @@
/**
* Button Listener
- * <p>
*
* @author Rich Schiavi
*/
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifCheckBoxMenuItemUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifCheckBoxMenuItemUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -37,7 +37,6 @@
/**
* MotifCheckboxMenuItem implementation
- * <p>
*
* @author Georges Saab
* @author Rich Schiavi
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifComboBoxUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifComboBoxUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -35,7 +35,8 @@
/**
* ComboBox motif look and feel
- * <p> * <strong>Warning:</strong>
+ * <p>
+ * <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is appropriate
* for short term storage or RMI between applications running the same
@@ -261,9 +262,9 @@
}
/**
- * This inner class is marked "public" due to a compiler bug.
- * This class should be treated as a "protected" inner class.
- * Instantiate it only within subclasses of <FooUI>.
+ * This inner class is marked "public" due to a compiler bug.
+ * This class should be treated as a "protected" inner class.
+ * Instantiate it only within subclasses of {@code <FooUI>}.
*/
public class ComboBoxLayoutManager extends BasicComboBoxUI.ComboBoxLayoutManager {
public ComboBoxLayoutManager() {
@@ -344,7 +345,7 @@
}
/**
- * This class should be made "protected" in future releases.
+ * This class should be made "protected" in future releases.
*/
private class MotifPropertyChangeListener
extends BasicComboBoxUI.PropertyChangeHandler {
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -38,7 +38,7 @@
/**
- * A Motif L&F implementation of InternalFrame.
+ * A Motif {@literal L&F} implementation of InternalFrame.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifLabelUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifLabelUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -32,7 +32,7 @@
import javax.swing.plaf.ComponentUI;
/**
- * A Motif L&F implementation of LabelUI.
+ * A Motif {@literal L&F} implementation of LabelUI.
* This merely sets up new default values in MotifLookAndFeel.
* <p>
* <strong>Warning:</strong>
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifMenuBarUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifMenuBarUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -45,7 +45,7 @@
import javax.swing.plaf.basic.*;
/**
- * A Windows L&F implementation of MenuBarUI. This implementation
+ * A Windows {@literal L&F} implementation of MenuBarUI. This implementation
* is a "combined" view/controller.
* <p>
* <strong>Warning:</strong>
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifMenuItemUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifMenuItemUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -37,7 +37,6 @@
/**
* MotifMenuItem implementation
- * <p>
*
* @author Rich Schiavi
* @author Georges Saab
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifMenuUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifMenuUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -36,8 +36,7 @@
import javax.swing.plaf.basic.BasicMenuUI;
/**
- * A Motif L&F implementation of MenuUI.
- * <p>
+ * A Motif {@literal L&F} implementation of MenuUI.
*
* @author Georges Saab
* @author Rich Schiavi
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifPopupMenuSeparatorUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifPopupMenuSeparatorUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -34,8 +34,8 @@
import javax.swing.plaf.*;
/**
- * A Motif L&F implementation of PopupMenuSeparatorUI. This implementation
- * is a "combined" view/controller.
+ * A Motif {@literal L&F} implementation of PopupMenuSeparatorUI.
+ * This implementation is a "combined" view/controller.
*
* @author Jeff Shapiro
*/
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifPopupMenuUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifPopupMenuUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -47,7 +47,7 @@
/**
- * A Motif L&F implementation of PopupMenuUI.
+ * A Motif {@literal L&F} implementation of PopupMenuUI.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifScrollPaneUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifScrollPaneUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -34,7 +34,7 @@
import java.beans.PropertyChangeListener;
/**
- * A CDE/Motif L&F implementation of ScrollPaneUI.
+ * A CDE/Motif {@code L&F} implementation of ScrollPaneUI.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifSeparatorUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifSeparatorUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -35,8 +35,8 @@
import javax.swing.plaf.basic.BasicSeparatorUI;
/**
- * A Motif L&F implementation of SeparatorUI. This implementation
- * is a "combined" view/controller.
+ * A Motif {@literal L&F} implementation of SeparatorUI.
+ * This implementation is a "combined" view/controller.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifTabbedPaneUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifTabbedPaneUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -34,7 +34,7 @@
import java.io.Serializable;
/**
- * A Motif L&F implementation of TabbedPaneUI.
+ * A Motif {@literal L&F} implementation of TabbedPaneUI.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java Wed Jul 05 20:38:32 2017 +0200
@@ -199,7 +199,7 @@
/**
* Requests that all components in the GUI hierarchy be updated
- * to reflect dynamic changes in this look&feel. This update occurs
+ * to reflect dynamic changes in this {@literal look&feel}. This update occurs
* by uninstalling and re-installing the UI objects. Requests are
* batched and collapsed into a single update pass because often
* many desktop properties will change at once.
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsBorders.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsBorders.java Wed Jul 05 20:38:32 2017 +0200
@@ -39,7 +39,7 @@
import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
/**
- * Factory object that can vend Borders appropriate for the Windows 95 L & F.
+ * Factory object that can vend Borders appropriate for the Windows 95 {@literal L & F}.
* @author Rich Schiavi
*/
@@ -142,7 +142,7 @@
/**
* A border for the ToolBar. If the ToolBar is floatable then the handle grip is drawn
- * <p>
+ *
* @since 1.4
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -76,7 +76,7 @@
}
/**
* Method which renders the text of the current menu item.
- * <p>
+ *
* @param g Graphics context
* @param menuItem Current menu item to render
* @param textRect Bounding rectangle to render the text.
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -48,7 +48,7 @@
import javax.accessibility.*;
/**
- * Windows L&F implementation of a FileChooser.
+ * Windows {@literal L&F} implementation of a FileChooser.
*
* @author Jeff Dinkins
*/
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java Wed Jul 05 20:38:32 2017 +0200
@@ -47,7 +47,7 @@
* Renders a text String in Windows without the mnemonic.
* This is here because the WindowsUI hierarchy doesn't match the Component hierarchy. All
* the overriden paintText methods of the ButtonUI delegates will call this static method.
- * <p>
+ *
* @param g Graphics context
* @param b Current button to render
* @param textRect Bounding rectangle to render the text.
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java Wed Jul 05 20:38:32 2017 +0200
@@ -38,7 +38,7 @@
import sun.swing.MenuItemCheckIconFactory;
/**
- * Factory object that can vend Icons appropriate for the Windows L & F.
+ * Factory object that can vend Icons appropriate for the Windows {@literal L & F}.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java Wed Jul 05 20:38:32 2017 +0200
@@ -503,7 +503,7 @@
private Icon[] icons;
/**
- * @params objects an array of Icon or UIDefaults.LazyValue
+ * @param objects an array of Icon or UIDefaults.LazyValue
* <p>
* The constructor is public so it can be called by UIDefaults.ProxyLazyValue.
*/
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -70,7 +70,7 @@
/**
* Method which renders the text of the current menu item.
- * <p>
+ *
* @param g Graphics context
* @param menuItem Current menu item to render
* @param textRect Bounding rectangle to render the text.
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -199,7 +199,7 @@
/**
* Method which renders the text of the current menu item.
- * <p>
+ *
* @param g Graphics context
* @param menuItem Current menu item to render
* @param textRect Bounding rectangle to render the text.
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -36,7 +36,7 @@
import com.sun.java.swing.plaf.windows.XPStyle.Skin;
/**
- * Windows L&F implementation of PopupMenuSeparatorUI.
+ * Windows {@literal L&F} implementation of PopupMenuSeparatorUI.
*
* @author Leif Samuelsson
* @author Igor Kushnirskiy
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -76,7 +76,7 @@
/**
* Method which renders the text of the current menu item.
- * <p>
+ *
* @param g Graphics context
* @param menuItem Current menu item to render
* @param textRect Bounding rectangle to render the text.
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsSeparatorUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsSeparatorUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -29,7 +29,5 @@
/**
* Windows Separator.
- * <p>
- *
*/
public class WindowsSeparatorUI extends BasicSeparatorUI { }
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsToolBarSeparatorUI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsToolBarSeparatorUI.java Wed Jul 05 20:38:32 2017 +0200
@@ -37,7 +37,6 @@
/**
* Draws Windows toolbar separators.
- * <p>
*
* @author Mark Davidson
*/
--- a/jdk/src/java.desktop/share/classes/java/awt/ScrollPane.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/ScrollPane.java Wed Jul 05 20:38:32 2017 +0200
@@ -499,9 +499,8 @@
Point p = getScrollPosition();
Dimension cs = calculateChildSize();
Dimension vs = getViewportSize();
- Insets i = getInsets();
- c.reshape(i.left - p.x, i.top - p.y, cs.width, cs.height);
+ c.reshape(- p.x, - p.y, cs.width, cs.height);
ScrollPanePeer peer = (ScrollPanePeer)this.peer;
if (peer != null) {
peer.childResized(cs.width, cs.height);
--- a/jdk/src/java.desktop/share/classes/java/beans/BeanDescriptor.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/java/beans/BeanDescriptor.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -81,10 +81,7 @@
SwingContainer container = beanClass.getAnnotation(SwingContainer.class);
if (container != null) {
setValue("isContainer", container.value());
- String delegate = container.delegate();
- if (!delegate.isEmpty()) {
- setValue("containerDelegate", delegate);
- }
+ setValue("containerDelegate", container.delegate());
}
}
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java Wed Jul 05 20:38:32 2017 +0200
@@ -70,8 +70,8 @@
* The standard MultipleDocumentHandling values are:
* <UL>
* <LI>
- * <A NAME="sdfi">{@link #SINGLE_DOCUMENT
- * <B>SINGLE_DOCUMENT</B>}</A>. If a print job has multiple
+ * <a NAME="sdfi"></a>{@link #SINGLE_DOCUMENT
+ * <B>SINGLE_DOCUMENT</B>}. If a print job has multiple
* documents -- say, the document data is called <CODE>a</CODE> and
* <CODE>b</CODE> -- then the result of processing all the document data
* (<CODE>a</CODE> and then <CODE>b</CODE>) must be treated as a single sequence
@@ -85,8 +85,8 @@
* each copy (<CODE>a(*),b(*)</CODE>) to start on a new media sheet.
*
* <LI>
- * <A NAME="sducfi">{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
- * <B>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</B>}</A>. If a print job
+ * <a NAME="sducfi"></a>{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
+ * <B>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</B>}. If a print job
* has multiple documents -- say, the document data is called <CODE>a</CODE> and
* <CODE>b</CODE> -- then the result of processing the data in each document
* instance must be treated as a single sequence of media sheets for finishing
@@ -98,8 +98,8 @@
* <CODE>a(*),a(*),...,b(*),b(*)...</CODE>.
*
* <LI>
- * <A NAME="sdccfi">{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
- * <B>SEPARATE_DOCUMENTS_COLLATED_COPIES</B>}</A>. If a print job
+ * <a NAME="sdccfi"></a>{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
+ * <B>SEPARATE_DOCUMENTS_COLLATED_COPIES</B>}. If a print job
* has multiple documents -- say, the document data is called <CODE>a</CODE> and
* <CODE>b</CODE> -- then the result of processing the data in each document
* instance must be treated as a single sequence of media sheets for finishing
@@ -111,8 +111,8 @@
* <CODE>a(*),b(*),a(*),b(*),...</CODE>.
*
* <LI>
- * <A NAME="sdnsfi">{@link #SINGLE_DOCUMENT_NEW_SHEET
- * <B>SINGLE_DOCUMENT_NEW_SHEET</B>}</A>. Same as SINGLE_DOCUMENT,
+ * <a NAME="sdnsfi"></a>{@link #SINGLE_DOCUMENT_NEW_SHEET
+ * <B>SINGLE_DOCUMENT_NEW_SHEET</B>}. Same as SINGLE_DOCUMENT,
* except that the printer must ensure that the first impression of each
* document instance in the job is placed on a new media sheet. This value
* allows multiple documents to be stapled together with a single staple where
@@ -153,7 +153,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @see Copies
* @see Finishings
--- a/jdk/src/java.desktop/share/classes/javax/swing/Timer.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/Timer.java Wed Jul 05 20:38:32 2017 +0200
@@ -141,7 +141,7 @@
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
- * @see java.util.Timer <code>java.util.Timer</code>
+ * @see java.util.Timer
*
*
* @author Dave Moore
--- a/jdk/src/java.desktop/share/classes/sun/java2d/opengl/OGLBlitLoops.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/opengl/OGLBlitLoops.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,6 +59,10 @@
TransformBlit transformBlitIntArgbPreToSurface =
new OGLSwToSurfaceTransform(SurfaceType.IntArgbPre,
OGLSurfaceData.PF_INT_ARGB_PRE);
+ OGLSurfaceToSwBlit blitSurfaceToIntArgbPre =
+ new OGLSurfaceToSwBlit(SurfaceType.IntArgbPre,
+ OGLSurfaceData.PF_INT_ARGB_PRE);
+
GraphicsPrimitive[] primitives = {
// surface->surface ops
new OGLSurfaceToSurfaceBlit(),
@@ -73,8 +77,7 @@
// surface->sw ops
new OGLSurfaceToSwBlit(SurfaceType.IntArgb,
OGLSurfaceData.PF_INT_ARGB),
- new OGLSurfaceToSwBlit(SurfaceType.IntArgbPre,
- OGLSurfaceData.PF_INT_ARGB_PRE),
+ blitSurfaceToIntArgbPre,
// sw->surface ops
blitIntArgbPreToSurface,
@@ -102,7 +105,14 @@
CompositeType.AnyAlpha,
blitIntArgbPreToSurface),
- new OGLAnyCompositeBlit(),
+ new OGLAnyCompositeBlit(OGLSurfaceData.OpenGLSurface,
+ blitSurfaceToIntArgbPre,
+ blitSurfaceToIntArgbPre,
+ blitIntArgbPreToSurface),
+ new OGLAnyCompositeBlit(SurfaceType.Any,
+ null,
+ blitSurfaceToIntArgbPre,
+ blitIntArgbPreToSurface),
new OGLSwToSurfaceScale(SurfaceType.IntRgb,
OGLSurfaceData.PF_INT_RGB),
@@ -869,11 +879,26 @@
}
}
+/**
+ * This general OGLAnyCompositeBlit implementation can convert any source/target
+ * surface to an intermediate surface using convertsrc/convertdst loops, applies
+ * necessary composite operation, and then uses convertresult loop to get the
+ * intermediate surface down to OpenGL.
+ */
final class OGLAnyCompositeBlit extends Blit {
- private WeakReference<SurfaceData> dstTmp;
- OGLAnyCompositeBlit() {
- super(SurfaceType.Any, CompositeType.Any, OGLSurfaceData.OpenGLSurface);
+ private WeakReference<SurfaceData> dstTmp;
+ private WeakReference<SurfaceData> srcTmp;
+ private final Blit convertsrc;
+ private final Blit convertdst;
+ private final Blit convertresult;
+
+ OGLAnyCompositeBlit(SurfaceType srctype, Blit convertsrc, Blit convertdst,
+ Blit convertresult) {
+ super(srctype, CompositeType.Any, OGLSurfaceData.OpenGLSurface);
+ this.convertsrc = convertsrc;
+ this.convertdst = convertdst;
+ this.convertresult = convertresult;
}
public synchronized void Blit(SurfaceData src, SurfaceData dst,
@@ -881,9 +906,20 @@
int sx, int sy, int dx, int dy,
int w, int h)
{
- Blit convertdst = Blit.getFromCache(dst.getSurfaceType(),
- CompositeType.SrcNoEa,
- SurfaceType.IntArgbPre);
+ if (convertsrc != null) {
+ SurfaceData cachedSrc = null;
+ if (srcTmp != null) {
+ // use cached intermediate surface, if available
+ cachedSrc = srcTmp.get();
+ }
+ // convert source to IntArgbPre
+ src = convertFrom(convertsrc, src, sx, sy, w, h, cachedSrc,
+ BufferedImage.TYPE_INT_ARGB_PRE);
+ if (src != cachedSrc) {
+ // cache the intermediate surface
+ srcTmp = new WeakReference<>(src);
+ }
+ }
SurfaceData cachedDst = null;
@@ -906,12 +942,8 @@
// cache the intermediate surface
dstTmp = new WeakReference<>(dstBuffer);
}
-
// now blit the buffer back to the destination
- convertdst = Blit.getFromCache(dstBuffer.getSurfaceType(),
- CompositeType.SrcNoEa,
- dst.getSurfaceType());
- convertdst.Blit(dstBuffer, dst, AlphaComposite.Src,
- clip, 0, 0, dx, dy, w, h);
+ convertresult.Blit(dstBuffer, dst, AlphaComposite.Src, clip, 0, 0, dx,
+ dy, w, h);
}
}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/opengl/OGLSurfaceData.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/opengl/OGLSurfaceData.java Wed Jul 05 20:38:32 2017 +0200
@@ -26,6 +26,7 @@
package sun.java2d.opengl;
import java.awt.AlphaComposite;
+import java.awt.Composite;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.awt.Transparency;
@@ -400,8 +401,8 @@
/**
* For now, we can only render LCD text if:
* - the fragment shader extension is available, and
- * - blending is disabled, and
- * - the source color is opaque
+ * - the source color is opaque, and
+ * - blending is SrcOverNoEa or disabled
* - and the destination is opaque
*
* Eventually, we could enhance the native OGL text rendering code
@@ -411,9 +412,19 @@
public boolean canRenderLCDText(SunGraphics2D sg2d) {
return
graphicsConfig.isCapPresent(CAPS_EXT_LCD_SHADER) &&
- sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
+ sg2d.surfaceData.getTransparency() == Transparency.OPAQUE &&
sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR &&
- sg2d.surfaceData.getTransparency() == Transparency.OPAQUE;
+ (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY ||
+ (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA && canHandleComposite(sg2d.composite)));
+ }
+
+ private boolean canHandleComposite(Composite c) {
+ if (c instanceof AlphaComposite) {
+ AlphaComposite ac = (AlphaComposite)c;
+
+ return ac.getRule() == AlphaComposite.SRC_OVER && ac.getAlpha() >= 1f;
+ }
+ return false;
}
public void validatePipe(SunGraphics2D sg2d) {
--- a/jdk/src/java.desktop/share/classes/sun/swing/AccumulativeRunnable.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/swing/AccumulativeRunnable.java Wed Jul 05 20:38:32 2017 +0200
@@ -49,10 +49,10 @@
* <p>
* Here is how one can do this using {@code AccumulativeRunnable}:
* <pre>
- * AccumulativeRunnable<String> doSetTextImpl =
- * new AccumulativeRunnable<String>() {
- * @Override
- * protected void run(List<String> args) {
+ * {@code AccumulativeRunnable<String> doSetTextImpl =
+ * new AccumulativeRunnable<String>()} {
+ * {@literal @Override}
+ * {@code protected void run(List<String> args)} {
* //set to the last string being passed
* setTextImpl(args.get(args.size() - 1));
* }
@@ -66,16 +66,16 @@
* <p>
* Say we want to implement addDirtyRegion(Rectangle rect)
* which sends this region to the
- * handleDirtyRegions(List<Rect> regiouns) on the EDT.
+ * {@code handleDirtyRegions(List<Rect> regiouns)} on the EDT.
* addDirtyRegions better be accumulated before handling on the EDT.
*
* <p>
* Here is how it can be implemented using AccumulativeRunnable:
* <pre>
- * AccumulativeRunnable<Rectangle> doHandleDirtyRegions =
- * new AccumulativeRunnable<Rectangle>() {
- * @Override
- * protected void run(List<Rectangle> args) {
+ * {@code AccumulativeRunnable<Rectangle> doHandleDirtyRegions =}
+ * {@code new AccumulativeRunnable<Rectangle>()} {
+ * {@literal @Override}
+ * {@code protected void run(List<Rectangle> args)} {
* handleDirtyRegions(args);
* }
* };
@@ -113,7 +113,7 @@
}
/**
- * appends arguments and sends this {@cod Runnable} for the
+ * appends arguments and sends this {@code Runnable} for the
* execution if needed.
* <p>
* This implementation uses {@see #submit} to send this
--- a/jdk/src/java.desktop/share/classes/sun/swing/PrintColorUIResource.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/swing/PrintColorUIResource.java Wed Jul 05 20:38:32 2017 +0200
@@ -72,7 +72,7 @@
* manager. When access is disallowed, deserialization of any object
* with reference to a {@code PrintColorUIResource} fails.
* <p>
- * Since {@code PrintColorUIResource) is used only by Swing's look
+ * Since {@code PrintColorUIResource} is used only by Swing's look
* and feels, and we know that UI supplied colors are replaced after
* deserialization when the UI is re-installed, the only important
* aspect of the {@code PrintColorUIResource} that needs to be
--- a/jdk/src/java.desktop/share/classes/sun/swing/PrintingStatus.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/swing/PrintingStatus.java Wed Jul 05 20:38:32 2017 +0200
@@ -40,7 +40,7 @@
/**
* The {@code PrintingStatus} provides a dialog that displays progress
* of the printing job and provides a way to abort it
- * <p/>
+ * <p>
* Methods of these class are thread safe, although most Swing methods
* are not. Please see
* <A HREF="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
--- a/jdk/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java Wed Jul 05 20:38:32 2017 +0200
@@ -662,7 +662,8 @@
* Point is within the actual bounds of a list item (not just in the cell)
* and if the JList has the "List.isFileList" client property set.
* Otherwise, this method returns -1.
- * This is used to make WindowsL&F JFileChooser act like native dialogs.
+ * This is used to make Windows {@literal L&F} JFileChooser act
+ * like native dialogs.
*/
public static int loc2IndexFileList(JList<?> list, Point point) {
int index = list.locationToIndex(point);
@@ -703,7 +704,8 @@
* item at the given row of the table. (Column must be 0).
* Does not check the "Table.isFileList" property. That should be checked
* before calling this method.
- * This is used to make WindowsL&F JFileChooser act like native dialogs.
+ * This is used to make Windows {@literal L&F} JFileChooser act
+ * like native dialogs.
*/
public static boolean pointOutsidePrefSize(JTable table, int row, int column, Point p) {
if (table.convertColumnIndexToModel(column) != 0 || row == -1) {
--- a/jdk/src/java.desktop/share/classes/sun/swing/UIClientPropertyKey.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/swing/UIClientPropertyKey.java Wed Jul 05 20:38:32 2017 +0200
@@ -27,7 +27,7 @@
/**
* This interface is used only for tagging keys for client properties
- * for {@code JComponent} set by UI which needs to be cleared on L&F
+ * for {@code JComponent} set by UI which needs to be cleared on {@literal L&F}
* change and serialization.
*
* All such keys are removed from client properties in {@code
--- a/jdk/src/java.desktop/share/classes/sun/swing/WindowsPlacesBar.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/swing/WindowsPlacesBar.java Wed Jul 05 20:38:32 2017 +0200
@@ -43,7 +43,6 @@
* <b>WARNING:</b> This class is an implementation detail and is only
* public so that it can be used by two packages. You should NOT consider
* this public API.
- * <p>
*
* @author Leif Samuelsson
*/
--- a/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLContext.c Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLContext.c Wed Jul 05 20:38:32 2017 +0200
@@ -750,7 +750,7 @@
// finally, check to see if the hardware supports the required number
// of texture units
j2d_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &maxTexUnits);
- if (maxTexUnits < 4) {
+ if (maxTexUnits < 2) {
J2dRlsTraceLn1(J2D_TRACE_INFO,
"OGLContext_IsLCDShaderSupportAvailable: not enough tex units (%d)",
maxTexUnits);
--- a/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.c Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.c Wed Jul 05 20:38:32 2017 +0200
@@ -95,22 +95,9 @@
static GLhandleARB lcdTextProgram = 0;
/**
- * The size of one of the gamma LUT textures in any one dimension along
- * the edge, in texels.
- */
-#define LUT_EDGE 16
-
-/**
- * These are the texture object handles for the gamma and inverse gamma
- * lookup tables.
- */
-static GLuint gammaLutTextureID = 0;
-static GLuint invGammaLutTextureID = 0;
-
-/**
* This value tracks the previous LCD contrast setting, so if the contrast
- * value hasn't changed since the last time the lookup tables were
- * generated (not very common), then we can skip updating the tables.
+ * value hasn't changed since the last time the gamma uniforms were
+ * updated (not very common), then we can skip updating the unforms.
*/
static jint lastLCDContrast = -1;
@@ -275,12 +262,9 @@
* changes, we will modify the "src_adj" value in OGLTR_UpdateLCDTextColor()).
*
* The "main" function is executed for each "fragment" (or pixel) in the
- * glyph image. We have determined that the pow() function can be quite
- * slow and it only operates on scalar values, not vectors as we require.
- * So instead we build two 3D textures containing gamma (and inverse gamma)
- * lookup tables that allow us to approximate a component-wise pow() function
- * with a single 3D texture lookup. This approach is at least 2x faster
- * than the equivalent pow() calls.
+ * glyph image. The pow() routine operates on vectors, gives precise results,
+ * and provides acceptable level of performance, so we use it to perform
+ * the gamma adjustment.
*
* The variables involved in the equation can be expressed as follows:
*
@@ -299,8 +283,8 @@
"uniform vec3 src_adj;"
"uniform sampler2D glyph_tex;"
"uniform sampler2D dst_tex;"
- "uniform sampler3D invgamma_tex;"
- "uniform sampler3D gamma_tex;"
+ "uniform vec3 gamma;"
+ "uniform vec3 invgamma;"
""
"void main(void)"
"{"
@@ -312,12 +296,12 @@
" }"
// load the RGB value from the corresponding destination pixel
" vec3 dst_clr = vec3(texture2D(dst_tex, gl_TexCoord[1].st));"
- // gamma adjust the dest color using the invgamma LUT
- " vec3 dst_adj = vec3(texture3D(invgamma_tex, dst_clr.stp));"
+ // gamma adjust the dest color
+ " vec3 dst_adj = pow(dst_clr.rgb, gamma);"
// linearly interpolate the three color values
" vec3 result = mix(dst_adj, src_adj, glyph_clr);"
// gamma re-adjust the resulting color (alpha is always set to 1.0)
- " gl_FragColor = vec4(vec3(texture3D(gamma_tex, result.stp)), 1.0);"
+ " gl_FragColor = vec4(pow(result.rgb, invgamma), 1.0);"
"}";
/**
@@ -348,10 +332,6 @@
j2d_glUniform1iARB(loc, 0); // texture unit 0
loc = j2d_glGetUniformLocationARB(lcdTextProgram, "dst_tex");
j2d_glUniform1iARB(loc, 1); // texture unit 1
- loc = j2d_glGetUniformLocationARB(lcdTextProgram, "invgamma_tex");
- j2d_glUniform1iARB(loc, 2); // texture unit 2
- loc = j2d_glGetUniformLocationARB(lcdTextProgram, "gamma_tex");
- j2d_glUniform1iARB(loc, 3); // texture unit 3
// "unuse" the program object; it will be re-bound later as needed
j2d_glUseProgramObjectARB(0);
@@ -360,108 +340,26 @@
}
/**
- * Initializes a 3D texture object for use as a three-dimensional gamma
- * lookup table. Note that the wrap mode is initialized to GL_LINEAR so
- * that the table will interpolate adjacent values when the index falls
- * somewhere in between.
- */
-static GLuint
-OGLTR_InitGammaLutTexture()
-{
- GLuint lutTextureID;
-
- j2d_glGenTextures(1, &lutTextureID);
- j2d_glBindTexture(GL_TEXTURE_3D, lutTextureID);
- j2d_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- j2d_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- j2d_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- j2d_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- j2d_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
-
- return lutTextureID;
-}
-
-/**
- * Updates the lookup table in the given texture object with the float
- * values in the given system memory buffer. Note that we could use
- * glTexSubImage3D() when updating the texture after its first
- * initialization, but since we're updating the entire table (with
- * power-of-two dimensions) and this is a relatively rare event, we'll
- * just stick with glTexImage3D().
- */
-static void
-OGLTR_UpdateGammaLutTexture(GLuint texID, GLfloat *lut, jint size)
-{
- j2d_glBindTexture(GL_TEXTURE_3D, texID);
- j2d_glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB8,
- size, size, size, 0, GL_RGB, GL_FLOAT, lut);
-}
-
-/**
- * (Re)Initializes the gamma lookup table textures.
+ * (Re)Initializes the gamma related uniforms.
*
* The given contrast value is an int in the range [100, 250] which we will
- * then scale to fit in the range [1.0, 2.5]. We create two LUTs, one
- * that essentially calculates pow(x, gamma) and the other calculates
- * pow(x, 1/gamma). These values are replicated in all three dimensions, so
- * given a single 3D texture coordinate (typically this will be a triplet
- * in the form (r,g,b)), the 3D texture lookup will return an RGB triplet:
- *
- * (pow(r,g), pow(y,g), pow(z,g)
- *
- * where g is either gamma or 1/gamma, depending on the table.
+ * then scale to fit in the range [1.0, 2.5].
*/
static jboolean
OGLTR_UpdateLCDTextContrast(jint contrast)
{
- double gamma = ((double)contrast) / 100.0;
- double ig = gamma;
- double g = 1.0 / ig;
- GLfloat lut[LUT_EDGE][LUT_EDGE][LUT_EDGE][3];
- GLfloat invlut[LUT_EDGE][LUT_EDGE][LUT_EDGE][3];
- int min = 0;
- int max = LUT_EDGE - 1;
- int x, y, z;
+ double g = ((double)contrast) / 100.0;
+ double ig = 1.0 / g;
+ GLint loc;
J2dTraceLn1(J2D_TRACE_INFO,
"OGLTR_UpdateLCDTextContrast: contrast=%d", contrast);
- for (z = min; z <= max; z++) {
- double zval = ((double)z) / max;
- GLfloat gz = (GLfloat)pow(zval, g);
- GLfloat igz = (GLfloat)pow(zval, ig);
-
- for (y = min; y <= max; y++) {
- double yval = ((double)y) / max;
- GLfloat gy = (GLfloat)pow(yval, g);
- GLfloat igy = (GLfloat)pow(yval, ig);
-
- for (x = min; x <= max; x++) {
- double xval = ((double)x) / max;
- GLfloat gx = (GLfloat)pow(xval, g);
- GLfloat igx = (GLfloat)pow(xval, ig);
+ loc = j2d_glGetUniformLocationARB(lcdTextProgram, "gamma");
+ j2d_glUniform3fARB(loc, g, g, g);
- lut[z][y][x][0] = gx;
- lut[z][y][x][1] = gy;
- lut[z][y][x][2] = gz;
-
- invlut[z][y][x][0] = igx;
- invlut[z][y][x][1] = igy;
- invlut[z][y][x][2] = igz;
- }
- }
- }
-
- if (gammaLutTextureID == 0) {
- gammaLutTextureID = OGLTR_InitGammaLutTexture();
- }
- OGLTR_UpdateGammaLutTexture(gammaLutTextureID, (GLfloat *)lut, LUT_EDGE);
-
- if (invGammaLutTextureID == 0) {
- invGammaLutTextureID = OGLTR_InitGammaLutTexture();
- }
- OGLTR_UpdateGammaLutTexture(invGammaLutTextureID,
- (GLfloat *)invlut, LUT_EDGE);
+ loc = j2d_glGetUniformLocationARB(lcdTextProgram, "invgamma");
+ j2d_glUniform3fARB(loc, ig, ig, ig);
return JNI_TRUE;
}
@@ -562,14 +460,6 @@
return JNI_FALSE;
}
- // bind the gamma LUT textures
- j2d_glActiveTextureARB(GL_TEXTURE2_ARB);
- j2d_glBindTexture(GL_TEXTURE_3D, invGammaLutTextureID);
- j2d_glEnable(GL_TEXTURE_3D);
- j2d_glActiveTextureARB(GL_TEXTURE3_ARB);
- j2d_glBindTexture(GL_TEXTURE_3D, gammaLutTextureID);
- j2d_glEnable(GL_TEXTURE_3D);
-
return JNI_TRUE;
}
@@ -629,10 +519,6 @@
j2d_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
j2d_glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
j2d_glUseProgramObjectARB(0);
- j2d_glActiveTextureARB(GL_TEXTURE3_ARB);
- j2d_glDisable(GL_TEXTURE_3D);
- j2d_glActiveTextureARB(GL_TEXTURE2_ARB);
- j2d_glDisable(GL_TEXTURE_3D);
j2d_glActiveTextureARB(GL_TEXTURE1_ARB);
j2d_glDisable(GL_TEXTURE_2D);
j2d_glActiveTextureARB(GL_TEXTURE0_ARB);
--- a/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c Wed Jul 05 20:38:32 2017 +0200
@@ -82,8 +82,8 @@
int i, j;
int imageIndex;
int cx, cy, cw, ch; /* clamped coordinates */
- int numLines;
- int numPassLines;
+ const int interlacedOffset[] = { 0, 4, 2, 1, 0 }; /* The way Interlaced image should. */
+ const int interlacedJumps[] = { 8, 8, 4, 2, 1 }; /* be read - offsets and jumps... */
if (DGifSlurp(gif) == GIF_ERROR) {
return 0;
@@ -213,6 +213,16 @@
byte_t *pSrc = image->RasterBits;
ImageFormat srcFormat;
ImageRect srcRect, dstRect;
+ int pass = 4, npass = 5;
+
+#if GIFLIB_MAJOR < 5
+ /* Interlaced gif support is broken in giflib < 5
+ so we need to work around this */
+ if (desc->Interlace) {
+ pass = 0;
+ npass = 4;
+ }
+#endif
srcFormat.colorMap = colorMapBuf;
srcFormat.depthBytes = 1;
@@ -221,22 +231,26 @@
srcFormat.fixedBits = QUAD_ALPHA_MASK; // fixed 100% alpha
srcFormat.premultiplied = 0;
- /* Number of source lines for current pass */
- numPassLines = desc->Height;
- /* Number of lines that fits to dest buffer */
- numLines = ch;
-
- initRect(&srcRect, 0, 0, desc->Width, numLines, 1,
- desc->Width, pSrc, &srcFormat);
+ for (; pass < npass; ++pass) {
+ int jump = interlacedJumps[pass];
+ int ofs = interlacedOffset[pass];
+ /* Number of source lines for current pass */
+ int numPassLines = (desc->Height + jump - ofs - 1) / jump;
+ /* Number of lines that fits to dest buffer */
+ int numLines = (ch + jump - ofs - 1) / jump;
- if (numLines > 0) {
- initRect(&dstRect, cx, cy, cw,
- numLines , 1, stride, pBitmapBits, &splash->imageFormat);
+ initRect(&srcRect, 0, 0, desc->Width, numLines, 1,
+ desc->Width, pSrc, &srcFormat);
- pSrc += convertRect(&srcRect, &dstRect, CVT_ALPHATEST);
+ if (numLines > 0) {
+ initRect(&dstRect, cx, cy + ofs, cw,
+ numLines , jump, stride, pBitmapBits, &splash->imageFormat);
+
+ pSrc += convertRect(&srcRect, &dstRect, CVT_ALPHATEST);
+ }
+ // skip extra source data
+ pSrc += (numPassLines - numLines) * srcRect.stride;
}
- // skip extra source data
- pSrc += (numPassLines - numLines) * srcRect.stride;
}
// now dispose of the previous frame correctly
@@ -296,7 +310,13 @@
free(pBitmapBits);
free(pOldBitmapBits);
- DGifCloseFile(gif, NULL);
+#if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1)
+ if (DGifCloseFile(gif, NULL) == GIF_ERROR) {
+ return 0;
+ }
+#else
+ DGifCloseFile(gif);
+#endif
return 1;
}
@@ -304,7 +324,11 @@
int
SplashDecodeGifStream(Splash * splash, SplashStream * stream)
{
+#if GIFLIB_MAJOR >= 5
GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc, NULL);
+#else
+ GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc);
+#endif
if (!gif)
return 0;
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XClipboard.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XClipboard.java Wed Jul 05 20:38:32 2017 +0200
@@ -156,19 +156,24 @@
isSelectionNotifyProcessed = true;
boolean mustSchedule = false;
- synchronized (XClipboard.classLock) {
- if (targetsAtom2Clipboard == null) {
- targetsAtom2Clipboard = new HashMap<Long, XClipboard>(2);
+ XToolkit.awtLock();
+ try {
+ synchronized (XClipboard.classLock) {
+ if (targetsAtom2Clipboard == null) {
+ targetsAtom2Clipboard = new HashMap<Long, XClipboard>(2);
+ }
+ mustSchedule = targetsAtom2Clipboard.isEmpty();
+ targetsAtom2Clipboard.put(getTargetsPropertyAtom().getAtom(), this);
+ if (mustSchedule) {
+ XToolkit.addEventDispatcher(XWindow.getXAWTRootWindow().getWindow(),
+ new SelectionNotifyHandler());
+ }
}
- mustSchedule = targetsAtom2Clipboard.isEmpty();
- targetsAtom2Clipboard.put(getTargetsPropertyAtom().getAtom(), this);
if (mustSchedule) {
- XToolkit.addEventDispatcher(XWindow.getXAWTRootWindow().getWindow(),
- new SelectionNotifyHandler());
+ XToolkit.schedule(new CheckChangeTimerTask(), XClipboard.getPollInterval());
}
- }
- if (mustSchedule) {
- XToolkit.schedule(new CheckChangeTimerTask(), XClipboard.getPollInterval());
+ } finally {
+ XToolkit.awtUnlock();
}
}
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRootWindow.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRootWindow.java Wed Jul 05 20:38:32 2017 +0200
@@ -31,18 +31,22 @@
* common logical ancestor
*/
class XRootWindow extends XBaseWindow {
- private static XRootWindow xawtRootWindow = null;
- static XRootWindow getInstance() {
- XToolkit.awtLock();
- try {
- if (xawtRootWindow == null) {
+ private static class LazyHolder {
+ private static final XRootWindow xawtRootWindow;
+
+ static {
+ XToolkit.awtLock();
+ try {
xawtRootWindow = new XRootWindow();
xawtRootWindow.init(xawtRootWindow.getDelayedParams().delete(DELAYED));
+ } finally {
+ XToolkit.awtUnlock();
}
- return xawtRootWindow;
- } finally {
- XToolkit.awtUnlock();
}
+
+ }
+ static XRootWindow getInstance() {
+ return LazyHolder.xawtRootWindow;
}
private XRootWindow() {
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java Wed Jul 05 20:38:32 2017 +0200
@@ -572,10 +572,6 @@
}
static int getModifiers(int state, int button, int keyCode) {
- return getModifiers(state, button, keyCode, 0, false);
- }
-
- static int getModifiers(int state, int button, int keyCode, int type, boolean wheel_mouse) {
int modifiers = 0;
if (((state & XConstants.ShiftMask) != 0) ^ (keyCode == KeyEvent.VK_SHIFT)) {
@@ -606,7 +602,7 @@
// ONLY one of these conditions should be TRUE to add that modifier.
if (((state & XlibUtil.getButtonMask(i + 1)) != 0) != (button == XConstants.buttons[i])){
//exclude wheel buttons from adding their numbers as modifiers
- if (!wheel_mouse) {
+ if (!isWheel(XConstants.buttons[i])) {
modifiers |= InputEvent.getMaskForButton(i+1);
}
}
@@ -614,6 +610,11 @@
return modifiers;
}
+ static boolean isWheel(int button) {
+ // 4 and 5 buttons are usually considered assigned to a first wheel
+ return button == XConstants.buttons[3] || button == XConstants.buttons[4];
+ }
+
static int getXModifiers(AWTKeyStroke stroke) {
int mods = stroke.getModifiers();
int res = 0;
@@ -653,7 +654,6 @@
int modifiers;
boolean popupTrigger = false;
int button=0;
- boolean wheel_mouse = false;
int lbutton = xbe.get_button();
/*
* Ignore the buttons above 20 due to the bit limit for
@@ -706,11 +706,6 @@
}
button = XConstants.buttons[lbutton - 1];
- // 4 and 5 buttons are usually considered assigned to a first wheel
- if (lbutton == XConstants.buttons[3] ||
- lbutton == XConstants.buttons[4]) {
- wheel_mouse = true;
- }
// mapping extra buttons to numbers starting from 4.
if ((button > XConstants.buttons[4]) && (!Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled())){
@@ -720,9 +715,9 @@
if (button > XConstants.buttons[4]){
button -= 2;
}
- modifiers = getModifiers(xbe.get_state(),button,0, type, wheel_mouse);
+ modifiers = getModifiers(xbe.get_state(),button,0);
- if (!wheel_mouse) {
+ if (!isWheel(lbutton)) {
MouseEvent me = new MouseEvent(getEventSource(),
type == XConstants.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED,
jWhen,modifiers, x, y,
--- a/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp Wed Jul 05 20:38:32 2017 +0200
@@ -828,7 +828,7 @@
return 0;
}
- HWND hWnd = CreateWindow(L"D3DFocusWindow", L"D3DFocusWindow", 0,
+ HWND hWnd = CreateWindow(L"D3DFocusWindow", L"D3DFocusWindow", WS_POPUP,
mi.rcMonitor.left, mi.rcMonitor.top, 1, 1,
NULL, NULL, GetModuleHandle(NULL), NULL);
if (hWnd == 0) {
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Wed Jul 05 20:38:32 2017 +0200
@@ -540,9 +540,10 @@
return result;
}
- Logger demandSystemLogger(String name, String resourceBundleName) {
+ Logger demandSystemLogger(String name, String resourceBundleName, Class<?> caller) {
// Add a system logger in the system context's namespace
- final Logger sysLogger = getSystemContext().demandLogger(name, resourceBundleName);
+ final Logger sysLogger = getSystemContext()
+ .demandLogger(name, resourceBundleName, caller);
// Add the system logger to the LogManager's namespace if not exist
// so that there is only one single logger of the given name.
@@ -627,11 +628,11 @@
return global;
}
- Logger demandLogger(String name, String resourceBundleName) {
+ Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
// a LogManager subclass may have its own implementation to add and
// get a Logger. So delegate to the LogManager to do the work.
final LogManager owner = getOwner();
- return owner.demandLogger(name, resourceBundleName, null);
+ return owner.demandLogger(name, resourceBundleName, caller);
}
@@ -869,7 +870,7 @@
owner.getProperty(pname + ".handlers") != null) {
// This pname has a level/handlers definition.
// Make sure it exists.
- demandLogger(pname, null);
+ demandLogger(pname, null, null);
}
ix = ix2+1;
}
@@ -912,11 +913,11 @@
// one single logger of the given name. System loggers are visible
// to applications unless a logger of the same name has been added.
@Override
- Logger demandLogger(String name, String resourceBundleName) {
+ Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
Logger result = findLogger(name);
if (result == null) {
// only allocate the new system logger once
- Logger newLogger = new Logger(name, resourceBundleName, null, getOwner(), true);
+ Logger newLogger = new Logger(name, resourceBundleName, caller, getOwner(), true);
do {
if (addLocalLogger(newLogger)) {
// We successfully added the new Logger that we
--- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java Wed Jul 05 20:38:32 2017 +0200
@@ -450,7 +450,7 @@
SecurityManager sm = System.getSecurityManager();
if (sm != null && !SystemLoggerHelper.disableCallerCheck) {
if (caller.getClassLoader() == null) {
- return manager.demandSystemLogger(name, resourceBundleName);
+ return manager.demandSystemLogger(name, resourceBundleName, caller);
}
}
return manager.demandLogger(name, resourceBundleName, caller);
@@ -500,7 +500,23 @@
// would throw an IllegalArgumentException in the second call
// because the wrapper would result in an attempt to replace
// the existing "resourceBundleForFoo" with null.
- return demandLogger(name, null, Reflection.getCallerClass());
+ return Logger.getLogger(name, Reflection.getCallerClass());
+ }
+
+ /**
+ * Find or create a logger for a named subsystem on behalf
+ * of the given caller.
+ *
+ * This method is called by {@link #getLogger(java.lang.String)} after
+ * it has obtained a reference to its caller's class.
+ *
+ * @param name A name for the logger.
+ * @param callerClass The class that called {@link
+ * #getLogger(java.lang.String)}.
+ * @return a suitable Logger for {@code callerClass}.
+ */
+ private static Logger getLogger(String name, Class<?> callerClass) {
+ return demandLogger(name, null, callerClass);
}
/**
@@ -550,7 +566,30 @@
// adding a new Logger object is handled by LogManager.addLogger().
@CallerSensitive
public static Logger getLogger(String name, String resourceBundleName) {
- Class<?> callerClass = Reflection.getCallerClass();
+ return Logger.getLogger(name, resourceBundleName, Reflection.getCallerClass());
+ }
+
+ /**
+ * Find or create a logger for a named subsystem on behalf
+ * of the given caller.
+ *
+ * This method is called by {@link
+ * #getLogger(java.lang.String, java.lang.String)} after
+ * it has obtained a reference to its caller's class.
+ *
+ * @param name A name for the logger.
+ * @param resourceBundleName name of ResourceBundle to be used for localizing
+ * messages for this logger. May be {@code null}
+ * if none of the messages require localization.
+ * @param callerClass The class that called {@link
+ * #getLogger(java.lang.String, java.lang.String)}.
+ * This class will also be used for locating the
+ * resource bundle if {@code resourceBundleName} is
+ * not {@code null}.
+ * @return a suitable Logger for {@code callerClass}.
+ */
+ private static Logger getLogger(String name, String resourceBundleName,
+ Class<?> callerClass) {
Logger result = demandLogger(name, resourceBundleName, callerClass);
// MissingResourceException or IllegalArgumentException can be
@@ -573,8 +612,9 @@
LogManager manager = LogManager.getLogManager();
// all loggers in the system context will default to
- // the system logger's resource bundle
- Logger result = manager.demandSystemLogger(name, SYSTEM_LOGGER_RB_NAME);
+ // the system logger's resource bundle - therefore the caller won't
+ // be needed and can be null.
+ Logger result = manager.demandSystemLogger(name, SYSTEM_LOGGER_RB_NAME, null);
return result;
}
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/XalanXPathAPI.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/XalanXPathAPI.java Wed Jul 05 20:38:32 2017 +0200
@@ -167,6 +167,13 @@
private synchronized static void fixupFunctionTable() {
installed = false;
+ if (new FunctionTable().functionAvailable("here")) {
+ if (log.isLoggable(java.util.logging.Level.FINE)) {
+ log.log(java.util.logging.Level.FINE, "Here function already registered");
+ }
+ installed = true;
+ return;
+ }
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "Registering Here function");
}
--- a/jdk/src/jdk.dev/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_ja.java Thu Jun 18 10:24:57 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tools.native2ascii.resources;
-
-import java.util.ListResourceBundle;
-
-public class MsgNative2ascii_ja extends ListResourceBundle {
-
- public Object[][] getContents() {
- Object[][] temp = new Object[][] {
- {"err.bad.arg", "-encoding\u306B\u306F\u5F15\u6570\u304C\u5FC5\u8981\u3067\u3059"},
- {"err.cannot.read", "{0}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002"},
- {"err.cannot.write", "{0}\u3092\u66F8\u304D\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002"},
- {"usage", "\u4F7F\u7528\u65B9\u6CD5: native2ascii [-reverse] [-encoding encoding] [inputfile [outputfile]]"},
- };
-
- return temp;
- }
-}
--- a/jdk/src/jdk.dev/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_zh_CN.java Thu Jun 18 10:24:57 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tools.native2ascii.resources;
-
-import java.util.ListResourceBundle;
-
-public class MsgNative2ascii_zh_CN extends ListResourceBundle {
-
- public Object[][] getContents() {
- Object[][] temp = new Object[][] {
- {"err.bad.arg", "-encoding \u9700\u8981\u53C2\u6570"},
- {"err.cannot.read", "\u65E0\u6CD5\u8BFB\u53D6{0}\u3002"},
- {"err.cannot.write", "\u65E0\u6CD5\u5199\u5165{0}\u3002"},
- {"usage", "\u7528\u6CD5: native2ascii [-reverse] [-encoding encoding] [inputfile [outputfile]]"},
- };
-
- return temp;
- }
-}
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/eventFilter.c Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/eventFilter.c Wed Jul 05 20:38:32 2017 +0200
@@ -518,8 +518,8 @@
case JDWP_REQUEST_MODIFIER(SourceNameMatch): {
char* desiredNamePattern = filter->u.SourceNameOnly.sourceNamePattern;
- if (!searchAllSourceNames(env, clazz,
- desiredNamePattern) == 1) {
+ if (searchAllSourceNames(env, clazz,
+ desiredNamePattern) != 1) {
/* The name isn't in the SDE; try the sourceName in the ref
* type
*/
--- a/jdk/src/linux/doc/man/ja/native2ascii.1 Thu Jun 18 10:24:57 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-'\" t
-.\" Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
-.\" Title: native2ascii
-.\" Language: English
-.\" Date: 2013年11月21日
-.\" SectDesc: 国際化ツール
-.\" Software: JDK 8
-.\" Arch: 汎用
-.\"
-.\" 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.
-.\"
-.pl 99999
-.TH "native2ascii" "1" "2013年11月21日" "JDK 8" "国際化ツール"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-native2ascii \- サポートされている任意の文字エンコーディングの文字を含むファイルを、ASCIIおよびUnicodeでエスケープされたファイルに変換して(またはその逆)、ローカライズ可能なアプリケーションを作成します。
-.SH "概要"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fInative2ascii\fR [ \fIinputfile\fR ] [ \fIoutputfile\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fIinputfile\fR
-.RS 4
-ASCIIに変換するエンコードされたファイル。
-.RE
-.PP
-\fIoutputfile\fR
-.RS 4
-変換されたASCIIファイル。
-.RE
-.SH "説明"
-.PP
-\fInative2ascii\fRコマンドは、ASCIIキャラクタ・セットに含まれないすべての文字にUnicodeエスケープ(\fI\eu\fR\fIxxxx\fR)表記法を使用して、Java Runtime Environment (JRE)でサポートされているエンコードされたファイルを、ASCIIでエンコードされたファイルに変換します。このプロセスは、ISO\-8859\-1文字セットに含まれない文字が含まれているプロパティ・ファイルで必要です。このツールは、その逆の変換を実行することもできます。
-.PP
-\fIoutputfile\fR値を省略した場合、標準出力に出力されます。さらに、\fIinputfile\fR値を省略した場合、標準入力から入力されます。
-.SH "オプション"
-.PP
-\-reverse
-.RS 4
-逆の処理を行います。つまり、ISO\-8859\-1でUnicodeエスケープを使用してエンコードされたファイルを、JREでサポートされる文字エンコーディングのファイルに変換します。
-.RE
-.PP
-\-encoding \fIencoding_name\fR
-.RS 4
-変換処理で使用する文字エンコーディングの名前を指定します。このオプションが存在しない場合は、デフォルトの文字エンコーディング(\fIjava\&.nio\&.charset\&.Charset\&.defaultCharset\fRメソッドで定義された)が使用されます。\fIencoding_name\fR文字列は、JREでサポートされている文字エンコーディングの名前にする必要があります。http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/intl/encoding\&.doc\&.htmlにある
-「サポートされているエンコーディング」を参照してください
-.RE
-.PP
-\-J\fIoption\fR
-.RS 4
-Java仮想マシン(JVM)に\fIoption\fRを渡します。optionには、Javaアプリケーション起動ツールのリファレンス・ページに記載されているオプションを1つ指定します。たとえば、\fI\-J\-Xms48m\fRと指定すると、スタートアップ・メモリーは48MBに設定されます。java(1)を参照してください。
-.RE
-.br
-'pl 8.5i
-'bp
--- a/jdk/src/linux/doc/man/native2ascii.1 Thu Jun 18 10:24:57 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-'\" t
-.\" Copyright (c) 1997, 2013, 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.
-.\"
-.\" Arch: generic
-.\" Software: JDK 8
-.\" Date: 21 November 2013
-.\" SectDesc: Internationalization Tools
-.\" Title: native2ascii.1
-.\"
-.if n .pl 99999
-.TH native2ascii 1 "21 November 2013" "JDK 8" "Internationalization Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-
-.SH NAME
-native2ascii \- Creates localizable applications by converting a file with characters in any supported character encoding to one with ASCII and/or Unicode escapes or vice versa\&.
-.SH SYNOPSIS
-.sp
-.nf
-
-\fBnative2ascii\fR [ \fIinputfile\fR ] [ \fIoutputfile\fR ]
-.fi
-.sp
-.TP
-\fIinputfile\fR
-The encoded file to be converted to ASCII\&.
-.TP
-\fIoutputfile\fR
-The converted ASCII file\&.
-.SH DESCRIPTION
-The \f3native2ascii\fR command converts encoded files supported by the Java Runtime Environment (JRE) to files encoded in ASCII, using Unicode escapes (\f3\eu\fR\fIxxxx\fR) notation for all characters that are not part of the ASCII character set\&. This process is required for properties files that contain characters not in ISO-8859-1 character sets\&. The tool can also perform the reverse conversion\&.
-.PP
-If the \f3outputfile\fR value is omitted, then standard output is used for output\&. If, in addition, the \f3inputfile\fR value is omitted, then standard input is used for input\&.
-.SH OPTIONS
-.TP
--reverse
-.br
-Perform the reverse operation: Converts a file encoded in ISO-8859-1 with Unicode escapes to a file in any character encoding supported by the JRE\&.
-.TP
--encoding \fIencoding_name\fR
-.br
-Specifies the name of the character encoding to be used by the conversion procedure\&. If this option is not present, then the default character encoding (as determined by the \f3java\&.nio\&.charset\&.Charset\&.defaultCharset\fR method) is used\&. The \f3encoding_name\fR string must be the name of a character encoding that is supported by the JRE\&. See Supported Encodings at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/intl/encoding\&.doc\&.html
-.TP
--J\fIoption\fR
-.br
-Passes \f3option\fR to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java application launcher\&. For example, \f3-J-Xms48m\fR sets the startup memory to 48 MB\&. See java(1)\&.
-.RE
-.br
-'pl 8.5i
-'bp
--- a/jdk/src/solaris/doc/sun/man/man1/ja/native2ascii.1 Thu Jun 18 10:24:57 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-'\" t
-.\" Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
-.\" Title: native2ascii
-.\" Language: English
-.\" Date: 2013年11月21日
-.\" SectDesc: 国際化ツール
-.\" Software: JDK 8
-.\" Arch: 汎用
-.\"
-.\" 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.
-.\"
-.pl 99999
-.TH "native2ascii" "1" "2013年11月21日" "JDK 8" "国際化ツール"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-native2ascii \- サポートされている任意の文字エンコーディングの文字を含むファイルを、ASCIIおよびUnicodeでエスケープされたファイルに変換して(またはその逆)、ローカライズ可能なアプリケーションを作成します。
-.SH "概要"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fInative2ascii\fR [ \fIinputfile\fR ] [ \fIoutputfile\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fIinputfile\fR
-.RS 4
-ASCIIに変換するエンコードされたファイル。
-.RE
-.PP
-\fIoutputfile\fR
-.RS 4
-変換されたASCIIファイル。
-.RE
-.SH "説明"
-.PP
-\fInative2ascii\fRコマンドは、ASCIIキャラクタ・セットに含まれないすべての文字にUnicodeエスケープ(\fI\eu\fR\fIxxxx\fR)表記法を使用して、Java Runtime Environment (JRE)でサポートされているエンコードされたファイルを、ASCIIでエンコードされたファイルに変換します。このプロセスは、ISO\-8859\-1文字セットに含まれない文字が含まれているプロパティ・ファイルで必要です。このツールは、その逆の変換を実行することもできます。
-.PP
-\fIoutputfile\fR値を省略した場合、標準出力に出力されます。さらに、\fIinputfile\fR値を省略した場合、標準入力から入力されます。
-.SH "オプション"
-.PP
-\-reverse
-.RS 4
-逆の処理を行います。つまり、ISO\-8859\-1でUnicodeエスケープを使用してエンコードされたファイルを、JREでサポートされる文字エンコーディングのファイルに変換します。
-.RE
-.PP
-\-encoding \fIencoding_name\fR
-.RS 4
-変換処理で使用する文字エンコーディングの名前を指定します。このオプションが存在しない場合は、デフォルトの文字エンコーディング(\fIjava\&.nio\&.charset\&.Charset\&.defaultCharset\fRメソッドで定義された)が使用されます。\fIencoding_name\fR文字列は、JREでサポートされている文字エンコーディングの名前にする必要があります。http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/intl/encoding\&.doc\&.htmlにある
-「サポートされているエンコーディング」を参照してください
-.RE
-.PP
-\-J\fIoption\fR
-.RS 4
-Java仮想マシン(JVM)に\fIoption\fRを渡します。optionには、Javaアプリケーション起動ツールのリファレンス・ページに記載されているオプションを1つ指定します。たとえば、\fI\-J\-Xms48m\fRと指定すると、スタートアップ・メモリーは48MBに設定されます。java(1)を参照してください。
-.RE
-.br
-'pl 8.5i
-'bp
--- a/jdk/src/solaris/doc/sun/man/man1/native2ascii.1 Thu Jun 18 10:24:57 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-'\" t
-.\" Copyright (c) 1997, 2013, 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.
-.\"
-.\" Arch: generic
-.\" Software: JDK 8
-.\" Date: 21 November 2013
-.\" SectDesc: Internationalization Tools
-.\" Title: native2ascii.1
-.\"
-.if n .pl 99999
-.TH native2ascii 1 "21 November 2013" "JDK 8" "Internationalization Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-
-.SH NAME
-native2ascii \- Creates localizable applications by converting a file with characters in any supported character encoding to one with ASCII and/or Unicode escapes or vice versa\&.
-.SH SYNOPSIS
-.sp
-.nf
-
-\fBnative2ascii\fR [ \fIinputfile\fR ] [ \fIoutputfile\fR ]
-.fi
-.sp
-.TP
-\fIinputfile\fR
-The encoded file to be converted to ASCII\&.
-.TP
-\fIoutputfile\fR
-The converted ASCII file\&.
-.SH DESCRIPTION
-The \f3native2ascii\fR command converts encoded files supported by the Java Runtime Environment (JRE) to files encoded in ASCII, using Unicode escapes (\f3\eu\fR\fIxxxx\fR) notation for all characters that are not part of the ASCII character set\&. This process is required for properties files that contain characters not in ISO-8859-1 character sets\&. The tool can also perform the reverse conversion\&.
-.PP
-If the \f3outputfile\fR value is omitted, then standard output is used for output\&. If, in addition, the \f3inputfile\fR value is omitted, then standard input is used for input\&.
-.SH OPTIONS
-.TP
--reverse
-.br
-Perform the reverse operation: Converts a file encoded in ISO-8859-1 with Unicode escapes to a file in any character encoding supported by the JRE\&.
-.TP
--encoding \fIencoding_name\fR
-.br
-Specifies the name of the character encoding to be used by the conversion procedure\&. If this option is not present, then the default character encoding (as determined by the \f3java\&.nio\&.charset\&.Charset\&.defaultCharset\fR method) is used\&. The \f3encoding_name\fR string must be the name of a character encoding that is supported by the JRE\&. See Supported Encodings at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/intl/encoding\&.doc\&.html
-.TP
--J\fIoption\fR
-.br
-Passes \f3option\fR to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java application launcher\&. For example, \f3-J-Xms48m\fR sets the startup memory to 48 MB\&. See java(1)\&.
-.RE
-.br
-'pl 8.5i
-'bp
--- a/jdk/test/ProblemList.txt Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/ProblemList.txt Wed Jul 05 20:38:32 2017 +0200
@@ -123,9 +123,6 @@
# 8029891
java/lang/ClassLoader/deadlock/GetResource.java generic-all
-# 8080428
-java/lang/invoke/8022701/MHIllegalAccess.java generic-all
-
############################################################################
# jdk_instrument
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/ScrollPane/bug8077409Test.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 8077409
+ @summary Drawing deviates when validate() is invoked on java.awt.ScrollPane
+ @author mikhail.cherkasov@oracle.com
+ @run main bug8077409Test
+*/
+
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class bug8077409Test extends Frame {
+ ScrollPane pane;
+ MyCanvas myCanvas;
+
+ class MyCanvas extends Canvas {
+ public Dimension getPreferredSize() {
+ return new Dimension(400, 800);
+ }
+
+ public void paint(Graphics g) {
+ g.setColor(Color.BLACK);
+ g.drawLine(0, 0, 399, 0);
+ g.setColor(Color.RED);
+ g.drawLine(0, 1, 399, 1);
+ g.setColor(Color.BLUE);
+ g.drawLine(0, 2, 399, 2);
+ g.setColor(Color.GREEN);
+ g.drawLine(0, 3, 399, 3);
+ }
+
+ }
+
+ public bug8077409Test() {
+ super();
+ setLayout(new BorderLayout());
+ pane = new ScrollPane();
+
+ myCanvas = new MyCanvas();
+ pane.add(myCanvas);
+
+ add(pane, BorderLayout.CENTER);
+ setSize(320, 480);
+
+ }
+
+ @Override
+ protected void processKeyEvent(KeyEvent e) {
+ super.processKeyEvent(e);
+
+ }
+
+ public static void main(String[] args) throws AWTException, InterruptedException {
+ final bug8077409Test obj = new bug8077409Test();
+ obj.setVisible(true);
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ @Override
+ public void eventDispatched(AWTEvent e) {
+ KeyEvent keyEvent = (KeyEvent) e;
+ if(keyEvent.getID() == KeyEvent.KEY_RELEASED) {
+ if (keyEvent.getKeyCode() == KeyEvent.VK_1) {
+ System.out.println(obj.pane.toString());
+ System.out.println("obj.myCanvas.pos: " + obj.myCanvas.getBounds());
+ System.out.println(obj.myCanvas.toString());
+ } else if (keyEvent.getKeyCode() == KeyEvent.VK_2) {
+ obj.repaint();
+ } else if (keyEvent.getKeyCode() == KeyEvent.VK_DOWN) {
+ Point scrollPosition = obj.pane.getScrollPosition();
+ scrollPosition.translate(0, 1);
+ obj.pane.setScrollPosition(scrollPosition);
+ } else if (keyEvent.getKeyCode() == KeyEvent.VK_UP) {
+ Point scrollPosition = obj.pane.getScrollPosition();
+ scrollPosition.translate(0, -1);
+ obj.pane.setScrollPosition(scrollPosition);
+ } else if (keyEvent.getKeyCode() == KeyEvent.VK_SPACE) {
+ obj.pane.validate();
+ }
+ }
+ }
+ }, AWTEvent.KEY_EVENT_MASK);
+ Point scrollPosition = obj.pane.getScrollPosition();
+ scrollPosition.translate(0, 1);
+ obj.pane.setScrollPosition(scrollPosition);
+
+ int y = obj.pane.getComponent(0).getLocation().y;
+ obj.pane.validate();
+ if(y != obj.pane.getComponent(0).getLocation().y){
+ throw new RuntimeException("Wrong position of component in ScrollPane");
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/MouseWheelEvent/WheelModifier/WheelModifier.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 8041470
+ @summary JButtons stay pressed after they have lost focus if you use the mouse wheel
+ @author Anton Nashatyrev
+*/
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.concurrent.CountDownLatch;
+
+public class WheelModifier {
+
+ JFrame f;
+ JButton fb;
+
+ CountDownLatch pressSema = new CountDownLatch(1);
+ CountDownLatch exitSema = new CountDownLatch(1);
+ CountDownLatch releaseSema = new CountDownLatch(1);
+ volatile CountDownLatch wheelSema;
+
+ void createGui() {
+ f = new JFrame("frame");
+ fb = new JButton("frame_button");
+ fb.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ System.out.println("WheelModifier.mouseReleased: " + e);
+ releaseSema.countDown();
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ System.out.println("WheelModifier.mouseEntered: " + e);
+
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ System.out.println("WheelModifier.mouseExited: " + e);
+ exitSema.countDown();
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ System.out.println("WheelModifier.mousePressed: " + e);
+ pressSema.countDown();
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ System.out.println("WheelModifier.mouseDragged: " + e);
+ }
+ });
+
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ @Override
+ public void eventDispatched(AWTEvent event) {
+ System.out.println("WheelModifier.mouseWheel: " + event);
+ wheelSema.countDown();
+ }
+ }, MouseEvent.MOUSE_WHEEL_EVENT_MASK);
+
+ f.setLayout(new FlowLayout());
+ f.add(fb);
+ f.setSize(200, 200);
+ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ f.setVisible(true);
+ }
+
+ void run() throws Exception {
+ Robot r = new Robot();
+ r.waitForIdle();
+ System.out.println("# Started");
+
+ Point sLoc = fb.getLocationOnScreen();
+ Dimension bSize = fb.getSize();
+ r.mouseMove(sLoc.x + bSize.width / 2, sLoc.y + bSize.height / 2);
+ r.mousePress(MouseEvent.BUTTON1_MASK);
+ pressSema.await();
+ System.out.println("# Pressed");
+
+ r.mouseMove(sLoc.x + bSize.width / 2, sLoc.y + bSize.height * 2);
+ exitSema.await();
+ System.out.println("# Exited");
+
+ wheelSema = new CountDownLatch(1);
+ r.mouseWheel(1);
+ wheelSema.await();
+ System.out.println("# Wheeled 1");
+
+ wheelSema = new CountDownLatch(1);
+ r.mouseWheel(-1);
+ wheelSema.await();
+ System.out.println("# Wheeled 2");
+
+ r.mouseRelease(MouseEvent.BUTTON1_MASK);
+ releaseSema.await();
+ System.out.println("# Released!");
+ }
+
+ public static void main(String[] args) throws Exception {
+ WheelModifier test = new WheelModifier();
+
+ SwingUtilities.invokeAndWait(() -> test.createGui());
+ test.run();
+
+ System.out.println("Done.");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/DrawImage/IncorrectClipXorModeSurface2Surface.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+import static java.awt.geom.Rectangle2D.Double;
+
+/**
+ * @test
+ * @bug 8061831
+ * @summary Tests drawing volatile image to volatile image using different
+ * clips + xor mode. Results of the blit compatibleImage to
+ * compatibleImage is used for comparison.
+ */
+public final class IncorrectClipXorModeSurface2Surface {
+
+ private static int[] SIZES = {2, 10, 100};
+ private static final Shape[] SHAPES = {
+ new Rectangle(0, 0, 0, 0),
+ new Rectangle(0, 0, 1, 1),
+ new Rectangle(0, 1, 1, 1),
+ new Rectangle(1, 0, 1, 1),
+ new Rectangle(1, 1, 1, 1),
+
+ new Double(0, 0, 0.5, 0.5),
+ new Double(0, 0.5, 0.5, 0.5),
+ new Double(0.5, 0, 0.5, 0.5),
+ new Double(0.5, 0.5, 0.5, 0.5),
+ new Double(0.25, 0.25, 0.5, 0.5),
+ new Double(0, 0.25, 1, 0.5),
+ new Double(0.25, 0, 0.5, 1),
+
+ new Double(.10, .10, .20, .20),
+ new Double(.75, .75, .20, .20),
+ new Double(.75, .10, .20, .20),
+ new Double(.10, .75, .20, .20),
+ };
+
+ public static void main(final String[] args) throws IOException {
+ GraphicsEnvironment ge = GraphicsEnvironment
+ .getLocalGraphicsEnvironment();
+ GraphicsConfiguration gc = ge.getDefaultScreenDevice()
+ .getDefaultConfiguration();
+ AffineTransform at;
+ for (int size : SIZES) {
+ at = AffineTransform.getScaleInstance(size, size);
+ for (Shape clip : SHAPES) {
+ clip = at.createTransformedShape(clip);
+ for (Shape to : SHAPES) {
+ to = at.createTransformedShape(to);
+ // Prepare test images
+ BufferedImage snapshot;
+ VolatileImage source = getVolatileImage(gc, size);
+ VolatileImage target = getVolatileImage(gc, size);
+ int attempt = 0;
+ while (true) {
+ if (++attempt > 10) {
+ throw new RuntimeException("Too many attempts: " + attempt);
+ }
+ // Prepare source images
+ source.validate(gc);
+ Graphics2D g2d = source.createGraphics();
+ g2d.setColor(Color.RED);
+ g2d.fillRect(0, 0, size, size);
+ g2d.dispose();
+ if (source.validate(gc) != VolatileImage.IMAGE_OK) {
+ continue;
+ }
+ // Prepare target images
+ target.validate(gc);
+ g2d = target.createGraphics();
+ g2d.setColor(Color.GREEN);
+ g2d.fillRect(0, 0, size, size);
+ g2d.dispose();
+ if (target.validate(gc) != VolatileImage.IMAGE_OK) {
+ continue;
+ }
+
+ draw(clip, to, source, target);
+ snapshot = target.getSnapshot();
+ if (source.contentsLost() || target.contentsLost()) {
+ continue;
+ }
+ break;
+ }
+ // Prepare gold images
+ BufferedImage goldS = getSourceGold(gc, size);
+ BufferedImage goldT = getTargetGold(gc, size);
+ draw(clip, to, goldS, goldT);
+ validate(snapshot, goldT);
+ source.flush();
+ target.flush();
+ }
+ }
+ }
+ }
+
+ private static void draw(Shape clip, Shape shape, Image from, Image to) {
+ Graphics2D g2d = (Graphics2D) to.getGraphics();
+ g2d.setXORMode(Color.BLACK);
+ g2d.setClip(clip);
+ Rectangle toBounds = shape.getBounds();
+ g2d.drawImage(from, toBounds.x, toBounds.y, toBounds.width,
+ toBounds.height, null);
+ g2d.dispose();
+ }
+
+ private static BufferedImage getSourceGold(GraphicsConfiguration gc,
+ int size) {
+ final BufferedImage bi = gc.createCompatibleImage(size, size);
+ Graphics2D g2d = bi.createGraphics();
+ g2d.setColor(Color.RED);
+ g2d.fillRect(0, 0, size, size);
+ g2d.dispose();
+ return bi;
+ }
+
+ private static BufferedImage getTargetGold(GraphicsConfiguration gc,
+ int size) {
+ BufferedImage image = gc.createCompatibleImage(size, size);
+ Graphics2D g2d = image.createGraphics();
+ g2d.setColor(Color.GREEN);
+ g2d.fillRect(0, 0, size, size);
+ g2d.dispose();
+ return image;
+ }
+
+ private static VolatileImage getVolatileImage(GraphicsConfiguration gc,
+ int size) {
+ return gc.createCompatibleVolatileImage(size, size);
+ }
+
+ private static void validate(BufferedImage bi, BufferedImage goldbi)
+ throws IOException {
+ for (int x = 0; x < bi.getWidth(); ++x) {
+ for (int y = 0; y < bi.getHeight(); ++y) {
+ if (goldbi.getRGB(x, y) != bi.getRGB(x, y)) {
+ ImageIO.write(bi, "png", new File("actual.png"));
+ ImageIO.write(goldbi, "png", new File("expected.png"));
+ throw new RuntimeException("Test failed.");
+ }
+ }
+ }
+ }
+}
--- a/jdk/test/java/beans/Introspector/4058433/TestBeanProperty.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/beans/Introspector/4058433/TestBeanProperty.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -20,12 +20,14 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
import java.beans.BeanProperty;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyDescriptor;
import java.util.Arrays;
-/*
+
+/**
* @test
* @bug 4058433
* @summary Tests the BeanProperty annotation
@@ -34,7 +36,10 @@
*/
public class TestBeanProperty {
public static void main(String[] args) throws Exception {
- Class<?>[] types = {B.class, BL.class, BLF.class, E.class, H.class, P.class, VU.class, D.class, EV.class, EVL.class, EVX.class};
+ Class<?>[] types =
+ {B.class, BL.class, BLF.class, E.class, H.class, P.class,
+ VU.class, D.class, EVD.class, EVE.class, EV.class, EVL.class,
+ EVX.class};
for (Class<?> type : types) {
PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(type, "value");
if (((B.class == type) || (BLF.class == type)) && pd.isBound()) {
@@ -77,6 +82,14 @@
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("enumerationValues from another package");
}
+ if (EVD.class == type && !isEV(pd)) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("EV:"+ pd.getValue("enumerationValues"));
+ }
+ if (EVE.class == type && !isEV(pd)) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("EV:"+ pd.getValue("enumerationValues"));
+ }
}
}
@@ -219,6 +232,34 @@
}
}
+ public static class EVD {
+
+ private int value;
+
+ public int getValue() {
+ return value;
+ }
+
+ @BeanProperty()
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ public static class EVE {
+
+ private int value;
+
+ public int getValue() {
+ return value;
+ }
+
+ @BeanProperty(enumerationValues = {})
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
public static class EV {
private int value;
--- a/jdk/test/java/beans/Introspector/4058433/TestSwingContainer.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/beans/Introspector/4058433/TestSwingContainer.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -20,24 +20,31 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.util.Objects;
import javax.swing.SwingContainer;
-/*
+
+/**
* @test
* @bug 4058433
* @summary Tests the SwingContainer annotation
* @author Sergey Malenkov
*/
public class TestSwingContainer {
+
public static void main(String[] args) throws Exception {
test(X.class, null, null);
- test(T.class, true, null);
- test(D.class, true, "method");
- test(F.class, false, null);
- test(A.class, false, "method");
+ test(H.class, true, "");
+ test(G.class, true, "");
+ test(F.class, true, "method");
+ test(E.class, false, "");
+ test(D.class, false, "");
+ test(C.class, true, "");
+ test(B.class, false, "method");
+ test(A.class, true, "method");
}
private static void test(Class<?> type, Object iC, Object cD) throws Exception {
@@ -50,7 +57,7 @@
private static void test(BeanDescriptor bd, String name, Object expected) {
Object value = bd.getValue(name);
- System.out.println(name + " = " + value);
+ System.out.println("\t" + name + " = " + value);
if (!Objects.equals(value, expected)) {
throw new Error(name + ": expected = " + expected + "; actual = " + value);
}
@@ -60,18 +67,34 @@
}
@SwingContainer()
- public static class T {
+ public static class H {
+ }
+
+ @SwingContainer(delegate = "")
+ public static class G {
}
@SwingContainer(delegate = "method")
- public static class D {
+ public static class F {
}
@SwingContainer(false)
- public static class F {
+ public static class E {
+ }
+
+ @SwingContainer(value = false, delegate = "")
+ public static class D {
+ }
+
+ @SwingContainer(value = true, delegate = "")
+ public static class C {
}
@SwingContainer(value = false, delegate = "method")
+ public static class B {
+ }
+
+ @SwingContainer(value = true, delegate = "method")
public static class A {
}
}
--- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java Wed Jul 05 20:38:32 2017 +0200
@@ -26,21 +26,17 @@
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
-import java.util.stream.Collectors;
-import jdk.testlibrary.Platform;
import org.testng.annotations.Test;
import org.testng.Assert;
import org.testng.TestNG;
/*
* @test
- * @library /lib/testlibrary
* @summary Functions of Process.onExit and ProcessHandle.onExit
* @author Roger Riggs
*/
--- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,12 +29,9 @@
* @run main/othervm CheckPackageAccess
*/
-import java.security.Security;
import java.util.Collections;
-import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
-import java.util.StringTokenizer;
/*
* The main benefit of this test is to catch merge errors or other types
@@ -44,60 +41,12 @@
*/
public class CheckPackageAccess {
- /*
- * This array should be updated whenever new packages are added to the
- * package.access property in the java.security file
- * NOTE: it should be in the same order as the java.security file
- */
- private static final String[] packages = {
- "sun.",
- "com.sun.xml.internal.",
- "com.sun.imageio.",
- "com.sun.istack.internal.",
- "com.sun.jmx.",
- "com.sun.media.sound.",
- "com.sun.naming.internal.",
- "com.sun.proxy.",
- "com.sun.corba.se.",
- "com.sun.org.apache.bcel.internal.",
- "com.sun.org.apache.regexp.internal.",
- "com.sun.org.apache.xerces.internal.",
- "com.sun.org.apache.xpath.internal.",
- "com.sun.org.apache.xalan.internal.extensions.",
- "com.sun.org.apache.xalan.internal.lib.",
- "com.sun.org.apache.xalan.internal.res.",
- "com.sun.org.apache.xalan.internal.templates.",
- "com.sun.org.apache.xalan.internal.utils.",
- "com.sun.org.apache.xalan.internal.xslt.",
- "com.sun.org.apache.xalan.internal.xsltc.cmdline.",
- "com.sun.org.apache.xalan.internal.xsltc.compiler.",
- "com.sun.org.apache.xalan.internal.xsltc.trax.",
- "com.sun.org.apache.xalan.internal.xsltc.util.",
- "com.sun.org.apache.xml.internal.res.",
- "com.sun.org.apache.xml.internal.security.",
- "com.sun.org.apache.xml.internal.serializer.utils.",
- "com.sun.org.apache.xml.internal.utils.",
- "com.sun.org.glassfish.",
- "com.sun.tools.script.",
- "com.oracle.xmlns.internal.",
- "com.oracle.webservices.internal.",
- "org.jcp.xml.dsig.internal.",
- "jdk.internal.",
- "jdk.nashorn.internal.",
- "jdk.nashorn.tools.",
- "jdk.tools.jimage.",
- "com.sun.activation.registries."
- };
+ public static void main(String[] args) throws Exception {
+ // get expected list of restricted packages
+ List<String> pkgs = RestrictedPackages.expected();
- public static void main(String[] args) throws Exception {
- List<String> pkgs = new ArrayList<>(Arrays.asList(packages));
- String osName = System.getProperty("os.name");
- if (osName.contains("OS X")) {
- pkgs.add("apple."); // add apple package for OS X
- }
-
- List<String> jspkgs =
- getPackages(Security.getProperty("package.access"));
+ // get actual list of restricted packages
+ List<String> jspkgs = RestrictedPackages.actual();
if (!isOpenJDKOnly()) {
String lastPkg = pkgs.get(pkgs.size() - 1);
@@ -127,7 +76,7 @@
}
System.setSecurityManager(new SecurityManager());
SecurityManager sm = System.getSecurityManager();
- for (String pkg : packages) {
+ for (String pkg : pkgs) {
String subpkg = pkg + "foo";
try {
sm.checkPackageAccess(pkg);
@@ -153,18 +102,6 @@
System.out.println("Test passed");
}
- private static List<String> getPackages(String p) {
- List<String> packages = new ArrayList<>();
- if (p != null && !p.equals("")) {
- StringTokenizer tok = new StringTokenizer(p, ",");
- while (tok.hasMoreElements()) {
- String s = tok.nextToken().trim();
- packages.add(s);
- }
- }
- return packages;
- }
-
private static boolean isOpenJDKOnly() {
String prop = System.getProperty("java.runtime.name");
return prop != null && prop.startsWith("OpenJDK");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/SecurityManager/CheckPackageMatching.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,545 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8072692
+ * @summary Check the matching implemented by SecurityManager.checkPackageAccess
+ * @run main/othervm CheckPackageMatching
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+/*
+ * The purpose of this test is not to verify the content of the package
+ * access list - but to ensure that the matching implemented by the
+ * SecurityManager is correct. This is why we have our own pattern matching
+ * algorithm here.
+ */
+public class CheckPackageMatching {
+
+ /**
+ * The restricted packages listed in the package.access property of the
+ * java.security file.
+ */
+ private static final String[] packages =
+ RestrictedPackages.actual().toArray(new String[0]);
+
+ private static final boolean OPEN_JDK = isOpenJDKOnly();
+
+ /**
+ * PackageMatcher implements a state machine that matches package
+ * names against packages parsed from the package access list.
+ */
+ private static abstract class PackageMatcher {
+ // For each state, chars[state] contains the chars that matches.
+ private final char[][] chars;
+ // For each state, states[state][i] contains the next state to go
+ // to when chars[state][i] matches the current character.
+ private final int[][] states;
+
+ // Some markers. We're making the assumption that 0
+ // cannot be a valid character for a package name.
+ //
+ // We use 0 for marking that we expect an end of string in
+ // char[state][i].
+ private static final char END_OF_STRING = 0;
+ // This special state value indicates that we expect the string to end
+ // there.
+ private static final int END_STATE = -1;
+ // This special state value indicates that we can accept any character
+ // from now on.
+ private static final int WILDCARD_STATE = Integer.MIN_VALUE;
+
+ // Create the data for a new state machine to match package names from
+ // the array of package names passed as argument.
+ // Each package name in the array is expected to end with '.'
+ // For each package in packages we're going to compile state data
+ // that will match the regexp:
+ // ^packages[i].substring(0, packages[i].length()-1).replace(".","\\.")$|^packages[i].replace(".","\\.").*
+ //
+ // Let's say the package array is:
+ //
+ // String[] packages = { "sun.", "com.sun.jmx.", "com.sun.proxy.",
+ // "apple." };
+ //
+ // then the state machine will need data that looks like:
+ //
+ // char[][] chars = {
+ // { 'a', 'c', 's' }, { 'p' }, { 'p' }, { 'l' }, { 'e' }, { 0, '.' },
+ // { 'o' }, { 'm' }, { '.' }, { 's' }, { 'u' }, { 'n' }, { '.' },
+ // { 'j', 'p'},
+ // { 'm' }, { 'x' }, { 0, '.' },
+ // { 'r' }, { 'o' }, { 'x' }, { 'y' }, { 0, '.' },
+ // { 'u' }, { 'n' }, { 0, '.' }
+ // }
+ // int[][] states = {
+ // { 1, 6, 22 }, { 2 }, { 3 }, { 4 }, { 5 },
+ // { END_STATE, WILDCARD_STATE },
+ // { 7 }, { 8 }, { 9 }, { 10 }, { 11 }, { 12 }, { 13 }, { 14, 17 },
+ // { 15 }, { 16 }, { END_STATE, WILDCARD_STATE },
+ // { 18 }, { 19 }, { 20 }, { 21 }, { END_STATE, WILDCARD_STATE },
+ // { 23 }, { 24 }, { END_STATE, WILDCARD_STATE }
+ // }
+ //
+ // The machine will start by loading the chars and states for state 0
+ // chars[0] => { 'a', 'c', 's' } states[0] => { 1, 6, 22 }
+ // then it examines the char at index 0 in the candidate name.
+ // if the char matches one of the characters in chars[0], then it goes
+ // to the corresponding state in states[0]. For instance - if the first
+ // char in the candidate name is 's', which corresponds to chars[0][2] -
+ // then it will proceed with the next char in the candidate name and go
+ // to state 22 (as indicated by states[0][2]) - where it will load the
+ // chars and states for states 22: chars[22] = { 'u' },
+ // states[22] = { 23 } etc... until the candidate char at the current
+ // index matches no char in chars[states] => the candidate name doesn't
+ // match - or until it finds a success termination condition: the
+ // candidate chars are exhausted and states[state][0] is END_STATE, or
+ // the candidate chars are not exhausted - and
+ // states[state][chars[state]] is WILDCARD_STATE indicating a '.*' like
+ // regexp.
+ //
+ // [Note that the chars in chars[i] are sorted]
+ //
+ // The compile(...) method is reponsible for building the state machine
+ // data and is called only once in the constructor.
+ //
+ // The matches(String candidate) method will tell whether the candidate
+ // matches by implementing the algorithm described above.
+ //
+ PackageMatcher(String[] packages) {
+ final boolean[] selected = new boolean[packages.length];
+ Arrays.fill(selected, true);
+ final ArrayList<char[]> charList = new ArrayList<>();
+ final ArrayList<int[]> stateList = new ArrayList<>();
+ compile(0, 0, packages, selected, charList, stateList);
+ chars = charList.toArray(new char[0][0]);
+ states = stateList.toArray(new int[0][0]);
+ }
+
+ /**
+ * Compiles the state machine data (recursive).
+ *
+ * @param step The index of the character which we're looking at in
+ * this step.
+ * @param state The current state (starts at 0).
+ * @param pkgs The list of packages from which the automaton is built.
+ * @param selected Indicates which packages we're looking at in this
+ step.
+ * @param charList The list from which we will build
+ {@code char[][] chars;}
+ * @param stateList The list from which we will build
+ {@code int[][] states;}
+ * @return the next available state.
+ */
+ private int compile(int step, int state, String[] pkgs,
+ boolean[] selected, ArrayList<char[]> charList,
+ ArrayList<int[]> stateList) {
+ final char[] next = new char[pkgs.length];
+ final int[] nexti = new int[pkgs.length];
+ int j = 0;
+ char min = Character.MAX_VALUE; char max = 0;
+ for (int i = 0; i < pkgs.length; i++) {
+ if (!selected[i]) continue;
+ final String p = pkgs[i];
+ final int len = p.length();
+ if (step > len) {
+ selected[i] = false;
+ continue;
+ }
+ if (len - 1 == step) {
+ boolean unknown = true;
+ for (int k = 0; k < j ; k++) {
+ if (next[k] == END_OF_STRING) {
+ unknown = false;
+ break;
+ }
+ }
+ if (unknown) {
+ next[j] = END_OF_STRING;
+ j++;
+ }
+ nexti[i] = END_STATE;
+ }
+ final char c = p.charAt(step);
+ nexti[i] = len - 1 == step ? END_STATE : c;
+ boolean unknown = j == 0 || c < min || c > max;
+ if (!unknown) {
+ if (c != min || c != max) {
+ unknown = true;
+ for (int k = 0; k < j ; k++) {
+ if (next[k] == c) {
+ unknown = false;
+ break;
+ }
+ }
+ }
+ }
+ if (unknown) {
+ min = min > c ? c : min;
+ max = max < c ? c : max;
+ next[j] = c;
+ j++;
+ }
+ }
+ final char[] nc = new char[j];
+ final int[] nst = new int[j];
+ System.arraycopy(next, 0, nc, 0, nc.length);
+ Arrays.sort(nc);
+ final boolean ns[] = new boolean[pkgs.length];
+
+ charList.ensureCapacity(state + 1);
+ stateList.ensureCapacity(state + 1);
+ charList.add(state, nc);
+ stateList.add(state, nst);
+ state = state + 1;
+ for (int k = 0; k < nc.length; k++) {
+ int selectedCount = 0;
+ boolean endStateFound = false;
+ boolean wildcardFound = false;
+ for (int l = 0; l < nexti.length; l++) {
+ if (!(ns[l] = selected[l])) {
+ continue;
+ }
+ ns[l] = nexti[l] == nc[k] || nexti[l] == END_STATE
+ && nc[k] == '.';
+ endStateFound = endStateFound || nc[k] == END_OF_STRING
+ && nexti[l] == END_STATE;
+ wildcardFound = wildcardFound || nc[k] == '.'
+ && nexti[l] == END_STATE;
+ if (ns[l]) {
+ selectedCount++;
+ }
+ }
+ nst[k] = (endStateFound ? END_STATE
+ : wildcardFound ? WILDCARD_STATE : state);
+ if (selectedCount == 0 || wildcardFound) {
+ continue;
+ }
+ state = compile(step + 1, state, pkgs, ns, charList, stateList);
+ }
+ return state;
+ }
+
+ /**
+ * Matches 'pkg' against the list of package names compiled in the
+ * state machine data.
+ *
+ * @param pkg The package name to match. Must not end with '.'.
+ * @return true if the package name matches, false otherwise.
+ */
+ public boolean matches(String pkg) {
+ int state = 0;
+ int i;
+ final int len = pkg.length();
+ next: for (i = 0; i <= len; i++) {
+ if (state == WILDCARD_STATE) {
+ return true; // all characters will match.
+ }
+ if (state == END_STATE) {
+ return i == len;
+ }
+ final char[] ch = chars[state];
+ final int[] st = states[state];
+ if (i == len) {
+ // matches only if we have exhausted the string.
+ return st[0] == END_STATE;
+ }
+ if (st[0] == END_STATE && st.length == 1) {
+ // matches only if we have exhausted the string.
+ return i == len;
+ }
+ final char c = pkg.charAt(i); // look at next char...
+ for (int j = st[0] == END_STATE ? 1 : 0; j < ch.length; j++) {
+ final char n = ch[j];
+ if (c == n) { // found a match
+ state = st[j]; // get the next state.
+ continue next; // go to next state
+ } else if (c < n) {
+ break; // chars are sorted. we won't find it. no match.
+ }
+ }
+ break; // no match
+ }
+ return false;
+ }
+ }
+
+ private static final class TestPackageMatcher extends PackageMatcher {
+ private final List<String> list;
+
+ TestPackageMatcher(String[] packages) {
+ super(packages);
+ this.list = Collections.unmodifiableList(Arrays.asList(packages));
+ }
+
+ @Override
+ public boolean matches(String pkg) {
+ final boolean match1 = super.matches(pkg);
+ boolean match2 = false;
+ String p2 = pkg + ".";
+ for (String p : list) {
+ if (pkg.startsWith(p) || p2.equals(p)) {
+ match2 = true;
+ break;
+ }
+ }
+ if (match1 != match2) {
+ System.err.println("Test Bug: PackageMatcher.matches(\"" +
+ pkg + "\") returned " + match1);
+ System.err.println("Package Access List is: " + list);
+ throw new Error("Test Bug: PackageMatcher.matches(\"" +
+ pkg + "\") returned " + match1);
+ }
+ return match1;
+ }
+ }
+
+ private static void smokeTest() {
+ // these checks should pass.
+ System.getSecurityManager().checkPackageAccess("com.sun.blah");
+ System.getSecurityManager().checkPackageAccess("com.sun.jm");
+ System.getSecurityManager().checkPackageAccess("com.sun.jmxa");
+ System.getSecurityManager().checkPackageAccess("jmx");
+ List<String> actual = Arrays.asList(packages);
+ for (String p : actual) {
+ if (!actual.contains(p)) {
+ System.err.println("Warning: '" + p + " not in package.access");
+ }
+ }
+ if (!actual.contains("sun.")) {
+ throw new Error("package.access does not contain 'sun.'");
+ }
+ }
+
+ // This is a sanity test for our own test code.
+ private static void testTheTest(String[] pkgs, char[][] chars,
+ int[][] states) {
+
+ PackageMatcher m = new TestPackageMatcher(pkgs);
+ String unexpected = "";
+ if (!Arrays.deepEquals(chars, m.chars)) {
+ System.err.println("Char arrays differ");
+ if (chars.length != m.chars.length) {
+ System.err.println("Char array lengths differ: expected="
+ + chars.length + " actual=" + m.chars.length);
+ }
+ System.err.println(Arrays.deepToString(m.chars).replace((char)0,
+ '0'));
+ unexpected = "chars[]";
+ }
+ if (!Arrays.deepEquals(states, m.states)) {
+ System.err.println("State arrays differ");
+ if (states.length != m.states.length) {
+ System.err.println("Char array lengths differ: expected="
+ + states.length + " actual=" + m.states.length);
+ }
+ System.err.println(Arrays.deepToString(m.states));
+ if (unexpected.length() > 0) {
+ unexpected = unexpected + " and ";
+ }
+ unexpected = unexpected + "states[]";
+ }
+
+ if (unexpected.length() > 0) {
+ throw new Error("Unexpected "+unexpected+" in PackageMatcher");
+ }
+
+ testMatches(m, pkgs);
+ }
+
+ // This is a sanity test for our own test code.
+ private static void testTheTest() {
+ final String[] packages2 = { "sun.", "com.sun.jmx.",
+ "com.sun.proxy.", "apple." };
+
+ final int END_STATE = PackageMatcher.END_STATE;
+ final int WILDCARD_STATE = PackageMatcher.WILDCARD_STATE;
+
+ final char[][] chars2 = {
+ { 'a', 'c', 's' }, { 'p' }, { 'p' }, { 'l' }, { 'e' }, { 0, '.' },
+ { 'o' }, { 'm' }, { '.' }, { 's' }, { 'u' }, { 'n' }, { '.' },
+ { 'j', 'p'},
+ { 'm' }, { 'x' }, { 0, '.' },
+ { 'r' }, { 'o' }, { 'x' }, { 'y' }, { 0, '.' },
+ { 'u' }, { 'n' }, { 0, '.' }
+ };
+
+ final int[][] states2 = {
+ { 1, 6, 22 }, { 2 }, { 3 }, { 4 }, { 5 },
+ { END_STATE, WILDCARD_STATE },
+ { 7 }, { 8 }, { 9 }, { 10 }, { 11 }, { 12 }, { 13 }, { 14, 17 },
+ { 15 }, { 16 }, { END_STATE, WILDCARD_STATE },
+ { 18 }, { 19 }, { 20 }, { 21 }, { END_STATE, WILDCARD_STATE },
+ { 23 }, { 24 }, { END_STATE, WILDCARD_STATE }
+ };
+
+ testTheTest(packages2, chars2, states2);
+
+ final String[] packages3 = { "sun.", "com.sun.pro.",
+ "com.sun.proxy.", "apple." };
+
+ final char[][] chars3 = {
+ { 'a', 'c', 's' }, { 'p' }, { 'p' }, { 'l' }, { 'e' }, { 0, '.' },
+ { 'o' }, { 'm' }, { '.' }, { 's' }, { 'u' }, { 'n' }, { '.' },
+ { 'p' }, { 'r' }, { 'o' }, { 0, '.', 'x' },
+ { 'y' }, { 0, '.' },
+ { 'u' }, { 'n' }, { 0, '.' }
+ };
+
+ final int[][] states3 = {
+ { 1, 6, 19 }, { 2 }, { 3 }, { 4 }, { 5 },
+ { END_STATE, WILDCARD_STATE },
+ { 7 }, { 8 }, { 9 }, { 10 }, { 11 }, { 12 }, { 13 }, { 14 },
+ { 15 }, { 16 }, { END_STATE, WILDCARD_STATE, 17 },
+ { 18 }, { END_STATE, WILDCARD_STATE },
+ { 20 }, { 21 }, { END_STATE, WILDCARD_STATE }
+ };
+
+ testTheTest(packages3, chars3, states3);
+ }
+
+ private static volatile boolean sanityTesting = false;
+
+ public static void main(String[] args) {
+ System.setSecurityManager(new SecurityManager());
+
+ // Some smoke tests.
+ smokeTest();
+ System.out.println("Smoke tests passed.");
+
+ // Test our own pattern matching algorithm. Here we actually test
+ // the PackageMatcher class from our own test code.
+ sanityTesting = true;
+ try {
+ testTheTest();
+ System.out.println("Sanity tests passed.");
+ } finally {
+ sanityTesting = false;
+ }
+
+ // Now test the package matching in the security manager.
+ PackageMatcher matcher = new TestPackageMatcher(packages);
+
+ // These should not match.
+ for (String pkg : new String[] {"gloups.machin", "su",
+ "org.jcp.xml.dsig.interna",
+ "com.sun.jm", "com.sun.jmxa"}) {
+ testMatch(matcher, pkg, false, true);
+ }
+
+ // These should match.
+ for (String pkg : Arrays.asList(
+ new String[] {"sun.gloups.machin", "sun", "sun.com",
+ "com.sun.jmx", "com.sun.jmx.a",
+ "org.jcp.xml.dsig.internal",
+ "org.jcp.xml.dsig.internal.foo"})) {
+ testMatch(matcher, pkg, true, true);
+ }
+
+ // Derive a list of packages that should match or not match from
+ // the list in 'packages' - and check that the security manager
+ // throws the appropriate exception.
+ testMatches(matcher, packages);
+ }
+
+ private static void testMatches(PackageMatcher matcher, String[] pkgs) {
+ Collection<String> pkglist = Arrays.asList(pkgs);
+ PackageMatcher ref = new TestPackageMatcher(packages);
+
+ for (String pkg : pkgs) {
+ String candidate = pkg + "toto";
+ boolean expected = true;
+ testMatch(matcher, candidate, expected,
+ ref.matches(candidate) == expected);
+ }
+
+ for (String pkg : pkgs) {
+ String candidate = pkg.substring(0, pkg.length() - 1);
+ boolean expected = pkglist.contains(candidate + ".");
+ testMatch(matcher, candidate, expected,
+ ref.matches(candidate) == expected);
+ }
+
+ for (String pkg : pkgs) {
+ if (!OPEN_JDK && pkg.equals("com.sun.media.sound.")) {
+ // don't test com.sun.media.sound since there is an entry
+ // for com.sun.media in non OpenJDK builds. Otherwise,
+ // the test for this package will fail unexpectedly.
+ continue;
+ }
+ String candidate = pkg.substring(0, pkg.length() - 2);
+ boolean expected = pkglist.contains(candidate + ".");
+ testMatch(matcher, candidate, expected,
+ ref.matches(candidate) == expected);
+ }
+ }
+
+ private static void testMatch(PackageMatcher matcher, String candidate,
+ boolean expected, boolean testSecurityManager)
+ {
+ final boolean m = matcher.matches(candidate);
+ if (m != expected) {
+ final String msg = "\"" + candidate + "\": " +
+ (m ? "matches" : "does not match");
+ throw new Error("PackageMatcher does not give expected results: "
+ + msg);
+ }
+
+ if (sanityTesting) {
+ testSecurityManager = false;
+ }
+
+ if (testSecurityManager) {
+ System.out.println("Access to " + candidate + " should be " +
+ (expected ? "rejected" : "granted"));
+ final String errormsg = "\"" + candidate + "\" : " +
+ (expected ? "granted" : "not granted");
+ try {
+ System.getSecurityManager().checkPackageAccess(candidate);
+ if (expected) {
+ System.err.println(errormsg);
+ throw new Error("Expected exception not thrown: " +
+ errormsg);
+ }
+ } catch (SecurityException x) {
+ if (!expected) {
+ System.err.println(errormsg);
+ throw new Error(errormsg + " - unexpected exception: " +
+ x, x);
+ } else {
+ System.out.println("Got expected exception: " + x);
+ }
+ }
+ }
+ }
+
+ private static boolean isOpenJDKOnly() {
+ String prop = System.getProperty("java.runtime.name");
+ return prop != null && prop.startsWith("OpenJDK");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/SecurityManager/RestrictedPackages.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.Security;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * A collection of utility methods and constants for testing the package
+ * access and package definition security checks.
+ */
+final class RestrictedPackages {
+
+ /*
+ * The expected list of restricted packages.
+ *
+ * This array should be updated whenever new packages are added to the
+ * package.access property in the java.security file
+ * NOTE: it should be in the same order as the java.security file
+ */
+ static final String[] EXPECTED = {
+ "sun.",
+ "com.sun.xml.internal.",
+ "com.sun.imageio.",
+ "com.sun.istack.internal.",
+ "com.sun.jmx.",
+ "com.sun.media.sound.",
+ "com.sun.naming.internal.",
+ "com.sun.proxy.",
+ "com.sun.corba.se.",
+ "com.sun.org.apache.bcel.internal.",
+ "com.sun.org.apache.regexp.internal.",
+ "com.sun.org.apache.xerces.internal.",
+ "com.sun.org.apache.xpath.internal.",
+ "com.sun.org.apache.xalan.internal.extensions.",
+ "com.sun.org.apache.xalan.internal.lib.",
+ "com.sun.org.apache.xalan.internal.res.",
+ "com.sun.org.apache.xalan.internal.templates.",
+ "com.sun.org.apache.xalan.internal.utils.",
+ "com.sun.org.apache.xalan.internal.xslt.",
+ "com.sun.org.apache.xalan.internal.xsltc.cmdline.",
+ "com.sun.org.apache.xalan.internal.xsltc.compiler.",
+ "com.sun.org.apache.xalan.internal.xsltc.trax.",
+ "com.sun.org.apache.xalan.internal.xsltc.util.",
+ "com.sun.org.apache.xml.internal.res.",
+ "com.sun.org.apache.xml.internal.security.",
+ "com.sun.org.apache.xml.internal.serializer.utils.",
+ "com.sun.org.apache.xml.internal.utils.",
+ "com.sun.org.glassfish.",
+ "com.sun.tools.script.",
+ "com.oracle.xmlns.internal.",
+ "com.oracle.webservices.internal.",
+ "org.jcp.xml.dsig.internal.",
+ "jdk.internal.",
+ "jdk.nashorn.internal.",
+ "jdk.nashorn.tools.",
+ "jdk.tools.jimage.",
+ "com.sun.activation.registries."
+ };
+
+ /*
+ * A non-exhaustive list of restricted packages.
+ *
+ * Contrary to what is in the EXPECTED list, this list does not need
+ * to be exhaustive.
+ */
+ static final String[] EXPECTED_NONEXHAUSTIVE = {
+ "sun.",
+ "com.sun.xml.internal.",
+ "com.sun.imageio.",
+ "com.sun.istack.internal.",
+ "com.sun.jmx.",
+ "com.sun.proxy.",
+ "com.sun.org.apache.bcel.internal.",
+ "com.sun.org.apache.regexp.internal.",
+ "com.sun.org.apache.xerces.internal.",
+ "com.sun.org.apache.xpath.internal.",
+ "com.sun.org.apache.xalan.internal.extensions.",
+ "com.sun.org.apache.xalan.internal.lib.",
+ "com.sun.org.apache.xalan.internal.res.",
+ "com.sun.org.apache.xalan.internal.templates.",
+ "com.sun.org.apache.xalan.internal.utils.",
+ "com.sun.org.apache.xalan.internal.xslt.",
+ "com.sun.org.apache.xalan.internal.xsltc.cmdline.",
+ "com.sun.org.apache.xalan.internal.xsltc.compiler.",
+ "com.sun.org.apache.xalan.internal.xsltc.trax.",
+ "com.sun.org.apache.xalan.internal.xsltc.util.",
+ "com.sun.org.apache.xml.internal.res.",
+ "com.sun.org.apache.xml.internal.serializer.utils.",
+ "com.sun.org.apache.xml.internal.utils.",
+ "com.sun.org.apache.xml.internal.security.",
+ "com.sun.org.glassfish.",
+ "org.jcp.xml.dsig.internal."
+ };
+
+ private static final String OS_NAME = System.getProperty("os.name");
+
+ /**
+ * Returns a list of expected restricted packages, including any
+ * OS specific packages. The returned list is mutable.
+ */
+ static List<String> expected() {
+ List<String> pkgs = new ArrayList<>(Arrays.asList(EXPECTED));
+ if (OS_NAME.contains("OS X")) {
+ pkgs.add("apple."); // add apple package for OS X
+ }
+ return pkgs;
+ }
+
+ /**
+ * Returns a list of actual restricted packages. The returned list
+ * is mutable.
+ */
+ static List<String> actual() {
+ String prop = Security.getProperty("package.access");
+ List<String> packages = new ArrayList<>();
+ if (prop != null && !prop.equals("")) {
+ StringTokenizer tok = new StringTokenizer(prop, ",");
+ while (tok.hasMoreElements()) {
+ String s = tok.nextToken().trim();
+ packages.add(s);
+ }
+ }
+ return packages;
+ }
+
+ private RestrictedPackages() { }
+}
--- a/jdk/test/java/lang/annotation/TypeAnnotationReflection.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/annotation/TypeAnnotationReflection.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8004698 8007073 8022343
+ * @bug 8004698 8007073 8022343 8054304 8058595
* @summary Unit test for type annotations
*/
@@ -200,6 +200,17 @@
check(annos.length == 1);
check(annos[0].annotationType().equals(TypeAnno.class));
check(((TypeAnno)annos[0]).value().equals("M Runnable"));
+
+ // Check that AnnotatedTypeVariable.getAnnotatedBounds() returns jlO for a naked
+ // type variable (i.e no bounds, no annotations)
+ Method m4 = TestClassTypeVarAndField.class.getDeclaredMethod("foo4", (Class<?>[])null);
+ AnnotatedType ret4 = m4.getAnnotatedReturnType();
+ AnnotatedType[] annotatedBounds4 = ((AnnotatedTypeVariable)ret4).getAnnotatedBounds();
+ check(annotatedBounds4.length == 1);
+
+ annos = annotatedBounds4[0].getAnnotations();
+ check(annos.length == 0);
+ check(annotatedBounds4[0].getType().equals(Object.class));
}
private static void testFields() throws Exception {
@@ -231,7 +242,7 @@
private static void testClassTypeVar() throws Exception {
TypeVariable[] typeVars = TestClassTypeVarAndField.class.getTypeParameters();
Annotation[] annos;
- check(typeVars.length == 2);
+ check(typeVars.length == 3);
// First TypeVar
AnnotatedType[] annotatedBounds = typeVars[0].getAnnotatedBounds();
@@ -262,6 +273,14 @@
check(annos.length == 1);
check(annos[0].annotationType().equals(TypeAnno2.class));
check(((TypeAnno2)annos[0]).value().equals("EEBound"));
+
+ // third Typevar V declared without explicit bounds should see jlO as its bound.
+ annotatedBounds = typeVars[2].getAnnotatedBounds();
+ check(annotatedBounds.length == 1);
+
+ annos = annotatedBounds[0].getAnnotations();
+ check(annos.length == 0);
+ check(annotatedBounds[0].getType().equals(Object.class));
}
private static void testMethodTypeVar() throws Exception {
@@ -282,7 +301,7 @@
// Second method
m2 = TestClassTypeVarAndField.class.getDeclaredMethod("foo3", (Class<?>[])null);
t = m2.getTypeParameters();
- check(t.length == 1);
+ check(t.length == 2);
annos = t[0].getAnnotations();
check(annos.length == 1);
check(annos[0].annotationType().equals(TypeAnno.class));
@@ -293,6 +312,14 @@
annos = annotatedBounds2[0].getAnnotations();
check(annos.length == 0);
+
+ // for the naked type variable L of foo3, we should see jlO as its bound.
+ annotatedBounds2 = t[1].getAnnotatedBounds();
+ check(annotatedBounds2.length == 1);
+ check(annotatedBounds2[0].getType().equals(Object.class));
+
+ annos = annotatedBounds2[0].getAnnotations();
+ check(annos.length == 0);
}
private static void testParameterizedType() {
@@ -357,9 +384,24 @@
w = (AnnotatedWildcardType)((AnnotatedParameterizedType)f
.getAnnotatedType()).getAnnotatedActualTypeArguments()[0];
t = w.getAnnotatedUpperBounds();
- check(t.length == 0);
+ check(t.length == 1);
+ check(t[0].getType().equals(Object.class));
+ annos = t[0].getAnnotations();
+ check(annos.length == 0);
t = w.getAnnotatedLowerBounds();
check(t.length == 1);
+
+ // for an unbounded wildcard, we should see jlO as its upperbound and null type as its lower bound.
+ f = TestWildcardType.class.getDeclaredField("f3");
+ w = (AnnotatedWildcardType)((AnnotatedParameterizedType)f
+ .getAnnotatedType()).getAnnotatedActualTypeArguments()[0];
+ t = w.getAnnotatedUpperBounds();
+ check(t.length == 1);
+ check(t[0].getType().equals(Object.class));
+ annos = t[0].getAnnotations();
+ check(annos.length == 0);
+ t = w.getAnnotatedLowerBounds();
+ check(t.length == 0);
}
private static void testParameterTypes() throws Exception {
@@ -515,6 +557,7 @@
public <T> List<? super T> foo() { return null;}
public Class<@TypeAnno("1") ? extends @TypeAnno("2") Annotation> f1;
public Class<@TypeAnno("3") ? super @TypeAnno("4") Annotation> f2;
+ public Class<@TypeAnno("5") ?> f3;
}
abstract class TestParameterizedType implements @TypeAnno("M") Map<@TypeAnno("S")String, @TypeAnno("I") @TypeAnno2("I2")Integer> {
@@ -555,14 +598,15 @@
abstract class TestClassTypeVarAndField <T extends @TypeAnno("Object1") Object
& @TypeAnno("Runnable1") @TypeAnno2("Runnable2") Runnable,
- @TypeAnno("EE")EE extends @TypeAnno2("EEBound") Runnable > {
+ @TypeAnno("EE")EE extends @TypeAnno2("EEBound") Runnable, V > {
@TypeAnno("T1 field") @TypeAnno2("T2 field") T field1;
T field2;
@TypeAnno("Object field") Object field3;
public @TypeAnno("t1") @TypeAnno2("t2") T foo(){ return null; }
public <M extends @TypeAnno("M Runnable") Runnable> M foo2() {return null;}
- public <@TypeAnno("K") K extends Cloneable> K foo3() {return null;}
+ public <@TypeAnno("K") K extends Cloneable, L> K foo3() {return null;}
+ public <L> L foo4() {return null;}
}
@Target(ElementType.TYPE_USE)
--- a/jdk/test/java/lang/invoke/LFCaching/LFCachingTestCase.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/invoke/LFCaching/LFCachingTestCase.java Wed Jul 05 20:38:32 2017 +0200
@@ -77,7 +77,7 @@
}
} catch (IllegalAccessException | IllegalArgumentException |
SecurityException | InvocationTargetException ex) {
- throw new Error("Unexpected exception: ", ex);
+ throw new Error("Unexpected exception", ex);
}
}
}
--- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java Wed Jul 05 20:38:32 2017 +0200
@@ -24,6 +24,7 @@
/*
* @test LFGarbageCollectedTest
* @bug 8046703
+ * @key randomness
* @ignore 8078602
* @summary Test verifies that lambda forms are garbage collected
* @author kshefov
@@ -73,7 +74,7 @@
try {
adapter = testCase.getTestCaseMH(data, TestMethods.Kind.ONE);
} catch (NoSuchMethodException ex) {
- throw new Error("Unexpected exception: ", ex);
+ throw new Error("Unexpected exception", ex);
}
mtype = adapter.type();
Object lambdaForm = INTERNAL_FORM.invoke(adapter);
@@ -94,7 +95,7 @@
collectLambdaForm();
} catch (IllegalAccessException | IllegalArgumentException |
InvocationTargetException ex) {
- throw new Error("Unexpected exception: ", ex);
+ throw new Error("Unexpected exception", ex);
}
}
--- a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
/*
* @test LFMultiThreadCachingTest
* @bug 8046703
+ * @key randomness
* @summary Test verifies that lambda forms are cached when run with multiple threads
* @author kshefov
* @library /lib/testlibrary/jsr292 /lib/testlibrary
@@ -35,18 +36,23 @@
*/
import java.lang.invoke.MethodHandle;
+import java.util.Collections;
import java.util.EnumSet;
+import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
+import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
/**
* Multiple threaded lambda forms caching test class.
*/
public final class LFMultiThreadCachingTest extends LFCachingTestCase {
+
private static final TestMethods.Kind[] KINDS;
+
static {
EnumSet<TestMethods.Kind> set = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
KINDS = set.toArray(new TestMethods.Kind[set.size()]);
@@ -72,21 +78,55 @@
ConcurrentLinkedQueue<MethodHandle> adapters = new ConcurrentLinkedQueue<>();
CyclicBarrier begin = new CyclicBarrier(CORES);
CountDownLatch end = new CountDownLatch(CORES);
+ final Map<Thread, Throwable> threadUncaughtExceptions
+ = Collections.synchronizedMap(new HashMap<Thread, Throwable>(CORES));
+ Thread.UncaughtExceptionHandler exHandler = (t, e) -> {
+ threadUncaughtExceptions.put(t, e);
+ };
for (int i = 0; i < CORES; ++i) {
TestMethods.Kind kind = KINDS[i % KINDS.length];
- new Thread(() -> {
+ Thread t = new Thread(() -> {
try {
begin.await();
adapters.add(getTestMethod().getTestCaseMH(data, kind));
- } catch (InterruptedException | BrokenBarrierException | IllegalAccessException | NoSuchMethodException ex) {
- throw new Error("Unexpected exception: ", ex);
+ } catch (InterruptedException | BrokenBarrierException
+ | IllegalAccessException | NoSuchMethodException ex) {
+ throw new Error("Unexpected exception", ex);
} finally {
end.countDown();
}
- }).start();
+ });
+ t.setUncaughtExceptionHandler(exHandler);
+ t.start();
}
try {
end.await();
+ boolean vmeThrown = false;
+ boolean nonVmeThrown = false;
+ Throwable vme = null;
+ for (Map.Entry<Thread,
+ Throwable> entry : threadUncaughtExceptions.entrySet()) {
+ Thread t = entry.getKey();
+ Throwable e = entry.getValue();
+ System.err.printf("%nA thread with name \"%s\" of %d threads"
+ + " has thrown exception:%n", t.getName(), CORES);
+ e.printStackTrace();
+ if (CodeCacheOverflowProcessor.isThrowableCausedByVME(e)) {
+ vmeThrown = true;
+ vme = e;
+ } else {
+ nonVmeThrown = true;
+ }
+ if (nonVmeThrown) {
+ throw new Error("One ore more threads have"
+ + " thrown unexpected exceptions. See log.");
+ }
+ if (vmeThrown) {
+ throw new Error("One ore more threads have"
+ + " thrown VirtualMachineError caused by"
+ + " code cache overflow. See log.", vme);
+ }
+ }
} catch (InterruptedException ex) {
throw new Error("Unexpected exception: ", ex);
}
--- a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
/*
* @test LFSingleThreadCachingTest
* @bug 8046703
+ * @key randomness
* @summary Test verifies that lambda forms are cached when run with single thread
* @author kshefov
* @library /lib/testlibrary/jsr292 /lib/testlibrary
@@ -62,7 +63,7 @@
adapter1 = getTestMethod().getTestCaseMH(data, TestMethods.Kind.ONE);
adapter2 = getTestMethod().getTestCaseMH(data, TestMethods.Kind.TWO);
} catch (NoSuchMethodException | IllegalAccessException ex) {
- throw new Error("Unexpected exception: ", ex);
+ throw new Error("Unexpected exception", ex);
}
checkLFCaching(adapter1, adapter2);
}
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
*/
import com.oracle.testlibrary.jsr292.Helper;
-import com.sun.management.HotSpotDiagnosticMXBean;
+import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
import java.lang.invoke.MethodHandle;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
@@ -44,8 +44,6 @@
*/
public abstract class LambdaFormTestCase {
- private static final double ITERATIONS_TO_CODE_CACHE_SIZE_RATIO
- = 45 / (128.0 * 1024 * 1024);
private static final long TIMEOUT = Helper.IS_THOROUGH ? 0L : (long) (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) * 0.9);
/**
@@ -72,7 +70,7 @@
REF_FIELD = Reference.class.getDeclaredField("referent");
REF_FIELD.setAccessible(true);
} catch (Exception ex) {
- throw new Error("Unexpected exception: ", ex);
+ throw new Error("Unexpected exception", ex);
}
gcInfo = ManagementFactory.getGarbageCollectorMXBeans();
@@ -101,28 +99,6 @@
long iterations = Math.max(1, Helper.TEST_LIMIT / testCaseNum);
System.out.printf("Number of iterations according to -DtestLimit is %d (%d cases)%n",
iterations, iterations * testCaseNum);
- HotSpotDiagnosticMXBean hsDiagBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
- long codeCacheSize = Long.parseLong(
- hsDiagBean.getVMOption("ReservedCodeCacheSize").getValue());
- System.out.printf("Code cache size is %d bytes%n", codeCacheSize);
- long iterationsByCodeCacheSize = (long) (codeCacheSize
- * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO);
- long nonProfiledCodeCacheSize = Long.parseLong(
- hsDiagBean.getVMOption("NonProfiledCodeHeapSize").getValue());
- System.out.printf("Non-profiled code cache size is %d bytes%n", nonProfiledCodeCacheSize);
- long iterationsByNonProfiledCodeCacheSize = (long) (nonProfiledCodeCacheSize
- * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO);
- System.out.printf("Number of iterations limited by code cache size is %d (%d cases)%n",
- iterationsByCodeCacheSize, iterationsByCodeCacheSize * testCaseNum);
- System.out.printf("Number of iterations limited by non-profiled code cache size is %d (%d cases)%n",
- iterationsByNonProfiledCodeCacheSize, iterationsByNonProfiledCodeCacheSize * testCaseNum);
- iterations = Math.min(iterationsByCodeCacheSize,
- Math.min(iterations, iterationsByNonProfiledCodeCacheSize));
- if (iterations == 0) {
- System.out.println("Warning: code cache size is too small to provide at"
- + " least one iteration! Test will try to do one iteration.");
- iterations = 1;
- }
System.out.printf("Number of iterations is set to %d (%d cases)%n",
iterations, iterations * testCaseNum);
System.out.flush();
@@ -141,22 +117,27 @@
for (TestMethods testMethod : testMethods) {
LambdaFormTestCase testCase = ctor.apply(testMethod);
try {
- System.err.printf("Tested LF caching feature with MethodHandles.%s method.%n",
+ System.err.printf("Tested LF caching feature"
+ + " with MethodHandles.%s method.%n",
testCase.getTestMethod().name);
- testCase.doTest();
+ Throwable t = CodeCacheOverflowProcessor
+ .runMHTest(testCase::doTest);
+ if (t != null) {
+ return false;
+ }
System.err.println("PASSED");
- } catch (OutOfMemoryError e) {
+ } catch (OutOfMemoryError oome) {
// Don't swallow OOME so a heap dump can be created.
System.err.println("FAILED");
- throw e;
+ throw oome;
} catch (Throwable t) {
t.printStackTrace();
System.err.printf("FAILED. Caused by %s%n", t.getMessage());
passed = false;
failCounter++;
}
- testCounter++;
- }
+ testCounter++;
+ }
doneIterations++;
return true;
}
@@ -205,8 +186,8 @@
* @param testMethods list of test methods
*/
public static void runTests(Function<TestMethods, LambdaFormTestCase> ctor, Collection<TestMethods> testMethods) {
- LambdaFormTestCase.TestRun run =
- new LambdaFormTestCase.TestRun(ctor, testMethods);
+ LambdaFormTestCase.TestRun run
+ = new LambdaFormTestCase.TestRun(ctor, testMethods);
TimeLimitedRunner runner = new TimeLimitedRunner(TIMEOUT, 4.0d, run::doIteration);
try {
runner.call();
--- a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
package test.java.lang.invoke.MethodHandles;
import com.oracle.testlibrary.jsr292.Helper;
+import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
import jdk.testlibrary.Asserts;
import jdk.testlibrary.TimeLimitedRunner;
import jdk.testlibrary.Utils;
@@ -35,7 +36,6 @@
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
-import java.util.concurrent.TimeUnit;
/* @test
* @library /lib/testlibrary/jsr292 /lib/testlibrary/
@@ -91,6 +91,10 @@
}
public static void main(String[] args) throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(CatchExceptionTest::test);
+ }
+
+ public static void test() throws Throwable {
System.out.println("classes = " + ARGS_CLASSES);
TestFactory factory = new TestFactory();
@@ -116,7 +120,6 @@
return Helper.getParams(ARGS_CLASSES, isVararg, argsCount);
}
-
private List<Class<?>> getCatcherParams() {
int catchArgc = 1 + this.argsCount - dropped;
List<Class<?>> result = new ArrayList<>(
--- a/jdk/test/java/lang/invoke/MethodHandlesTest.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/invoke/MethodHandlesTest.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
/* @test
* @summary unit tests for java.lang.invoke.MethodHandles
+ * @library /lib/testlibrary /lib/testlibrary/jsr292
* @compile MethodHandlesTest.java remote/RemoteExample.java
* @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -esa test.java.lang.invoke.MethodHandlesTest
*/
@@ -36,6 +37,7 @@
import java.util.*;
import org.junit.*;
import static org.junit.Assert.*;
+import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
/**
@@ -499,6 +501,10 @@
@Test
public void testFindStatic() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFindStatic0);
+ }
+
+ public void testFindStatic0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("findStatic");
testFindStatic(PubExample.class, void.class, "s0");
@@ -586,6 +592,10 @@
@Test
public void testFindVirtual() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFindVirtual0);
+ }
+
+ public void testFindVirtual0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("findVirtual");
testFindVirtual(Example.class, void.class, "v0");
@@ -616,6 +626,10 @@
@Test
public void testFindVirtualClone() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFindVirtualClone0);
+ }
+
+ public void testFindVirtualClone0() throws Throwable {
// test some ad hoc system methods
testFindVirtual(false, PUBLIC, Object.class, Object.class, "clone");
testFindVirtual(true, PUBLIC, Object[].class, Object.class, "clone");
@@ -699,6 +713,10 @@
@Test
public void testFindSpecial() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFindSpecial0);
+ }
+
+ public void testFindSpecial0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("findSpecial");
testFindSpecial(SubExample.class, Example.class, void.class, "v0");
@@ -775,6 +793,10 @@
@Test
public void testFindConstructor() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFindConstructor0);
+ }
+
+ public void testFindConstructor0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("findConstructor");
testFindConstructor(true, EXAMPLE, Example.class);
@@ -818,6 +840,10 @@
@Test
public void testBind() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testBind0);
+ }
+
+ public void testBind0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("bind");
testBind(Example.class, void.class, "v0");
@@ -879,6 +905,10 @@
@Test
public void testUnreflect() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testUnreflect0);
+ }
+
+ public void testUnreflect0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("unreflect");
testUnreflect(Example.class, true, void.class, "s0");
@@ -985,6 +1015,10 @@
@Test
public void testUnreflectSpecial() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testUnreflectSpecial0);
+ }
+
+ public void testUnreflectSpecial0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("unreflectSpecial");
testUnreflectSpecial(Example.class, Example.class, void.class, "v0");
@@ -1077,23 +1111,38 @@
@Test
public void testUnreflectGetter() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testUnreflectGetter0);
+ }
+
+ public void testUnreflectGetter0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("unreflectGetter");
testGetter(TEST_UNREFLECT);
}
+
@Test
public void testFindGetter() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFindGetter0);
+ }
+
+ public void testFindGetter0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("findGetter");
testGetter(TEST_FIND_FIELD);
testGetter(TEST_FIND_FIELD | TEST_BOUND);
}
+
@Test
public void testFindStaticGetter() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFindStaticGetter0);
+ }
+
+ public void testFindStaticGetter0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("findStaticGetter");
testGetter(TEST_FIND_STATIC);
}
+
public void testGetter(int testMode) throws Throwable {
Lookup lookup = PRIVATE; // FIXME: test more lookups than this one
for (Object[] c : HasFields.CASES) {
@@ -1287,26 +1336,40 @@
}
}
-
@Test
public void testUnreflectSetter() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testUnreflectSetter0);
+ }
+
+ public void testUnreflectSetter0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("unreflectSetter");
testSetter(TEST_UNREFLECT);
}
+
@Test
public void testFindSetter() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFindSetter0);
+ }
+
+ public void testFindSetter0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("findSetter");
testSetter(TEST_FIND_FIELD);
testSetter(TEST_FIND_FIELD | TEST_BOUND);
}
+
@Test
public void testFindStaticSetter() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFindStaticSetter0);
+ }
+
+ public void testFindStaticSetter0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("findStaticSetter");
testSetter(TEST_FIND_STATIC);
}
+
public void testSetter(int testMode) throws Throwable {
Lookup lookup = PRIVATE; // FIXME: test more lookups than this one
startTest("unreflectSetter");
@@ -1329,6 +1392,10 @@
@Test
public void testArrayElementGetter() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testArrayElementGetter0);
+ }
+
+ public void testArrayElementGetter0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("arrayElementGetter");
testArrayElementGetterSetter(false);
@@ -1336,6 +1403,10 @@
@Test
public void testArrayElementSetter() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testArrayElementSetter0);
+ }
+
+ public void testArrayElementSetter0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("arrayElementSetter");
testArrayElementGetterSetter(true);
@@ -1349,6 +1420,10 @@
@Test
public void testArrayElementErrors() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testArrayElementErrors0);
+ }
+
+ public void testArrayElementErrors0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("arrayElementErrors");
testArrayElementGetterSetter(false, TEST_ARRAY_NPE);
@@ -1528,6 +1603,10 @@
@Test
public void testConvertArguments() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testConvertArguments0);
+ }
+
+ public void testConvertArguments0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("convertArguments");
testConvert(Callee.ofType(1), null, "id", int.class);
@@ -1591,6 +1670,10 @@
@Test
public void testVarargsCollector() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testVarargsCollector0);
+ }
+
+ public void testVarargsCollector0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("varargsCollector");
MethodHandle vac0 = PRIVATE.findStatic(MethodHandlesTest.class, "called",
@@ -1605,8 +1688,12 @@
}
}
- @Test // SLOW
+ @Test // SLOW
public void testPermuteArguments() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testPermuteArguments0);
+ }
+
+ public void testPermuteArguments0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("permuteArguments");
testPermuteArguments(4, Integer.class, 2, long.class, 6);
@@ -1744,8 +1831,12 @@
}
- @Test // SLOW
+ @Test // SLOW
public void testSpreadArguments() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testSpreadArguments0);
+ }
+
+ public void testSpreadArguments0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("spreadArguments");
for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) {
@@ -1838,8 +1929,12 @@
}
}
- @Test // SLOW
+ @Test // SLOW
public void testAsCollector() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testAsCollector0);
+ }
+
+ public void testAsCollector0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("asCollector");
for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) {
@@ -1880,8 +1975,12 @@
assertArrayEquals(collectedArgs, returnValue);
}
- @Test // SLOW
+ @Test // SLOW
public void testInsertArguments() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testInsertArguments0);
+ }
+
+ public void testInsertArguments0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("insertArguments");
for (int nargs = 0; nargs < 50; nargs++) {
@@ -1923,6 +2022,10 @@
@Test
public void testFilterReturnValue() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFilterReturnValue0);
+ }
+
+ public void testFilterReturnValue0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("filterReturnValue");
Class<?> classOfVCList = varargsList(1).invokeWithArguments(0).getClass();
@@ -1972,6 +2075,10 @@
@Test
public void testFilterArguments() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFilterArguments0);
+ }
+
+ public void testFilterArguments0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("filterArguments");
for (int nargs = 1; nargs <= 6; nargs++) {
@@ -2004,6 +2111,10 @@
@Test
public void testCollectArguments() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testCollectArguments0);
+ }
+
+ public void testCollectArguments0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("collectArguments");
testFoldOrCollectArguments(true);
@@ -2011,6 +2122,10 @@
@Test
public void testFoldArguments() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testFoldArguments0);
+ }
+
+ public void testFoldArguments0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("foldArguments");
testFoldOrCollectArguments(false);
@@ -2112,6 +2227,10 @@
@Test
public void testDropArguments() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testDropArguments0);
+ }
+
+ public void testDropArguments0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("dropArguments");
for (int nargs = 0; nargs <= 4; nargs++) {
@@ -2143,6 +2262,10 @@
@Test // SLOW
public void testInvokers() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testInvokers0);
+ }
+
+ public void testInvokers0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("exactInvoker, genericInvoker, varargsInvoker, dynamicInvoker");
// exactInvoker, genericInvoker, varargsInvoker[0..N], dynamicInvoker
@@ -2344,6 +2467,10 @@
@Test
public void testGuardWithTest() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testGuardWithTest0);
+ }
+
+ public void testGuardWithTest0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("guardWithTest");
for (int nargs = 0; nargs <= 50; nargs++) {
@@ -2415,6 +2542,10 @@
@Test
public void testThrowException() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testThrowException0);
+ }
+
+ public void testThrowException0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("throwException");
testThrowException(int.class, new ClassCastException("testing"));
@@ -2446,6 +2577,10 @@
@Test
public void testInterfaceCast() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testInterfaceCast0);
+ }
+
+ public void testInterfaceCast0() throws Throwable {
//if (CAN_SKIP_WORKING) return;
startTest("interfaceCast");
assert( (((Object)"foo") instanceof CharSequence));
@@ -2543,6 +2678,10 @@
@Test // SLOW
public void testCastFailure() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testCastFailure0);
+ }
+
+ public void testCastFailure0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("testCastFailure");
testCastFailure("cast/argument", 11000);
@@ -2655,6 +2794,10 @@
@Test
public void testUserClassInSignature() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testUserClassInSignature0);
+ }
+
+ public void testUserClassInSignature0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("testUserClassInSignature");
Lookup lookup = MethodHandles.lookup();
@@ -2706,6 +2849,10 @@
@Test
public void testAsInterfaceInstance() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testAsInterfaceInstance0);
+ }
+
+ public void testAsInterfaceInstance0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("asInterfaceInstance");
Lookup lookup = MethodHandles.lookup();
@@ -2869,6 +3016,10 @@
@Test
public void testRunnableProxy() throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(this::testRunnableProxy0);
+ }
+
+ public void testRunnableProxy0() throws Throwable {
if (CAN_SKIP_WORKING) return;
startTest("testRunnableProxy");
MethodHandles.Lookup lookup = MethodHandles.lookup();
--- a/jdk/test/java/lang/invoke/TestCatchExceptionWithVarargs.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/invoke/TestCatchExceptionWithVarargs.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,12 @@
/*
* @test
* @bug 8019184
+ * @library /lib/testlibrary /lib/testlibrary/jsr292
* @summary MethodHandles.catchException() fails when methods have 8 args + varargs
+ * @run main TestCatchExceptionWithVarargs
*/
+import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
import java.util.*;
import java.lang.invoke.*;
@@ -68,6 +71,11 @@
}
public static void main(String[] args) throws Throwable {
+ CodeCacheOverflowProcessor
+ .runMHTest(TestCatchExceptionWithVarargs::test);
+ }
+
+ public static void test() throws Throwable {
List<Class<?>> ptypes = new LinkedList<>();
ptypes.add(Object[].class);
--- a/jdk/test/java/lang/invoke/VarargsArrayTest.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/lang/invoke/VarargsArrayTest.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,14 +24,14 @@
package java.lang.invoke;
import sun.invoke.util.Wrapper;
-
import java.util.Arrays;
import java.util.Collections;
+import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
/* @test
* @summary unit tests for varargs array methods: MethodHandleInfo.varargsArray(int),
* MethodHandleInfo.varargsArray(Class,int) & MethodHandleInfo.varargsList(int)
- *
+ * @library /lib/testlibrary /lib/testlibrary/jsr292
* @run main/bootclasspath java.lang.invoke.VarargsArrayTest
* @run main/bootclasspath -DVarargsArrayTest.MAX_ARITY=255 -DVarargsArrayTest.START_ARITY=250
* java.lang.invoke.VarargsArrayTest
@@ -47,6 +47,10 @@
private static final boolean EXHAUSTIVE = Boolean.getBoolean(CLASS.getSimpleName()+".EXHAUSTIVE");
public static void main(String[] args) throws Throwable {
+ CodeCacheOverflowProcessor.runMHTest(VarargsArrayTest::test);
+ }
+
+ public static void test() throws Throwable {
testVarargsArray();
testVarargsReferenceArray();
testVarargsPrimitiveArray();
--- a/jdk/test/java/nio/channels/DatagramChannel/EmptyBuffer.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/EmptyBuffer.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,39 +27,50 @@
* @author Mike McCloskey
*/
-import java.io.*;
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
-import java.nio.charset.*;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.ClosedByInterruptException;
+import java.nio.channels.DatagramChannel;
public class EmptyBuffer {
- static PrintStream log = System.err;
+ private static final PrintStream log = System.err;
public static void main(String[] args) throws Exception {
test();
}
- static void test() throws Exception {
- Server server = new Server();
+ private static void test() throws Exception {
+ DatagramChannel dc = DatagramChannel.open();
+ InetAddress localHost = InetAddress.getLocalHost();
+ dc.bind(new InetSocketAddress(localHost, 0));
+
+ Server server = new Server(dc.getLocalAddress());
Thread serverThread = new Thread(server);
serverThread.start();
- DatagramChannel dc = DatagramChannel.open();
+
try {
+ InetSocketAddress isa = new InetSocketAddress(localHost, server.port());
+ dc.connect(isa);
+
ByteBuffer bb = ByteBuffer.allocateDirect(12);
bb.order(ByteOrder.BIG_ENDIAN);
bb.putInt(1).putLong(1);
bb.flip();
- InetAddress address = InetAddress.getLocalHost();
- InetSocketAddress isa = new InetSocketAddress(address, server.port());
- dc.connect(isa);
+
dc.write(bb);
bb.rewind();
dc.write(bb);
bb.rewind();
dc.write(bb);
+
Thread.sleep(2000);
+
serverThread.interrupt();
server.throwException();
} finally {
@@ -67,12 +78,14 @@
}
}
- public static class Server implements Runnable {
- final DatagramChannel dc;
- Exception e = null;
+ private static class Server implements Runnable {
+ private final DatagramChannel dc;
+ private final SocketAddress clientAddress;
+ private Exception e = null;
- Server() throws IOException {
+ Server(SocketAddress clientAddress) throws IOException {
this.dc = DatagramChannel.open().bind(new InetSocketAddress(0));
+ this.clientAddress = clientAddress;
}
int port() {
@@ -94,30 +107,37 @@
log.println();
}
+ @Override
public void run() {
- SocketAddress sa = null;
- int numberReceived = 0;
try {
ByteBuffer bb = ByteBuffer.allocateDirect(12);
bb.clear();
// Only one clear. The buffer will be full after
// the first receive, but it should still block
// and receive and discard the next two
+ int numberReceived = 0;
while (!Thread.interrupted()) {
+ SocketAddress sa;
try {
sa = dc.receive(bb);
} catch (ClosedByInterruptException cbie) {
// Expected
log.println("Took expected exit");
+ // Verify that enough packets were received
+ if (numberReceived != 3)
+ throw new RuntimeException("Failed: Too few datagrams");
break;
}
if (sa != null) {
log.println("Client: " + sa);
- showBuffer("RECV", bb);
+ // Check client address so as not to count stray packets
+ if (sa.equals(clientAddress)) {
+ showBuffer("RECV", bb);
+ numberReceived++;
+ }
+ if (numberReceived > 3)
+ throw new RuntimeException("Failed: Too many datagrams");
sa = null;
- numberReceived++;
- if (numberReceived > 3)
- throw new RuntimeException("Test failed");
}
}
} catch (Exception ex) {
@@ -127,5 +147,4 @@
}
}
}
-
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/SecureClassLoader/DefineClass.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.net.URL;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.security.SecureClassLoader;
+import java.security.cert.Certificate;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.Collections;
+import java.util.List;
+import java.util.PropertyPermission;
+
+/*
+ * @test
+ * @bug 6826789
+ * @summary Make sure equivalent ProtectionDomains are granted the same
+ * permissions when the CodeSource URLs are different but resolve
+ * to the same ip address after name service resolution.
+ * @run main/othervm/java.security.policy=DefineClass.policy DefineClass
+ */
+
+public class DefineClass {
+
+ // permissions that are expected to be granted by the policy file
+ private final static Permission[] GRANTED_PERMS = new Permission[] {
+ new PropertyPermission("user.home", "read"),
+ new PropertyPermission("user.name", "read")
+ };
+
+ // Base64 encoded bytes of a simple class: "public class Foo {}"
+ private final static String FOO_CLASS =
+ "yv66vgAAADQADQoAAwAKBwALBwAMAQAGPGluaXQ+AQADKClWAQAEQ29kZQEA" +
+ "D0xpbmVOdW1iZXJUYWJsZQEAClNvdXJjZUZpbGUBAAhGb28uamF2YQwABAAF" +
+ "AQADRm9vAQAQamF2YS9sYW5nL09iamVjdAAhAAIAAwAAAAAAAQABAAQABQAB" +
+ "AAYAAAAdAAEAAQAAAAUqtwABsQAAAAEABwAAAAYAAQAAAAEAAQAIAAAAAgAJ";
+
+ // Base64 encoded bytes of a simple class: "public class Bar {}"
+ private final static String BAR_CLASS =
+ "yv66vgAAADQADQoAAwAKBwALBwAMAQAGPGluaXQ+AQADKClWAQAEQ29kZQEA" +
+ "D0xpbmVOdW1iZXJUYWJsZQEAClNvdXJjZUZpbGUBAAhCYXIuamF2YQwABAAF" +
+ "AQADQmFyAQAQamF2YS9sYW5nL09iamVjdAAhAAIAAwAAAAAAAQABAAQABQAB" +
+ "AAYAAAAdAAEAAQAAAAUqtwABsQAAAAEABwAAAAYAAQAAAAEAAQAIAAAAAgAJ";
+
+ public static void main(String[] args) throws Exception {
+
+ MySecureClassLoader scl = new MySecureClassLoader();
+ Policy p = Policy.getPolicy();
+ ArrayList<Permission> perms1 = getPermissions(scl, p,
+ "http://localhost/",
+ "Foo", FOO_CLASS);
+ checkPerms(perms1, GRANTED_PERMS);
+ ArrayList<Permission> perms2 = getPermissions(scl, p,
+ "http://127.0.0.1/",
+ "Bar", BAR_CLASS);
+ checkPerms(perms2, GRANTED_PERMS);
+ assert(perms1.equals(perms2));
+ }
+
+ // returns the permissions granted to the codebase URL
+ private static ArrayList<Permission> getPermissions(MySecureClassLoader scl,
+ Policy p, String url,
+ String className,
+ String classBytes)
+ throws IOException {
+ CodeSource cs = new CodeSource(new URL(url), (Certificate[])null);
+ Base64.Decoder bd = Base64.getDecoder();
+ byte[] bytes = bd.decode(classBytes);
+ Class<?> c = scl.defineMyClass(className, bytes, cs);
+ ProtectionDomain pd = c.getProtectionDomain();
+ return Collections.list(p.getPermissions(pd).elements());
+ }
+
+ private static void checkPerms(List<Permission> perms,
+ Permission... grantedPerms)
+ throws Exception
+ {
+ if (!perms.containsAll(Arrays.asList(grantedPerms))) {
+ throw new Exception("Granted permissions not correct");
+ }
+ }
+
+ // A SecureClassLoader that allows the test to define its own classes
+ private static class MySecureClassLoader extends SecureClassLoader {
+ Class<?> defineMyClass(String name, byte[] b, CodeSource cs) {
+ return super.defineClass(name, b, 0, b.length, cs);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/SecureClassLoader/DefineClass.policy Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,11 @@
+grant {
+ permission java.lang.RuntimePermission "createClassLoader";
+ permission java.lang.RuntimePermission "getProtectionDomain";
+ permission java.security.SecurityPermission "getPolicy";
+};
+grant codebase "http://localhost/" {
+ permission java.util.PropertyPermission "user.home", "read";
+};
+grant codebase "http://127.0.0.1/" {
+ permission java.util.PropertyPermission "user.name", "read";
+};
--- a/jdk/test/java/util/Arrays/ParallelPrefix.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/java/util/Arrays/ParallelPrefix.java Wed Jul 05 20:38:32 2017 +0200
@@ -26,6 +26,7 @@
* @summary unit test for Arrays.ParallelPrefix().
* @author Tristan Yan
* @run testng ParallelPrefix
+ * @key intermittent
*/
import java.util.Arrays;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/LinkedTransferQueue/SpliteratorTraverseAddRemoveTest.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @run testng SpliteratorTraverseAddRemoveTest
+ * @bug 8085978
+ * @summary repeatedly traverse the queue using the spliterator while
+ * concurrently adding and removing an element to test that self-linked
+ * nodes are never erroneously reported on traversal
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Queue;
+import java.util.Spliterator;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.LinkedTransferQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Consumer;
+
+@Test
+public class SpliteratorTraverseAddRemoveTest {
+
+ static Object[] of(String desc, Consumer<Queue<?>> c) {
+ return new Object[]{desc, c};
+ }
+
+ static void assertIsString(Object e) {
+ Assert.assertTrue(e instanceof String,
+ String.format("Object instanceof %s (actual: instanceof %s)",
+ String.class.getName(),
+ e.getClass().getName()));
+ }
+
+ @DataProvider()
+ public static Object[][] spliteratorTraversers() {
+ return new Object[][]{
+ of("forEachRemaining", q -> {
+ q.spliterator().forEachRemaining(SpliteratorTraverseAddRemoveTest::assertIsString);
+ }),
+ of("tryAdvance", q -> {
+ Spliterator<?> s = q.spliterator();
+ while (s.tryAdvance(SpliteratorTraverseAddRemoveTest::assertIsString))
+ ;
+ }),
+ of("trySplit then forEachRemaining", q -> {
+ Spliterator<?> r = q.spliterator();
+
+ List<Spliterator<?>> ss = new ArrayList<>();
+ Spliterator<?> l;
+ while ((l = r.trySplit()) != null) {
+ ss.add(l);
+ }
+ ss.add(r);
+
+ ss.forEach(s -> s.forEachRemaining(SpliteratorTraverseAddRemoveTest::assertIsString));
+ }),
+ };
+ }
+
+ @Test(dataProvider = "spliteratorTraversers")
+ public void testQueue(String desc, Consumer<Queue<String>> c)
+ throws InterruptedException {
+ AtomicBoolean done = new AtomicBoolean(false);
+ Queue<String> msgs = new LinkedTransferQueue<>();
+
+ CompletableFuture<Void> traversalTask = CompletableFuture.runAsync(() -> {
+ while (!done.get()) {
+ // Traversal will fail if self-linked nodes of
+ // LinkedTransferQueue are erroneously reported
+ c.accept(msgs);
+ }
+ });
+ CompletableFuture<Void> addAndRemoveTask = CompletableFuture.runAsync(() -> {
+ while (!traversalTask.isDone()) {
+ msgs.add("msg");
+ msgs.remove("msg");
+ }
+ });
+
+ Thread.sleep(TimeUnit.SECONDS.toMillis(1));
+ done.set(true);
+
+ addAndRemoveTask.join();
+ Assert.assertTrue(traversalTask.isDone());
+ traversalTask.join();
+ }
+}
--- a/jdk/test/javax/imageio/plugins/png/ItxtUtf8Test.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/javax/imageio/plugins/png/ItxtUtf8Test.java Wed Jul 05 20:38:32 2017 +0200
@@ -30,7 +30,7 @@
*
* @run main ItxtUtf8Test
*
- * @run main/othervm/timeout=10 -Xmx2m ItxtUtf8Test truncate
+ * @run main/othervm/timeout=10 -Xmx4m ItxtUtf8Test truncate
*/
import java.awt.image.BufferedImage;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JOptionPane/8081019/bug8081019.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.Frame;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @test
+ * @bug 8081019
+ * @summary Check peer to null in CPlatformWindow.checkZoom() method
+ * @author Alexandr Scherbatiy
+ */
+public class bug8081019 {
+
+ private static final String RUN_PROCESS = "RUN_PROCESS";
+ private static final String RUN_TEST = "RUN_TEST";
+
+ public static void main(String[] args) throws Exception {
+ String command = RUN_PROCESS;
+
+ if (0 < args.length) {
+ command = args[0];
+ }
+
+ switch (command) {
+ case RUN_PROCESS:
+ runProcess();
+ break;
+ case RUN_TEST:
+ runTest();
+ break;
+ default:
+ throw new RuntimeException("Unknown command: " + command);
+ }
+ }
+
+ private static void runTest() throws Exception {
+ System.setSecurityManager(new SecurityManager());
+ Frame f = new Frame("Test frame");
+ f.setVisible(true);
+ f.setVisible(false);
+ f.dispose();
+ }
+
+ private static void runProcess() throws Exception {
+ String javaPath = System.getProperty("java.home", "");
+ String command = javaPath + File.separator + "bin" + File.separator + "java"
+ + " " + bug8081019.class.getName() + " " + RUN_TEST;
+
+ Process process = Runtime.getRuntime().exec(command);
+ boolean processExit = process.waitFor(20, TimeUnit.SECONDS);
+
+ dumpStream(process.getErrorStream(), "error stream");
+ dumpStream(process.getInputStream(), "input stream");
+
+ if (!processExit) {
+ process.destroy();
+ throw new RuntimeException(""
+ + "The sub process has not exited!");
+ }
+ }
+
+ public static void dumpStream(InputStream in, String name) throws IOException {
+ System.out.println("--- dump " + name + " ---");
+ String tempString;
+ int count = in.available();
+ boolean exception = false;
+ while (count > 0) {
+ byte[] b = new byte[count];
+ in.read(b);
+ tempString = new String(b);
+ if (!exception) {
+ exception = tempString.indexOf("Exception") != -1
+ || tempString.indexOf("Error") != -1;
+ }
+ System.out.println(tempString);
+ count = in.available();
+ }
+
+ if (exception) {
+ throw new RuntimeException("Exception in the output!");
+ }
+ }
+}
\ No newline at end of file
--- a/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java Wed Jul 05 20:38:32 2017 +0200
@@ -22,7 +22,7 @@
*/
/* @test
- @bug 8041642
+ @bug 8041642 8079450
@summary Incorrect paint of JProgressBar in Nimbus LF
@author Semyon Sadetsky
*/
@@ -63,6 +63,7 @@
}
});
final Robot robot = new Robot();
+ robot.delay(100);
Color color = robot.getPixelColor(point.x + 1, point.y + 7);
System.out.println(color);
if (color.getGreen() < 150 || color.getBlue() > 30 ||
--- a/jdk/test/lib/security/CheckBlacklistedCerts.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/lib/security/CheckBlacklistedCerts.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,9 @@
};
// Is this an OPENJDK build?
- if (!new File(home, "lib/security/local_policy.jar").exists()) {
+ String prop = System.getProperty("java.runtime.name");
+ if (prop != null && prop.startsWith("OpenJDK")) {
+ System.out.println("This is a OpenJDK build.");
blacklists = Arrays.copyOf(blacklists, 1);
}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java Thu Jun 18 10:24:57 2015 -0700
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java Wed Jul 05 20:38:32 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,6 @@
import static jdk.testlibrary.Asserts.assertTrue;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
@@ -40,6 +37,7 @@
import java.util.regex.Matcher;
import java.util.concurrent.TimeUnit;
import java.util.function.BooleanSupplier;
+import java.util.function.Function;
/**
* Common library for various test helper functions.
@@ -326,4 +324,38 @@
}
return condition.getAsBoolean();
}
+
+ /**
+ * Interface same as java.lang.Runnable but with
+ * method {@code run()} able to throw any Throwable.
+ */
+ public static interface ThrowingRunnable {
+ void run() throws Throwable;
+ }
+
+ /**
+ * Filters out an exception that may be thrown by the given
+ * test according to the given filter.
+ *
+ * @param test - method that is invoked and checked for exception.
+ * @param filter - function that checks if the thrown exception matches
+ * criteria given in the filter's implementation.
+ * @return - exception that matches the filter if it has been thrown or
+ * {@code null} otherwise.
+ * @throws Throwable - if test has thrown an exception that does not
+ * match the filter.
+ */
+ public static Throwable filterException(ThrowingRunnable test,
+ Function<Throwable, Boolean> filter) throws Throwable {
+ try {
+ test.run();
+ } catch (Throwable t) {
+ if (filter.apply(t)) {
+ return t;
+ } else {
+ throw t;
+ }
+ }
+ return null;
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292/CodeCacheOverflowProcessor.java Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.testlibrary.jsr292;
+
+import jdk.testlibrary.Utils;
+
+/**
+ * Helper class used to catch and process VirtualMachineError with message "Out
+ * of space in CodeCache". Some JSR292 tests run out of code cache size, so code
+ * cache overflows and VME is thrown. This VME is considered as non-critical in
+ * some JSR292 tests, so it should be processed to prevent test failure.
+ */
+public class CodeCacheOverflowProcessor {
+
+ /**
+ * Checks if an instance of Throwable is caused by VirtualMachineError with
+ * message "Out of space in CodeCache". May be used as filter in method
+ * {@code jdk.testlibrary.Utils.filterException}.
+ *
+ * @param t - Throwable to check.
+ * @return true if Throwable is caused by VME, false otherwise.
+ */
+ public static Boolean isThrowableCausedByVME(Throwable t) {
+ Throwable causeOfT = t;
+ do {
+ if (causeOfT instanceof VirtualMachineError
+ && causeOfT.getMessage().matches(".*[Oo]ut of space"
+ + " in CodeCache.*")) {
+ return true;
+ }
+ causeOfT = causeOfT != null ? causeOfT.getCause() : null;
+ } while (causeOfT != null && causeOfT != t);
+ return false;
+ }
+
+ /**
+ * Checks if the given test throws an exception caused by
+ * VirtualMachineError with message "Out of space in CodeCache", and, if VME
+ * takes place, processes it so that no exception is thrown, and prints its
+ * stack trace. If test throws exception not caused by VME, this method just
+ * re-throws this exception.
+ *
+ * @param test - test to check for and process VirtualMachineError.
+ * @return - an exception caused by VME or null
+ * if test has thrown no exception.
+ * @throws Throwable - if test has thrown an exception
+ * that is not caused by VME.
+ */
+ public static Throwable runMHTest(Utils.ThrowingRunnable test) throws Throwable {
+ Throwable t = Utils.filterException(test::run,
+ CodeCacheOverflowProcessor::isThrowableCausedByVME);
+ if (t != null) {
+ System.err.printf("%nNon-critical exception caught becuse of"
+ + " code cache size is not enough to run all test cases.%n%n");
+ t.printStackTrace();
+ }
+ return t;
+ }
+}
--- a/make/MacBundles.gmk Thu Jun 18 10:24:57 2015 -0700
+++ b/make/MacBundles.gmk Wed Jul 05 20:38:32 2017 +0200
@@ -25,6 +25,7 @@
include $(SPEC)
include MakeBase.gmk
+include TextFileProcessing.gmk
default: bundles
--- a/make/common/CORE_PKGS.gmk Thu Jun 18 10:24:57 2015 -0700
+++ b/make/common/CORE_PKGS.gmk Wed Jul 05 20:38:32 2017 +0200
@@ -222,7 +222,6 @@
javax.swing.plaf.nimbus \
javax.swing.plaf.synth \
javax.tools \
- javax.tools.annotation \
javax.transaction \
javax.transaction.xa \
javax.xml.parsers \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/devkit/createMacosxDevkit.sh Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,147 @@
+#!/bin/bash
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This script copies part of an Xcode installer into a devkit suitable
+# for building OpenJDK and OracleJDK. The installation .dmg files for Xcode
+# and the aux tools need to be available.
+# erik.joelsson@oracle.com
+
+USAGE="$0 <Xcode.dmg> <XQuartz.dmg> [<auxtools.dmg>]"
+
+if [ "$1" = "" ] || [ "$2" = "" ]; then
+ echo $USAGE
+ exit 1
+fi
+
+XCODE_DMG="$1"
+XQUARTZ_DMG="$2"
+AUXTOOLS_DMG="$3"
+
+SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)"
+BUILD_DIR="${SCRIPT_DIR}/../../build/devkit"
+
+# Mount XCODE_DMG
+if [ -e "/Volumes/Xcode" ]; then
+ hdiutil detach /Volumes/Xcode
+fi
+hdiutil attach $XCODE_DMG
+
+# Find the version of Xcode
+XCODE_VERSION="$(/Volumes/Xcode/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version \
+ | awk '/Xcode/ { print $2 }' )"
+
+DEVKIT_ROOT="${BUILD_DIR}/Xcode${XCODE_VERSION}-devkit"
+DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz"
+
+echo "Xcode version: $XCODE_VERSION"
+echo "Creating devkit in $DEVKIT_ROOT"
+
+################################################################################
+# Copy files to root
+mkdir -p $DEVKIT_ROOT
+if [ ! -d $DEVKIT_ROOT/Xcode.app ]; then
+ echo "Copying Xcode.app..."
+ cp -RH "/Volumes/Xcode/Xcode.app" $DEVKIT_ROOT/
+fi
+# Trim out some seemingly unneeded parts to save space.
+rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Applications
+rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/iPhone*
+rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Documentation
+rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/usr/share/man
+if [ -e $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk ]; then
+ rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
+ rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/share/man
+fi
+
+hdiutil detach /Volumes/Xcode
+
+################################################################################
+# Copy Freetype into sysroot
+if [ -e "/Volumes/XQuartz-*" ]; then
+ hdiutil detach /Volumes/XQuartz-*
+fi
+hdiutil attach $XQUARTZ_DMG
+
+echo "Copying freetype..."
+rm -rf /tmp/XQuartz
+pkgutil --expand /Volumes/XQuartz-*/XQuartz.pkg /tmp/XQuartz/
+rm -rf /tmp/x11
+mkdir /tmp/x11
+cd /tmp/x11
+cat /tmp/XQuartz-*/x11.pkg/Payload | gunzip -dc |cpio -i
+
+cp -RH opt/X11/include/freetype2 \
+ $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/
+cp -RH opt/X11/include/ft2build.h \
+ $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/
+cp -RH opt/X11/lib/libfreetype.* \
+ $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/
+
+cd -
+
+hdiutil detach /Volumes/XQuartz-*
+
+################################################################################
+# Optionally copy PackageMaker
+
+if [ -e "$AUXTOOLS_DMG" ]; then
+ if [ -e "/Volumes/Auxiliary Tools" ]; then
+ hdiutil detach "/Volumes/Auxiliary Tools"
+ fi
+ hdiutil attach $AUXTOOLS_DMG
+
+ echo "Copying PackageMaker.app..."
+ cp -RH "/Volumes/Auxiliary Tools/PackageMaker.app" $DEVKIT_ROOT/
+
+ hdiutil detach "/Volumes/Auxiliary Tools"
+fi
+
+################################################################################
+# Generate devkit.info
+
+echo-info() {
+ echo "$1" >> $DEVKIT_ROOT/devkit.info
+}
+
+echo "Generating devkit.info..."
+rm -f $DEVKIT_ROOT/devkit.info
+echo-info "# This file describes to configure how to interpret the contents of this devkit"
+echo-info "DEVKIT_NAME=\"Xcode $XCODE_VERSION (devkit)\""
+echo-info "DEVKIT_TOOLCHAIN_PATH=\"\$DEVKIT_ROOT/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:\$DEVKIT_ROOT/Xcode.app/Contents/Developer/usr/bin\""
+echo-info "DEVKIT_SYSROOT=\"\$DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk\""
+echo-info "DEVKIT_EXTRA_PATH=\"\$DEVKIT_ROOT/PackageMaker.app/Contents/MacOS:\$DEVKIT_TOOLCHAIN_PATH\""
+
+################################################################################
+# Copy this script
+
+echo "Copying this script..."
+cp $0 $DEVKIT_ROOT/
+
+################################################################################
+# Create bundle
+
+echo "Creating bundle..."
+(cd $DEVKIT_ROOT && tar c - . | gzip - > "$DEVKIT_BUNDLE")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/devkit/createWindowsDevkit.sh Wed Jul 05 20:38:32 2017 +0200
@@ -0,0 +1,131 @@
+#!/bin/bash
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This script copies parts of a Visual Studio 2013 installation into a devkit
+# suitable for building OpenJDK and OracleJDK. Needs to run in Cygwin.
+# erik.joelsson@oracle.com
+
+VS_VERSION="2013"
+VS_VERSION_NUM="12.0"
+VS_VERSION_NUM_NODOT="120"
+SDK_VERSION="8.1"
+
+SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)"
+BUILD_DIR="${SCRIPT_DIR}/../../build/devkit"
+DEVKIT_ROOT="${BUILD_DIR}/VS${VS_VERSION}-devkit"
+DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz"
+
+echo "Creating devkit in $DEVKIT_ROOT"
+
+MSVCR_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcr${VS_VERSION_NUM_NODOT}.dll
+MSVCP_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcp${VS_VERSION_NUM_NODOT}.dll
+
+################################################################################
+# Copy Visual Studio files
+
+eval VSNNNCOMNTOOLS="\"\${VS${VS_VERSION_NUM_NODOT}COMNTOOLS}\""
+VS_INSTALL_DIR="$(cygpath "$VSNNNCOMNTOOLS/../..")"
+echo "VS_INSTALL_DIR: $VS_INSTALL_DIR"
+
+if [ ! -d $DEVKIT_ROOT/VC ]; then
+ echo "Copying VC..."
+ mkdir -p $DEVKIT_ROOT/VC/bin
+ cp -r "$VS_INSTALL_DIR/VC/bin/amd64" $DEVKIT_ROOT/VC/bin/
+ cp "$VS_INSTALL_DIR/VC/bin/"*.* $DEVKIT_ROOT/VC/bin/
+ cp -r "$VS_INSTALL_DIR/VC/bin/1033/" $DEVKIT_ROOT/VC/bin/
+ mkdir -p $DEVKIT_ROOT/VC/lib
+ cp -r "$VS_INSTALL_DIR/VC/lib/amd64" $DEVKIT_ROOT/VC/lib/
+ cp "$VS_INSTALL_DIR/VC/lib/"*.* $DEVKIT_ROOT/VC/lib/
+ cp -r "$VS_INSTALL_DIR/VC/include" $DEVKIT_ROOT/VC/
+ mkdir -p $DEVKIT_ROOT/VC/atlmfc/lib
+ cp -r "$VS_INSTALL_DIR/VC/atlmfc/include" $DEVKIT_ROOT/VC/atlmfc/
+ cp -r "$VS_INSTALL_DIR/VC/atlmfc/lib/amd64" $DEVKIT_ROOT/VC/atlmfc/lib/
+ cp "$VS_INSTALL_DIR/VC/atlmfc/lib/"*.* $DEVKIT_ROOT/VC/atlmfc/lib/
+ mkdir -p $DEVKIT_ROOT/VC/redist
+ cp -r "$VS_INSTALL_DIR/VC/redist/x64" $DEVKIT_ROOT/VC/redist/
+ cp -r "$VS_INSTALL_DIR/VC/redist/x86" $DEVKIT_ROOT/VC/redist/
+ # The redist runtime libs are needed to run the compiler but may not be
+ # installed on the machine where the devkit will be used.
+ cp $DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/
+ cp $DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/
+ cp $DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/amd64/
+ cp $DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/amd64/
+fi
+
+################################################################################
+# Copy SDK files
+
+PROGRAMFILES_X86="`env | sed -n 's/^ProgramFiles(x86)=//p'`"
+SDK_INSTALL_DIR="$(cygpath "$PROGRAMFILES_X86/Windows Kits/$SDK_VERSION")"
+echo "SDK_INSTALL_DIR: $SDK_INSTALL_DIR"
+
+if [ ! -d $DEVKIT_ROOT/$SDK_VERSION ]; then
+ echo "Copying SDK..."
+ mkdir -p $DEVKIT_ROOT/$SDK_VERSION/bin
+ cp -r "$SDK_INSTALL_DIR/bin/x64" $DEVKIT_ROOT/$SDK_VERSION/bin/
+ cp -r "$SDK_INSTALL_DIR/bin/x86" $DEVKIT_ROOT/$SDK_VERSION/bin/
+ mkdir -p $DEVKIT_ROOT/$SDK_VERSION/lib
+ cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x64 $DEVKIT_ROOT/$SDK_VERSION/lib/
+ cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x86 $DEVKIT_ROOT/$SDK_VERSION/lib/
+ cp -r "$SDK_INSTALL_DIR/include" $DEVKIT_ROOT/$SDK_VERSION/
+fi
+
+################################################################################
+# Generate devkit.info
+
+echo-info() {
+ echo "$1" >> $DEVKIT_ROOT/devkit.info
+}
+
+echo "Generating devkit.info..."
+rm -f $DEVKIT_ROOT/devkit.info
+echo-info "# This file describes to configure how to interpret the contents of this devkit"
+echo-info "DEVKIT_NAME=\"Microsoft Visual Studio $VS_VERSION (devkit)\""
+echo-info "DEVKIT_VS_VERSION=\"$VS_VERSION\""
+echo-info ""
+echo-info "DEVKIT_TOOLCHAIN_PATH_x86=\"\$DEVKIT_ROOT/VC/bin:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\""
+echo-info "DEVKIT_VS_INCLUDE_x86=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\""
+echo-info "DEVKIT_VS_LIB_x86=\"\$DEVKIT_ROOT/VC/lib;\$DEVKIT_ROOT/VC/atlmfc/lib;\$DEVKIT_ROOT/$SDK_VERSION/lib/x86\""
+echo-info "DEVKIT_MSVCR_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL\""
+echo-info "DEVKIT_MSVCP_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL\""
+echo-info ""
+echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/amd64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\""
+echo-info "DEVKIT_VS_INCLUDE_x86_64=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\""
+echo-info "DEVKIT_VS_LIB_x86_64=\"\$DEVKIT_ROOT/VC/lib/amd64;\$DEVKIT_ROOT/VC/atlmfc/lib/amd64;\$DEVKIT_ROOT/$SDK_VERSION/lib/x64\""
+echo-info "DEVKIT_MSVCR_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL\""
+echo-info "DEVKIT_MSVCP_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL\""
+
+################################################################################
+# Copy this script
+
+echo "Copying this script..."
+cp $0 $DEVKIT_ROOT/
+
+################################################################################
+# Create bundle
+
+echo "Creating bundle: $DEVKIT_BUNDLE"
+(cd "$DEVKIT_ROOT" && tar zcf "$DEVKIT_BUNDLE" .)