This commit is contained in:
J. Duke 2017-07-05 20:38:43 +02:00
commit 83f85170f4
197 changed files with 5833 additions and 1595 deletions

View File

@ -311,3 +311,4 @@ ea38728b4f4bdd8fd0d7a89b18069f521cf05013 jdk9-b61
dc6e8336f51bb6b67b7245766179eab5ca7720b4 jdk9-b66
f546760134eb861fcfecd4ce611b0040b0d25a6a jdk9-b67
70e4272790b6199e9ca89df2758ff9cb58ec4125 jdk9-b68
1bcfd6b8726582cff5a42dbfc75903e36f9dd4fe jdk9-b69

View File

@ -436,7 +436,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
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 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
)
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_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
AC_MSG_RESULT([yes])
fi
fi
BASIC_REQUIRE_PROGS(SETFILE, SetFile)
fi
])

View File

@ -86,4 +86,11 @@ if [ "x$OUT" = x ]; then
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

View File

@ -855,6 +855,7 @@ OS_VERSION_MINOR
OS_VERSION_MAJOR
PKG_CONFIG
BASH_ARGS
SETFILE
CODESIGN
XATTR
DSYMUTIL
@ -946,7 +947,6 @@ build_vendor
build_cpu
build
CPIO
SETFILE
DF
READLINK
CYGPATH
@ -1167,7 +1167,6 @@ SED
CYGPATH
READLINK
DF
SETFILE
CPIO
UNZIP
ZIP
@ -1180,6 +1179,7 @@ TIME
DSYMUTIL
XATTR
CODESIGN
SETFILE
PKG_CONFIG
JAVA
JAVAC
@ -2049,7 +2049,6 @@ Some influential environment variables:
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 @@ Some influential environment variables:
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 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1433337614
DATE_WHEN_GENERATED=1434614912
###############################################################################
#
@ -13055,192 +13055,6 @@ $as_echo "$tool_specified" >&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.
@ -15140,10 +14954,11 @@ fi
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 "no" >&6; }
$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

View File

@ -311,3 +311,4 @@ afc1e295c4bf83f9a5dd539c29914edd4a754a3f jdk9-b65
44ee68f7dbacab24a45115fd6a8ccdc7eb6e8f0b jdk9-b66
4418697e56f1f43597f55c7cb6573549c6117868 jdk9-b67
8efad64f40eb8cd4df376c0a5275892eeb396bbd jdk9-b68
de8acedcb5b5870f1dc54cba575aaa5d33897ea2 jdk9-b69

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2004, 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
@ -52,8 +52,8 @@ public interface DynAny extends org.omg.CORBA.Object
*
* @param dyn_any the <code>DynAny</code> object whose contents
* are assigned to this <code>DynAny</code>.
* @throws Invalid if the source <code>DynAny</code> is
* invalid
* @throws org.omg.CORBA.DynAnyPackage.Invalid if the source
* <code>DynAny</code> is invalid
*/
public void assign(org.omg.CORBA.DynAny dyn_any)
throws org.omg.CORBA.DynAnyPackage.Invalid;
@ -63,8 +63,8 @@ public interface DynAny extends org.omg.CORBA.Object
* object.
*
* @param value the <code>Any</code> object.
* @throws Invalid if the source <code>Any</code> object is
* empty or bad
* @throws org.omg.CORBA.DynAnyPackage.Invalid if the source
* <code>Any</code> object is empty or bad
*/
public void from_any(org.omg.CORBA.Any value)
throws org.omg.CORBA.DynAnyPackage.Invalid;
@ -74,8 +74,8 @@ public interface DynAny extends org.omg.CORBA.Object
* object.
*
* @return the <code>Any</code> object.
* @throws Invalid if this <code>DynAny</code> is empty or
* bad.
* @throws org.omg.CORBA.DynAnyPackage.Invalid if this
* <code>DynAny</code> is empty or bad.
* created or does not contain a meaningful value
*/
public org.omg.CORBA.Any to_any()

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2004, 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
@ -48,7 +48,8 @@ public interface DynArray extends org.omg.CORBA.Object, org.omg.CORBA.DynAny
* <code>DynArray</code> object to the given array.
*
* @param value the array of <code>Any</code> objects
* @exception InvalidSeq if the sequence is bad
* @exception org.omg.CORBA.DynAnyPackage.InvalidSeq if the
* sequence is bad
* @see #get_elements
*/
public void set_elements(org.omg.CORBA.Any[] value)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2004, 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
@ -65,7 +65,8 @@ public interface DynSequence extends org.omg.CORBA.Object, org.omg.CORBA.DynAny
* array.
*
* @param value the array of <code>Any</code> objects to be set
* @exception InvalidSeq if the array of values is bad
* @exception org.omg.CORBA.DynAnyPackage.InvalidSeq if the array
* of values is bad
* @see #get_elements
*/
public void set_elements(org.omg.CORBA.Any[] value)

View File

@ -248,7 +248,7 @@ public abstract class ServerRequest {
* contain an exception will result in a BAD_PARAM system exception. Passing
* in an unlisted user exception will result in either the DIR receiving a
* BAD_PARAM system exception or in the client receiving an
* UNKNOWN_EXCEPTION system exception.
* UNKNOWN system exception.
*
* @param any the <code>Any</code> object containing the exception
* @deprecated use set_exception()
@ -272,13 +272,13 @@ public abstract class ServerRequest {
* will cause a BAD_PARAM system exception to be thrown. Passing
* in an unlisted user exception will result in either the DIR receiving a
* BAD_PARAM system exception or in the client receiving an
* UNKNOWN_EXCEPTION system exception.
* UNKNOWN system exception.
*
* @param any the <code>Any</code> object containing the exception
* @exception BAD_PARAM if the given <code>Any</code> object does not
* contain an exception or the exception is an
* unlisted user exception
* @exception UNKNOWN_EXCEPTION if the given exception is an unlisted
* @exception UNKNOWN if the given exception is an unlisted
* user exception and the DIR did not
* receive a BAD_PARAM exception
* @see <a href="package-summary.html#unimpl"><code>CORBA</code>

View File

@ -471,3 +471,4 @@ e7ae94c4f35e940ea423fc1dd260435df34a77c0 jdk9-b65
197e94e0dacddd16816f101d24fc0442ab518326 jdk9-b66
d47dfabd16d48eb96a451edd1b61194a39ee0eb5 jdk9-b67
11af3990d56c97b40318bc1f20608e86f051a3f7 jdk9-b68
ff0929a59ced0e144201aa05819ae2e47d6f2c61 jdk9-b69

View File

@ -2813,6 +2813,13 @@ void Assembler::orl(Register dst, Register src) {
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::rclq(Register dst, int imm8) {
}
}
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());

View File

@ -1594,6 +1594,7 @@ private:
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 @@ private:
void rclq(Register dst, int imm8);
void rcrq(Register dst, int imm8);
void rdtsc();
void ret(int imm16);

View File

@ -7750,6 +7750,503 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi
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
/**

View File

@ -1241,6 +1241,25 @@ public:
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.

View File

@ -3785,6 +3785,107 @@ class StubGenerator: public StubCodeGenerator {
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 @@ class StubGenerator: public StubCodeGenerator {
if (UseMultiplyToLenIntrinsic) {
StubRoutines::_multiplyToLen = generate_multiplyToLen();
}
if (UseSquareToLenIntrinsic) {
StubRoutines::_squareToLen = generate_squareToLen();
}
if (UseMulAddIntrinsic) {
StubRoutines::_mulAdd = generate_mulAdd();
}
#endif
}

View File

@ -33,7 +33,7 @@ static bool returns_to_call_stub(address return_pc) { return return_pc == _
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 {

View File

@ -790,6 +790,12 @@ void VM_Version::get_processor_features() {
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 @@ void VM_Version::get_processor_features() {
}
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

View File

@ -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) {

View File

@ -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) \
\

View File

@ -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") \
\

View File

@ -972,7 +972,9 @@ void ConnectionGraph::process_call_arguments(CallNode *call) {
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));

View File

@ -817,19 +817,78 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
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 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
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 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
}
}
}
lo = NULL;
hi = NULL;
}
@ -868,12 +930,13 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
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;

View File

@ -291,6 +291,8 @@ class LibraryCallKit : public GraphKit {
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 @@ CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
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 @@ bool LibraryCallKit::try_to_inline(int predicate) {
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 @@ bool LibraryCallKit::inline_multiplyToLen() {
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.

View File

@ -475,7 +475,7 @@ void PhaseIdealLoop::do_peeling( IdealLoopTree *loop, Node_List &old_new ) {
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 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) {
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 @@ void IdealLoopTree::adjust_loop_exit_prob( PhaseIdealLoop *phase ) {
}
}
#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 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) {
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;

View File

@ -485,6 +485,8 @@ public:
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

View File

@ -945,6 +945,48 @@ const TypeFunc* OptoRuntime::multiplyToLen_Type() {
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

View File

@ -312,6 +312,10 @@ private:
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

View File

@ -137,6 +137,8 @@ address StubRoutines::_updateBytesCRC32 = NULL;
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;

View File

@ -197,6 +197,8 @@ class StubRoutines: AllStatic {
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 @@ class StubRoutines: AllStatic {
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);

View File

@ -831,6 +831,8 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
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 */ \

View File

@ -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");
}
}
}

View File

@ -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");
}
}
}

View File

@ -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");
}
}
}

View File

@ -311,3 +311,4 @@ ae7406e82828fe1c245ac7507a9da5fd5b1c9529 jdk9-b65
d5963ccce28d7a3e96ee3e2dc8a8676e61699b70 jdk9-b66
78c2685daabafae827c686ca2d1bb2e451faed2b jdk9-b67
82aae947938ec9b0119fdd78a616d0b7263072ee jdk9-b68
f844a908d3308f47d73cf64e87c98d37d5d76ce8 jdk9-b69

View File

@ -1,21 +1,23 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Copyright 1999-2005 The Apache Software Foundation.
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* $Id: FunctionTable.java,v 1.3 2005/09/28 13:49:34 pvedula Exp $
@ -135,6 +137,9 @@ public class FunctionTable
/** The 'unparsed-entity-uri()' id (XSLT). */
public static final int FUNC_UNPARSED_ENTITY_URI = 36;
/** The 'here()' id (XML Signature). */
public static final int FUNC_HERE = 37;
// Proprietary
/** The 'document-location()' id (Proprietary). */
@ -162,7 +167,7 @@ public class FunctionTable
* Number of built in functions. Be sure to update this as
* built-in functions are added.
*/
private static final int NUM_BUILT_IN_FUNCS = 37;
private static final int NUM_BUILT_IN_FUNCS = 38;
/**
* Number of built-in functions that may be added.
@ -229,6 +234,8 @@ public class FunctionTable
com.sun.org.apache.xpath.internal.functions.FuncDoclocation.class;
m_functions[FUNC_UNPARSED_ENTITY_URI] =
com.sun.org.apache.xpath.internal.functions.FuncUnparsedEntityURI.class;
m_functions[FUNC_HERE] =
com.sun.org.apache.xpath.internal.functions.FuncHere.class;
}
static{
@ -302,6 +309,8 @@ public class FunctionTable
new Integer(FunctionTable.FUNC_UNPARSED_ENTITY_URI));
m_functionID.put(Keywords.FUNC_DOCLOCATION_STRING,
new Integer(FunctionTable.FUNC_DOCLOCATION));
m_functionID.put(Keywords.FUNC_HERE_STRING,
new Integer(FunctionTable.FUNC_HERE));
}
public FunctionTable(){

View File

@ -1,21 +1,23 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Copyright 1999-2005 The Apache Software Foundation.
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* $Id: Keywords.java,v 1.2.4.1 2005/09/14 19:46:01 jeffsuttor Exp $
@ -210,6 +212,9 @@ public class Keywords
public static final String FUNC_UNPARSED_ENTITY_URI_STRING =
"unparsed-entity-uri";
/** here function string (XML Signature). */
public static final String FUNC_HERE_STRING = "here";
// Proprietary, built in functions
/** current function string (Proprietary). */

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
*/
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.sun.org.apache.xpath.internal.functions;
import javax.xml.transform.TransformerException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xpath.internal.NodeSetDTM;
import com.sun.org.apache.xpath.internal.XPathContext;
import com.sun.org.apache.xpath.internal.objects.XNodeSet;
import com.sun.org.apache.xpath.internal.objects.XObject;
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
/**
* Execute the XML Signature here() function.
*/
public final class FuncHere extends Function {
private static final long serialVersionUID = 4328660760070034592L;
@Override
public XObject execute(XPathContext xctxt) throws TransformerException {
Node xpathOwnerNode = (Node)xctxt.getOwnerObject();
if (xpathOwnerNode == null) {
return null;
}
int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode);
int currentNode = xctxt.getCurrentNode();
DTM dtm = xctxt.getDTM(currentNode);
int docContext = dtm.getDocument();
if (docContext == DTM.NULL) {
error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null);
}
// check whether currentNode and the node containing the XPath
// expression are in the same document
Document currentDoc = getOwnerDocument(dtm.getNode(currentNode));
Document xpathOwnerDoc = getOwnerDocument(xpathOwnerNode);
if (currentDoc != xpathOwnerDoc) {
throw new TransformerException("Owner documents differ");
}
XNodeSet nodes = new XNodeSet(xctxt.getDTMManager());
NodeSetDTM nodeSet = nodes.mutableNodeset();
int hereNode = DTM.NULL;
switch (dtm.getNodeType(xpathOwnerNodeDTM)) {
case Node.ATTRIBUTE_NODE:
case Node.PROCESSING_INSTRUCTION_NODE: {
// returns a node-set containing the attribute / processing
// instruction node
hereNode = xpathOwnerNodeDTM;
nodeSet.addNode(hereNode);
break;
}
case Node.TEXT_NODE : {
// returns a node-set containing the parent element of the
// text node that directly bears the XPath expression
hereNode = dtm.getParent(xpathOwnerNodeDTM);
nodeSet.addNode(hereNode);
break;
}
default :
break;
}
/** $todo$ Do I have to do this detach() call? */
nodeSet.detach();
return nodes;
}
private static Document getOwnerDocument(Node node) {
if (node.getNodeType() == Node.DOCUMENT_NODE) {
return (Document)node;
}
return node.getOwnerDocument();
}
@Override
public void fixupVariables(java.util.Vector vars, int globalsSize) { }
}

View File

@ -23,28 +23,32 @@
package javax.xml.parsers.ptests;
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static jaxp.library.JAXPTestUtilities.filenameToURL;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FilePermission;
import java.io.FileReader;
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
@ -52,10 +56,6 @@ import javax.xml.transform.sax.SAXResult;
import jaxp.library.JAXPDataProvider;
import jaxp.library.JAXPFileBaseTest;
import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static jaxp.library.JAXPTestUtilities.compareWithGold;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -67,6 +67,7 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/**
* @bug 8080907
* This checks the methods of DocumentBuilderFactoryImpl.
*/
public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
@ -134,28 +135,11 @@ public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
assertFalse(eh.isErrorOccured());
}
/**
* Test the default functionality of schema support method. In
* this case the schema source property is set.
* @throws Exception If any errors occur.
*/
@Test
public void testCheckSchemaSupport2() throws Exception {
try (FileInputStream fis = new FileInputStream(new File(
XML_DIR, "test.xsd"))) {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(true);
dbf.setNamespaceAware(true);
dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
W3C_XML_SCHEMA_NS_URI);
dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",
new InputSource(fis));
MyErrorHandler eh = MyErrorHandler.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
db.setErrorHandler(eh);
db.parse(new File(XML_DIR, "test1.xml"));
assertFalse(eh.isErrorOccured());
}
@DataProvider(name = "schema-source")
public Object[][] getSchemaSource() throws FileNotFoundException {
return new Object[][] {
{ new FileInputStream(new File(XML_DIR, "test.xsd")) },
{ new InputSource(filenameToURL(XML_DIR + "test.xsd")) } };
}
/**
@ -163,22 +147,50 @@ public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
* this case the schema source property is set.
* @throws Exception If any errors occur.
*/
@Test
public void testCheckSchemaSupport3() throws Exception {
try (FileInputStream fis = new FileInputStream(new File(
XML_DIR, "test.xsd"))) {
@Test(dataProvider = "schema-source")
public void testCheckSchemaSupport2(Object schemaSource) throws Exception {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(true);
dbf.setNamespaceAware(true);
dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
W3C_XML_SCHEMA_NS_URI);
dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
MyErrorHandler eh = MyErrorHandler.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
db.setErrorHandler(eh);
db.parse(new File(XML_DIR, "test1.xml"));
assertFalse(eh.isErrorOccured());
} finally {
if (schemaSource instanceof Closeable) {
((Closeable) schemaSource).close();
}
}
}
/**
* Test the default functionality of schema support method. In
* this case the schema source property is set.
* @throws Exception If any errors occur.
*/
@Test(dataProvider = "schema-source")
public void testCheckSchemaSupport3(Object schemaSource) throws Exception {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);
spf.setNamespaceAware(true);
SAXParser sp = spf.newSAXParser();
sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
W3C_XML_SCHEMA_NS_URI);
sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",
new InputSource(fis));
sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
DefaultHandler dh = new DefaultHandler();
// Not expect any unrecoverable error here.
sp.parse(new File(XML_DIR, "test1.xml"), dh);
} finally {
if (schemaSource instanceof Closeable) {
((Closeable) schemaSource).close();
}
}
}

View File

@ -27,6 +27,7 @@ import static javax.xml.validation.ptests.ValidationTestConst.XML_DIR;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.File;
@ -39,9 +40,12 @@ import java.nio.file.Paths;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
@ -60,6 +64,7 @@ import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXParseException;
/*
* @bug 8080907
* @summary Class containing the test cases for SchemaFactory
*/
@Test(singleThreaded = true)
@ -68,9 +73,10 @@ public class SchemaFactoryTest {
@BeforeClass
public void setup() throws SAXException, IOException, ParserConfigurationException {
sf = newSchemaFactory();
assertNotNull(sf);
ifac = XMLInputFactory.newInstance();
xsd1 = Files.readAllBytes(Paths.get(XML_DIR + "test.xsd"));
xsd2 = Files.readAllBytes(Paths.get(XML_DIR + "test1.xsd"));
@ -152,11 +158,13 @@ public class SchemaFactoryTest {
}
@DataProvider(name = "valid-source")
public Object[][] getValidSource() {
public Object[][] getValidSource() throws XMLStreamException {
return new Object[][] {
{ streamSource(xsd1) },
{ saxSource(xsd1) },
{ domSource(xsdDoc1) } };
{ domSource(xsdDoc1) },
{ staxStreamSource(xsd1) },
{ staxEventSource(xsd1) } };
}
@ -299,6 +307,34 @@ public class SchemaFactoryTest {
sf.setFeature(null, true);
}
@DataProvider(name = "source-feature")
public Object[][] getSourceFeature() {
return new Object[][] {
{ StreamSource.FEATURE },
{ SAXSource.FEATURE },
{ DOMSource.FEATURE },
{ DOMSource.FEATURE } };
}
/*
* Return true for each of the JAXP Source features to indicate that this
* SchemaFactory supports all of the built-in JAXP Source types.
*/
@Test(dataProvider = "source-feature")
public void testSourceFeatureGet(String sourceFeature) throws Exception {
assertTrue(newSchemaFactory().getFeature(sourceFeature));
}
/*
* JAXP Source features are read-only because this SchemaFactory always
* supports all JAXP Source types.
*/
@Test(dataProvider = "source-feature", expectedExceptions = SAXNotSupportedException.class)
public void testSourceFeatureSet(String sourceFeature) throws Exception {
newSchemaFactory().setFeature(sourceFeature, false);
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void testInvalidSchemaLanguage() {
final String INVALID_SCHEMA_LANGUAGE = "http://relaxng.org/ns/structure/1.0";
@ -337,6 +373,15 @@ public class SchemaFactoryTest {
return new DOMSource(xsdDoc);
}
private Source staxStreamSource(byte[] xsd) throws XMLStreamException {
return new StAXSource(ifac.createXMLStreamReader(newInputStream(xsd)));
}
private Source staxEventSource(byte[] xsd) throws XMLStreamException {
return new StAXSource(ifac.createXMLEventReader(newInputStream(xsd)));
}
private SchemaFactory newSchemaFactory() {
return SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
}
@ -346,6 +391,7 @@ public class SchemaFactoryTest {
private static final String SCHEMA_FACTORY_CLASSNAME = "com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory";
private SchemaFactory sf;
private XMLInputFactory ifac;
private byte[] xsd1;
private byte[] xsd2;
private Document xsdDoc1;

View File

@ -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 javax.xml.validation;
/*
* @bug 8080907
* @summary Test processContents attribute of any element
*/
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
import java.net.URISyntaxException;
import javax.xml.transform.stream.StreamSource;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
public class AnyElementTest {
@BeforeClass
public void setup() throws URISyntaxException, SAXException {
validator = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI).newSchema(new StreamSource(getUri("ProcessContents.xsd"))).newValidator();
}
/*
* processContents attribute - Specifies how the XML processor should handle
* validation against the elements specified by this any element. Can be set
* to one of the following:
* strict - the XML processor must obtain the schema for the required
* namespaces and validate the elements (this is default)
* lax - same as strict, but if the schema cannot be obtained, no errors
* will occur
* skip - The XML processor does not attempt to validate any elements from
* the specified namespaces
*/
@Test
public void testProcessContents() throws Exception {
validator.validate(new StreamSource(getUri("ProcessContents-ok.xml")));
}
/*
* When processContents="lax", validation will be performed when the element
* is declared in the schema.
*/
@Test(expectedExceptions = SAXParseException.class)
public void testProcessContentsLax() throws Exception {
validator.validate(new StreamSource(getUri("ProcessContents-lax-error.xml")));
}
/*
* Get the URI of the file, which is in the same path as this class
*/
private String getUri(String fileName) throws URISyntaxException {
return this.getClass().getResource(fileName).toURI().toASCIIString();
}
private Validator validator;
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0"?>
<my_lax>
<my_int>25.5</my_int>
</my_lax>

View File

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<my_strict>
<my_int>255</my_int>
<my_skip>
<my_int>2.55</my_int>
<un_define/>
<my_lax>
<my_int>25.5</my_int>
</my_lax>
<my_strict>
<un_define>TTT</un_define>
</my_strict>
</my_skip>
<my_lax>
<my_int>2555</my_int>
<un_define>TTT</un_define>
<my_strict>
<my_int>20</my_int>
</my_strict>
</my_lax>
</my_strict>

View File

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="my_lax">
<xs:complexType>
<xs:sequence>
<xs:any processContents="lax" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="my_skip">
<xs:complexType>
<xs:sequence>
<xs:any processContents="skip" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="my_strict">
<xs:complexType>
<xs:sequence>
<xs:any maxOccurs="unbounded"/> <!-- by default, processContents="strict" -->
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="my_int">
<xs:simpleType>
<xs:restriction base="xs:int"/>
</xs:simpleType>
</xs:element>
</xs:schema>

View File

@ -311,3 +311,4 @@ ed94f3e7ba6bbfec0772de6d24e39543e13f6d88 jdk9-b65
4fbcca8ab812198c7fb747ea7b213b6e404f36e9 jdk9-b66
1abd45df5480a04bff98fba1851d66a5230e67d4 jdk9-b67
046fd17bb9a0cdf6681124866df9626d17b0516a jdk9-b68
551323004d0ce2f1d4b0e99552f7e0cdcebc6fca jdk9-b69

View File

@ -54,7 +54,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE, \
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 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
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), \

View File

@ -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 @@ class SecurityManager {
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 @@ class SecurityManager {
AccessController.doPrivileged(
new PrivilegedAction<>() {
public String run() {
return java.security.Security.getProperty(
"package.access");
return Security.getProperty("package.access");
}
}
);
@ -1468,14 +1467,33 @@ class SecurityManager {
// 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

View File

@ -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 @@ public interface AnnotatedArrayType extends AnnotatedType {
* 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();
}

View File

@ -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 @@ public interface AnnotatedParameterizedType extends AnnotatedType {
* 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();
}

View File

@ -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 @@ public interface AnnotatedTypeVariable extends AnnotatedType {
/**
* 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();
}

View File

@ -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 @@ public interface AnnotatedWildcardType extends AnnotatedType {
/**
* 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();
}

View File

@ -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 @@ package java.lang.reflect;
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 @@ public interface TypeVariable<D extends GenericDeclaration> extends Type, Annota
* 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 @@ public interface TypeVariable<D extends GenericDeclaration> extends Type, Annota
* 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();

View File

@ -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 @@ package java.lang.reflect;
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 @@ public interface WildcardType extends Type {
/**
* 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.
*

View File

@ -1963,6 +1963,43 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* 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 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* 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 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* 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;

View File

@ -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.util.Hashtable;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.cert.*;
import sun.net.util.URLUtil;
/**
*
@ -72,6 +73,15 @@ public class CodeSource implements java.io.Serializable {
// for generating cert paths
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 class CodeSource implements java.io.Serializable {
*/
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 class CodeSource implements java.io.Serializable {
*/
public CodeSource(URL url, CodeSigner[] signers) {
this.location = url;
if (url != null) {
this.locationNoFragString = URLUtil.urlNoFragString(url);
}
// Copy the supplied signers
if (signers != null) {
@ -168,6 +184,13 @@ public class CodeSource implements java.io.Serializable {
return this.location;
}
/**
* 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>
@ -588,6 +611,10 @@ public class CodeSource implements java.io.Serializable {
} catch (IOException ioe) {
// no signers present
}
if (location != null) {
locationNoFragString = URLUtil.urlNoFragString(location);
}
}
/*

View File

@ -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 @@ public class SecureClassLoader extends ClassLoader {
*/
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 @@ public class SecureClassLoader extends ClassLoader {
* 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;
});
}
/*

View File

@ -780,7 +780,9 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
}
/**
* 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 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
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 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
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 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
((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) {

View File

@ -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 @@ public final class AnnotatedTypeFactory {
@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());
}

View File

@ -542,7 +542,22 @@ final class ProcessImpl extends Process {
@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

View File

@ -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 @@ Java_java_io_UnixFileSystem_getSpace(JNIEnv *env, jobject this,
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 @@ Java_java_io_UnixFileSystem_getSpace(JNIEnv *env, jobject this,
assert(0);
}
}
#endif
} END_PLATFORM_STRING(env, path);
return rv;
}

View File

@ -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 @@ Java_sun_nio_fs_UnixNativeDispatcher_statvfs0(JNIEnv* env, jclass this,
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 @@ Java_sun_nio_fs_UnixNativeDispatcher_statvfs0(JNIEnv* env, jclass this,
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));

View File

@ -985,11 +985,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
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);
}
}
}

View File

@ -370,8 +370,7 @@ public final class LWCToolkit extends LWToolkit {
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);

View File

@ -23,6 +23,7 @@
* questions.
*/
#import <Cocoa/Cocoa.h>
#import <JavaNativeFoundation/JavaNativeFoundation.h>
#import "sun_lwawt_macosx_CFRetainedResource.h"
@ -37,7 +38,10 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CFRetainedResource_nativeCFRelease
(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 {

View File

@ -516,8 +516,10 @@ JNF_COCOA_ENTER(env);
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) {

View File

@ -311,21 +311,26 @@ JNF_COCOA_ENTER(env);
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);
}
}
@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);
}
// 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);

View File

@ -195,19 +195,41 @@ DUMP_GLYPHINFO(const GlyphInfo *info)
#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 @@ CGGI_CopyImageFromCanvasToRGBInfo(CGGI_GlyphCanvas *canvas, GlyphInfo *info)
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 @@ CGGI_CopyImageFromCanvasToRGBInfo(CGGI_GlyphCanvas *canvas, GlyphInfo *info)
//}
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 @@ CGGI_CopyImageFromCanvasToAlphaInfo(CGGI_GlyphCanvas *canvas, GlyphInfo *info)
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_GetRenderingMode(const AWTStrike *strike)
{
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 @@ CGGI_GetRenderingMode(const AWTStrike *strike)
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 @@ CGGI_GetRenderingMode(const AWTStrike *strike)
*/
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 @@ CGGI_InitCanvas(CGGI_GlyphCanvas *canvas,
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 @@ CGGI_FreeCanvas(CGGI_GlyphCanvas *canvas)
* 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_SizeCanvas(CGGI_GlyphCanvas *canvas, const vImagePixelCount width, const vI
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 @@ CGGI_ClearCanvas(CGGI_GlyphCanvas *canvas, GlyphInfo *info)
Pixel_8888 opaqueWhite = { 0xFF, 0xFF, 0xFF, 0xFF };
#endif
// clear canvas background and set foreground color
vImageBufferFill_ARGB8888(&canvasRectToClear, opaqueWhite, kvImageNoFlags);
}
@ -577,7 +614,7 @@ CGGI_CreateImageForUnicode
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 @@ CGGI_FillImagesForGlyphsWithSizedCanvas(CGGI_GlyphCanvas *canvas,
#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_FillImagesForGlyphs(jlong *glyphInfos, const AWTStrike *strike,
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);
}

View File

@ -37,6 +37,7 @@
- (void) registerWithProcessManager;
- (void) setDockIconWithEnv:(JNIEnv *)env;
- (void) postDummyEvent;
- (void) postRunnableEvent:(void (^)())block;
- (void) waitForDummyEvent;
+ (void) runAWTLoopWithApp:(NSApplication*)app;

View File

@ -337,9 +337,13 @@ AWT_ASSERT_APPKIT_THREAD;
- (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 @@ AWT_ASSERT_APPKIT_THREAD;
}
}
/*
* 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;

View File

@ -125,38 +125,36 @@ public final class PropertyInfo {
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);
}
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;
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);
}
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();
}
}
}

View File

@ -41,7 +41,7 @@ import java.awt.Point;
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

View File

@ -34,7 +34,6 @@ import javax.swing.event.*;
/**
* Button Listener
* <p>
*
* @author Rich Schiavi
*/

View File

@ -37,7 +37,6 @@ import java.awt.event.*;
/**
* MotifCheckboxMenuItem implementation
* <p>
*
* @author Georges Saab
* @author Rich Schiavi

View File

@ -35,7 +35,8 @@ import java.beans.*;
/**
* 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 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
}
/**
* This inner class is marked &quot;public&quot; due to a compiler bug.
* This class should be treated as a &quot;protected&quot; 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 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
}
/**
* This class should be made &quot;protected&quot; in future releases.
* This class should be made "protected" in future releases.
*/
private class MotifPropertyChangeListener
extends BasicComboBoxUI.PropertyChangeHandler {

View File

@ -38,7 +38,7 @@ import javax.swing.plaf.*;
/**
* 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

View File

@ -32,7 +32,7 @@ import javax.swing.plaf.basic.BasicLabelUI;
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>

View File

@ -45,7 +45,7 @@ import javax.swing.plaf.basic.BasicMenuBarUI;
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>

View File

@ -37,7 +37,6 @@ import javax.swing.plaf.basic.BasicMenuItemUI;
/**
* MotifMenuItem implementation
* <p>
*
* @author Rich Schiavi
* @author Georges Saab

View File

@ -36,8 +36,7 @@ import javax.swing.plaf.basic.*;
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

View File

@ -34,8 +34,8 @@ import java.awt.Rectangle;
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
*/

View File

@ -47,7 +47,7 @@ import javax.swing.plaf.basic.BasicPopupMenuUI;
/**
* 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

View File

@ -34,7 +34,7 @@ import java.beans.PropertyChangeEvent;
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

View File

@ -35,8 +35,8 @@ import javax.swing.plaf.*;
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

View File

@ -34,7 +34,7 @@ import javax.swing.plaf.basic.BasicTabbedPaneUI;
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

View File

@ -199,7 +199,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
/**
* 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.

View File

@ -39,7 +39,7 @@ import static com.sun.java.swing.plaf.windows.TMSchema.*;
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 @@ public class WindowsBorders {
/**
* 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

View File

@ -76,7 +76,7 @@ public class WindowsCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI {
}
/**
* 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.

View File

@ -48,7 +48,7 @@ import sun.swing.*;
import javax.accessibility.*;
/**
* Windows L&F implementation of a FileChooser.
* Windows {@literal L&F} implementation of a FileChooser.
*
* @author Jeff Dinkins
*/

View File

@ -47,7 +47,7 @@ public class WindowsGraphicsUtils {
* 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.

View File

@ -38,7 +38,7 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
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

View File

@ -503,7 +503,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
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.
*/

View File

@ -70,7 +70,7 @@ public class WindowsMenuItemUI extends BasicMenuItemUI {
/**
* 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.

View File

@ -199,7 +199,7 @@ public class WindowsMenuUI extends BasicMenuUI {
/**
* 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.

View File

@ -36,7 +36,7 @@ import com.sun.java.swing.plaf.windows.TMSchema.State;
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

View File

@ -76,7 +76,7 @@ public class WindowsRadioButtonMenuItemUI extends BasicRadioButtonMenuItemUI {
/**
* 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.

View File

@ -29,7 +29,5 @@ import javax.swing.plaf.basic.*;
/**
* Windows Separator.
* <p>
*
*/
public class WindowsSeparatorUI extends BasicSeparatorUI { }

View File

@ -37,7 +37,6 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
/**
* Draws Windows toolbar separators.
* <p>
*
* @author Mark Davidson
*/

View File

@ -499,9 +499,8 @@ public class ScrollPane extends Container implements Accessible {
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);

View File

@ -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 @@ public class BeanDescriptor extends FeatureDescriptor {
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());
}
}

View File

@ -70,8 +70,8 @@ import javax.print.attribute.PrintJobAttribute;
* 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 @@ import javax.print.attribute.PrintJobAttribute;
* 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 @@ import javax.print.attribute.PrintJobAttribute;
* <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 @@ import javax.print.attribute.PrintJobAttribute;
* <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 @@ import javax.print.attribute.PrintJobAttribute;
* <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

View File

@ -141,7 +141,7 @@ import javax.swing.event.EventListenerList;
* 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

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