# HG changeset patch # User duke # Date 1499272275 -7200 # Node ID 21a10694fc13cb713568339e4a769b0f0b9deabd # Parent 11084bacb67da48976ab8e3a154d32b50a5f8f51# Parent 0ac483fd5e42972229ee42903cce63ed5a44a90e Merge diff -r 11084bacb67d -r 21a10694fc13 .hgtags-top-repo --- a/.hgtags-top-repo Thu Nov 29 11:30:24 2012 -0800 +++ b/.hgtags-top-repo Wed Jul 05 18:31:15 2017 +0200 @@ -187,3 +187,4 @@ 3229597524cab4239325bc3602df6c486397a511 jdk8-b63 1c8370a55b305d35353346202bde042ba9e8a9fd jdk8-b64 b772de306dc24c17f7bd1398531ddeb58723b804 jdk8-b65 +13bb8c326e7b7b0b19d78c8088033e3932e3f7ca jdk8-b66 diff -r 11084bacb67d -r 21a10694fc13 common/autoconf/basics.m4 --- a/common/autoconf/basics.m4 Thu Nov 29 11:30:24 2012 -0800 +++ b/common/autoconf/basics.m4 Wed Jul 05 18:31:15 2017 +0200 @@ -129,7 +129,7 @@ if test "x$READLINK_TESTED" != yes; then # On MacOSX there is a readlink tool with a different # purpose than the GNU readlink tool. Check the found readlink. - ISGNU=`$READLINK --help 2>&1 | $GREP GNU` + ISGNU=`$READLINK --version 2>&1 | $GREP GNU` if test "x$ISGNU" = x; then # A readlink that we do not know how to use. # Are there other non-GNU readlinks out there? @@ -141,20 +141,24 @@ if test "x$READLINK" != x; then $1=`$READLINK -f [$]$1` else + # Save the current directory for restoring afterwards STARTDIR=$PWD COUNTER=0 sym_link_dir=`$DIRNAME [$]$1` sym_link_file=`$BASENAME [$]$1` + # Use the system pwd and not the shell builtin to resolve directory symlinks + cd $sym_link_dir + cd `$THEPWDCMD` + sym_link_dir=`$THEPWDCMD` + # Resolve file symlinks while test $COUNTER -lt 20; do ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` if test "x$ISLINK" == x; then # This is not a symbolic link! We are done! break fi - # The link might be relative! We have to use cd to travel safely. - cd $sym_link_dir - # ... and we must get the to the absolute path, not one using symbolic links. - cd `pwd -P` + # Again resolve directory symlinks since the target of the just found + # link could be in a different directory cd `$DIRNAME $ISLINK` sym_link_dir=`$THEPWDCMD` sym_link_file=`$BASENAME $ISLINK` @@ -286,7 +290,7 @@ # Where is the source? It is located two levels above the configure script. CURDIR="$PWD" cd "$AUTOCONF_DIR/../.." -SRC_ROOT="`pwd`" +SRC_ROOT="`$THEPWDCMD`" if test "x$OPENJDK_TARGET_OS" = "xwindows"; then PATH_SEP=";" diff -r 11084bacb67d -r 21a10694fc13 common/autoconf/generated-configure.sh --- a/common/autoconf/generated-configure.sh Thu Nov 29 11:30:24 2012 -0800 +++ b/common/autoconf/generated-configure.sh Wed Jul 05 18:31:15 2017 +0200 @@ -3672,7 +3672,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1354106772 +DATE_WHEN_GENERATED=1354721616 ############################################################################### # @@ -6903,7 +6903,7 @@ if test "x$READLINK_TESTED" != yes; then # On MacOSX there is a readlink tool with a different # purpose than the GNU readlink tool. Check the found readlink. - ISGNU=`$READLINK --help 2>&1 | $GREP GNU` + ISGNU=`$READLINK --version 2>&1 | $GREP GNU` if test "x$ISGNU" = x; then # A readlink that we do not know how to use. # Are there other non-GNU readlinks out there? @@ -6915,20 +6915,24 @@ if test "x$READLINK" != x; then SCRIPT=`$READLINK -f $SCRIPT` else + # Save the current directory for restoring afterwards STARTDIR=$PWD COUNTER=0 sym_link_dir=`$DIRNAME $SCRIPT` sym_link_file=`$BASENAME $SCRIPT` + # Use the system pwd and not the shell builtin to resolve directory symlinks + cd $sym_link_dir + cd `$THEPWDCMD` + sym_link_dir=`$THEPWDCMD` + # Resolve file symlinks while test $COUNTER -lt 20; do ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` if test "x$ISLINK" == x; then # This is not a symbolic link! We are done! break fi - # The link might be relative! We have to use cd to travel safely. - cd $sym_link_dir - # ... and we must get the to the absolute path, not one using symbolic links. - cd `pwd -P` + # Again resolve directory symlinks since the target of the just found + # link could be in a different directory cd `$DIRNAME $ISLINK` sym_link_dir=`$THEPWDCMD` sym_link_file=`$BASENAME $ISLINK` @@ -6944,7 +6948,7 @@ # Where is the source? It is located two levels above the configure script. CURDIR="$PWD" cd "$AUTOCONF_DIR/../.." -SRC_ROOT="`pwd`" +SRC_ROOT="`$THEPWDCMD`" if test "x$OPENJDK_TARGET_OS" = "xwindows"; then PATH_SEP=";" @@ -7593,7 +7597,7 @@ if test "x$READLINK_TESTED" != yes; then # On MacOSX there is a readlink tool with a different # purpose than the GNU readlink tool. Check the found readlink. - ISGNU=`$READLINK --help 2>&1 | $GREP GNU` + ISGNU=`$READLINK --version 2>&1 | $GREP GNU` if test "x$ISGNU" = x; then # A readlink that we do not know how to use. # Are there other non-GNU readlinks out there? @@ -7605,20 +7609,24 @@ if test "x$READLINK" != x; then NOSYM_CURDIR=`$READLINK -f $NOSYM_CURDIR` else + # Save the current directory for restoring afterwards STARTDIR=$PWD COUNTER=0 sym_link_dir=`$DIRNAME $NOSYM_CURDIR` sym_link_file=`$BASENAME $NOSYM_CURDIR` + # Use the system pwd and not the shell builtin to resolve directory symlinks + cd $sym_link_dir + cd `$THEPWDCMD` + sym_link_dir=`$THEPWDCMD` + # Resolve file symlinks while test $COUNTER -lt 20; do ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` if test "x$ISLINK" == x; then # This is not a symbolic link! We are done! break fi - # The link might be relative! We have to use cd to travel safely. - cd $sym_link_dir - # ... and we must get the to the absolute path, not one using symbolic links. - cd `pwd -P` + # Again resolve directory symlinks since the target of the just found + # link could be in a different directory cd `$DIRNAME $ISLINK` sym_link_dir=`$THEPWDCMD` sym_link_file=`$BASENAME $ISLINK` @@ -11707,7 +11715,7 @@ if test "x$READLINK_TESTED" != yes; then # On MacOSX there is a readlink tool with a different # purpose than the GNU readlink tool. Check the found readlink. - ISGNU=`$READLINK --help 2>&1 | $GREP GNU` + ISGNU=`$READLINK --version 2>&1 | $GREP GNU` if test "x$ISGNU" = x; then # A readlink that we do not know how to use. # Are there other non-GNU readlinks out there? @@ -11719,20 +11727,24 @@ if test "x$READLINK" != x; then BINARY=`$READLINK -f $BINARY` else + # Save the current directory for restoring afterwards STARTDIR=$PWD COUNTER=0 sym_link_dir=`$DIRNAME $BINARY` sym_link_file=`$BASENAME $BINARY` + # Use the system pwd and not the shell builtin to resolve directory symlinks + cd $sym_link_dir + cd `$THEPWDCMD` + sym_link_dir=`$THEPWDCMD` + # Resolve file symlinks while test $COUNTER -lt 20; do ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` if test "x$ISLINK" == x; then # This is not a symbolic link! We are done! break fi - # The link might be relative! We have to use cd to travel safely. - cd $sym_link_dir - # ... and we must get the to the absolute path, not one using symbolic links. - cd `pwd -P` + # Again resolve directory symlinks since the target of the just found + # link could be in a different directory cd `$DIRNAME $ISLINK` sym_link_dir=`$THEPWDCMD` sym_link_file=`$BASENAME $ISLINK` @@ -15827,7 +15839,14 @@ fi if test -d "$WIN_SDK_BASE"; then - if test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then + # There have been cases of partial or broken SDK installations. A missing + # lib dir is not going to work. + if test ! -d "$WIN_SDK_BASE/../lib"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5 +$as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5 +$as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;} + elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;} VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd" @@ -15862,7 +15881,14 @@ fi if test -d "$WIN_SDK_BASE"; then - if test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then + # There have been cases of partial or broken SDK installations. A missing + # lib dir is not going to work. + if test ! -d "$WIN_SDK_BASE/../lib"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5 +$as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5 +$as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;} + elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;} VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd" @@ -15897,7 +15923,14 @@ fi if test -d "$WIN_SDK_BASE"; then - if test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then + # There have been cases of partial or broken SDK installations. A missing + # lib dir is not going to work. + if test ! -d "$WIN_SDK_BASE/../lib"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5 +$as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5 +$as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;} + elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;} VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd" @@ -15931,7 +15964,14 @@ fi if test -d "$WIN_SDK_BASE"; then - if test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then + # There have been cases of partial or broken SDK installations. A missing + # lib dir is not going to work. + if test ! -d "$WIN_SDK_BASE/../lib"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5 +$as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5 +$as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;} + elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;} VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd" @@ -15964,7 +16004,14 @@ fi if test -d "$WIN_SDK_BASE"; then - if test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then + # There have been cases of partial or broken SDK installations. A missing + # lib dir is not going to work. + if test ! -d "$WIN_SDK_BASE/../lib"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5 +$as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5 +$as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;} + elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;} VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd" @@ -16434,8 +16481,9 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } - VS_INCLUDE="$INCLUDE" - VS_LIB="$LIB" + # Remove any trailing \ from INCLUDE and LIB to avoid trouble in spec.gmk. + VS_INCLUDE=`$ECHO "$INCLUDE" | $SED 's/\\\\$//'` + VS_LIB=`$ECHO "$LIB" | $SED 's/\\\\$//'` VS_PATH="$PATH" @@ -18082,7 +18130,7 @@ if test "x$READLINK_TESTED" != yes; then # On MacOSX there is a readlink tool with a different # purpose than the GNU readlink tool. Check the found readlink. - ISGNU=`$READLINK --help 2>&1 | $GREP GNU` + ISGNU=`$READLINK --version 2>&1 | $GREP GNU` if test "x$ISGNU" = x; then # A readlink that we do not know how to use. # Are there other non-GNU readlinks out there? @@ -18094,20 +18142,24 @@ if test "x$READLINK" != x; then TEST_COMPILER=`$READLINK -f $TEST_COMPILER` else + # Save the current directory for restoring afterwards STARTDIR=$PWD COUNTER=0 sym_link_dir=`$DIRNAME $TEST_COMPILER` sym_link_file=`$BASENAME $TEST_COMPILER` + # Use the system pwd and not the shell builtin to resolve directory symlinks + cd $sym_link_dir + cd `$THEPWDCMD` + sym_link_dir=`$THEPWDCMD` + # Resolve file symlinks while test $COUNTER -lt 20; do ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` if test "x$ISLINK" == x; then # This is not a symbolic link! We are done! break fi - # The link might be relative! We have to use cd to travel safely. - cd $sym_link_dir - # ... and we must get the to the absolute path, not one using symbolic links. - cd `pwd -P` + # Again resolve directory symlinks since the target of the just found + # link could be in a different directory cd `$DIRNAME $ISLINK` sym_link_dir=`$THEPWDCMD` sym_link_file=`$BASENAME $ISLINK` @@ -18504,7 +18556,7 @@ if test "x$READLINK_TESTED" != yes; then # On MacOSX there is a readlink tool with a different # purpose than the GNU readlink tool. Check the found readlink. - ISGNU=`$READLINK --help 2>&1 | $GREP GNU` + ISGNU=`$READLINK --version 2>&1 | $GREP GNU` if test "x$ISGNU" = x; then # A readlink that we do not know how to use. # Are there other non-GNU readlinks out there? @@ -18516,20 +18568,24 @@ if test "x$READLINK" != x; then PROPER_COMPILER_CC=`$READLINK -f $PROPER_COMPILER_CC` else + # Save the current directory for restoring afterwards STARTDIR=$PWD COUNTER=0 sym_link_dir=`$DIRNAME $PROPER_COMPILER_CC` sym_link_file=`$BASENAME $PROPER_COMPILER_CC` + # Use the system pwd and not the shell builtin to resolve directory symlinks + cd $sym_link_dir + cd `$THEPWDCMD` + sym_link_dir=`$THEPWDCMD` + # Resolve file symlinks while test $COUNTER -lt 20; do ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` if test "x$ISLINK" == x; then # This is not a symbolic link! We are done! break fi - # The link might be relative! We have to use cd to travel safely. - cd $sym_link_dir - # ... and we must get the to the absolute path, not one using symbolic links. - cd `pwd -P` + # Again resolve directory symlinks since the target of the just found + # link could be in a different directory cd `$DIRNAME $ISLINK` sym_link_dir=`$THEPWDCMD` sym_link_file=`$BASENAME $ISLINK` @@ -19565,7 +19621,7 @@ if test "x$READLINK_TESTED" != yes; then # On MacOSX there is a readlink tool with a different # purpose than the GNU readlink tool. Check the found readlink. - ISGNU=`$READLINK --help 2>&1 | $GREP GNU` + ISGNU=`$READLINK --version 2>&1 | $GREP GNU` if test "x$ISGNU" = x; then # A readlink that we do not know how to use. # Are there other non-GNU readlinks out there? @@ -19577,20 +19633,24 @@ if test "x$READLINK" != x; then TEST_COMPILER=`$READLINK -f $TEST_COMPILER` else + # Save the current directory for restoring afterwards STARTDIR=$PWD COUNTER=0 sym_link_dir=`$DIRNAME $TEST_COMPILER` sym_link_file=`$BASENAME $TEST_COMPILER` + # Use the system pwd and not the shell builtin to resolve directory symlinks + cd $sym_link_dir + cd `$THEPWDCMD` + sym_link_dir=`$THEPWDCMD` + # Resolve file symlinks while test $COUNTER -lt 20; do ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` if test "x$ISLINK" == x; then # This is not a symbolic link! We are done! break fi - # The link might be relative! We have to use cd to travel safely. - cd $sym_link_dir - # ... and we must get the to the absolute path, not one using symbolic links. - cd `pwd -P` + # Again resolve directory symlinks since the target of the just found + # link could be in a different directory cd `$DIRNAME $ISLINK` sym_link_dir=`$THEPWDCMD` sym_link_file=`$BASENAME $ISLINK` @@ -19987,7 +20047,7 @@ if test "x$READLINK_TESTED" != yes; then # On MacOSX there is a readlink tool with a different # purpose than the GNU readlink tool. Check the found readlink. - ISGNU=`$READLINK --help 2>&1 | $GREP GNU` + ISGNU=`$READLINK --version 2>&1 | $GREP GNU` if test "x$ISGNU" = x; then # A readlink that we do not know how to use. # Are there other non-GNU readlinks out there? @@ -19999,20 +20059,24 @@ if test "x$READLINK" != x; then PROPER_COMPILER_CXX=`$READLINK -f $PROPER_COMPILER_CXX` else + # Save the current directory for restoring afterwards STARTDIR=$PWD COUNTER=0 sym_link_dir=`$DIRNAME $PROPER_COMPILER_CXX` sym_link_file=`$BASENAME $PROPER_COMPILER_CXX` + # Use the system pwd and not the shell builtin to resolve directory symlinks + cd $sym_link_dir + cd `$THEPWDCMD` + sym_link_dir=`$THEPWDCMD` + # Resolve file symlinks while test $COUNTER -lt 20; do ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` if test "x$ISLINK" == x; then # This is not a symbolic link! We are done! break fi - # The link might be relative! We have to use cd to travel safely. - cd $sym_link_dir - # ... and we must get the to the absolute path, not one using symbolic links. - cd `pwd -P` + # Again resolve directory symlinks since the target of the just found + # link could be in a different directory cd `$DIRNAME $ISLINK` sym_link_dir=`$THEPWDCMD` sym_link_file=`$BASENAME $ISLINK` diff -r 11084bacb67d -r 21a10694fc13 common/autoconf/toolchain_windows.m4 --- a/common/autoconf/toolchain_windows.m4 Thu Nov 29 11:30:24 2012 -0800 +++ b/common/autoconf/toolchain_windows.m4 Wed Jul 05 18:31:15 2017 +0200 @@ -48,7 +48,12 @@ METHOD="$2" BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE) if test -d "$WIN_SDK_BASE"; then - if test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then + # There have been cases of partial or broken SDK installations. A missing + # lib dir is not going to work. + if test ! -d "$WIN_SDK_BASE/../lib"; then + AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD]) + AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring]) + elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD]) VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd" if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then @@ -200,8 +205,9 @@ AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.]) else AC_MSG_RESULT([ok]) - VS_INCLUDE="$INCLUDE" - VS_LIB="$LIB" + # Remove any trailing \ from INCLUDE and LIB to avoid trouble in spec.gmk. + VS_INCLUDE=`$ECHO "$INCLUDE" | $SED 's/\\\\$//'` + VS_LIB=`$ECHO "$LIB" | $SED 's/\\\\$//'` VS_PATH="$PATH" AC_SUBST(VS_INCLUDE) AC_SUBST(VS_LIB) diff -r 11084bacb67d -r 21a10694fc13 common/makefiles/JavaCompilation.gmk --- a/common/makefiles/JavaCompilation.gmk Thu Nov 29 11:30:24 2012 -0800 +++ b/common/makefiles/JavaCompilation.gmk Wed Jul 05 18:31:15 2017 +0200 @@ -149,7 +149,7 @@ $$($1_GREP_INCLUDES) $$($1_GREP_EXCLUDES)) \ $$(subst \,,$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,$$($1_EXTRA_FILES)))) ifeq (,$$($1_SKIP_METAINF)) - $1_DEPS+=$$(shell $(FIND) $$(addsuffix /META-INF,$$($1_SRCS)) -type f 2> /dev/null)) + $1_DEPS+=$$(shell $(FIND) $$(addsuffix /META-INF,$$($1_SRCS)) -type f 2> /dev/null) endif endif diff -r 11084bacb67d -r 21a10694fc13 corba/.hgtags --- a/corba/.hgtags Thu Nov 29 11:30:24 2012 -0800 +++ b/corba/.hgtags Wed Jul 05 18:31:15 2017 +0200 @@ -187,3 +187,4 @@ 6ccbf67b68bfed1ab9c44ab8748a5bdc7df33506 jdk8-b63 54d599a5b4aad83c235d590652fc81f41c2824fb jdk8-b64 5132f7900a8f0c30c3ca7f7a32f9433f4fee7745 jdk8-b65 +65771ad1ca557ca26e4979d4dc633cf685435cb8 jdk8-b66 diff -r 11084bacb67d -r 21a10694fc13 hotspot/.hgtags --- a/hotspot/.hgtags Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/.hgtags Wed Jul 05 18:31:15 2017 +0200 @@ -295,3 +295,5 @@ b4ee7b773144a88af8b6b92e4384dea82cb948d8 hs25-b09 0f7290a03b24bd562583fa325d3566c21c51fb94 jdk8-b65 cfc5309f03b7bd6c1567618b63cf1fc74c0f2a8f hs25-b10 +01684f7fee1b86222be69bc23841ec2a4416696c jdk8-b66 +b61d9c88b759d1594b8af1655598e8fa00393672 hs25-b11 diff -r 11084bacb67d -r 21a10694fc13 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java Wed Jul 05 18:31:15 2017 +0200 @@ -48,6 +48,7 @@ private static int HAS_CHECKED_EXCEPTIONS; private static int HAS_LOCALVARIABLE_TABLE; private static int HAS_EXCEPTION_TABLE; + private static int HAS_GENERIC_SIGNATURE; private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { Type type = db.lookupType("ConstMethod"); @@ -60,13 +61,14 @@ HAS_CHECKED_EXCEPTIONS = db.lookupIntConstant("ConstMethod::_has_checked_exceptions").intValue(); HAS_LOCALVARIABLE_TABLE = db.lookupIntConstant("ConstMethod::_has_localvariable_table").intValue(); HAS_EXCEPTION_TABLE = db.lookupIntConstant("ConstMethod::_has_exception_table").intValue(); + HAS_GENERIC_SIGNATURE = db.lookupIntConstant("ConstMethod::_has_generic_signature").intValue(); // Size of Java bytecodes allocated immediately after ConstMethod*. codeSize = new CIntField(type.getCIntegerField("_code_size"), 0); nameIndex = new CIntField(type.getCIntegerField("_name_index"), 0); signatureIndex = new CIntField(type.getCIntegerField("_signature_index"), 0); - genericSignatureIndex = new CIntField(type.getCIntegerField("_generic_signature_index"),0); idnum = new CIntField(type.getCIntegerField("_method_idnum"), 0); + maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0); // start of byte code bytecodeOffset = type.getSize(); @@ -92,8 +94,8 @@ private static CIntField codeSize; private static CIntField nameIndex; private static CIntField signatureIndex; - private static CIntField genericSignatureIndex; private static CIntField idnum; + private static CIntField maxStack; // start of bytecode private static long bytecodeOffset; @@ -134,13 +136,21 @@ } public long getGenericSignatureIndex() { - return genericSignatureIndex.getValue(this); + if (hasGenericSignature()) { + return getAddress().getCIntegerAt(offsetOfGenericSignatureIndex(), 2, true); + } else { + return 0; + } } public long getIdNum() { return idnum.getValue(this); } + public long getMaxStack() { + return maxStack.getValue(this); + } + public Symbol getName() { return getMethod().getName(); } @@ -235,8 +245,8 @@ visitor.doCInt(codeSize, true); visitor.doCInt(nameIndex, true); visitor.doCInt(signatureIndex, true); - visitor.doCInt(genericSignatureIndex, true); visitor.doCInt(codeSize, true); + visitor.doCInt(maxStack, true); } // Accessors @@ -353,6 +363,10 @@ return ret; } + private boolean hasGenericSignature() { + return (getFlags() & HAS_GENERIC_SIGNATURE) != 0; + } + //--------------------------------------------------------------------------- // Internals only below this point @@ -377,8 +391,14 @@ return getSize() * VM.getVM().getObjectHeap().getOopSize() - 2; } + // Offset of the generic signature index + private long offsetOfGenericSignatureIndex() { + return offsetOfLastU2Element(); + } + private long offsetOfCheckedExceptionsLength() { - return offsetOfLastU2Element(); + return hasGenericSignature() ? offsetOfLastU2Element() - 2 : + offsetOfLastU2Element(); } private int getCheckedExceptionsLength() { @@ -431,7 +451,8 @@ } else if (hasCheckedExceptions()) { return offsetOfCheckedExceptions() - 2; } else { - return offsetOfLastU2Element(); + return hasGenericSignature() ? offsetOfLastU2Element() - 2 : + offsetOfLastU2Element(); } } @@ -460,7 +481,8 @@ if (hasCheckedExceptions()) { return offsetOfCheckedExceptions() - 2; } else { - return offsetOfLastU2Element(); + return hasGenericSignature() ? offsetOfLastU2Element() - 2 : + offsetOfLastU2Element(); } } diff -r 11084bacb67d -r 21a10694fc13 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java Wed Jul 05 18:31:15 2017 +0200 @@ -50,7 +50,6 @@ constMethod = type.getAddressField("_constMethod"); methodData = type.getAddressField("_method_data"); methodSize = new CIntField(type.getCIntegerField("_method_size"), 0); - maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0); maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0); sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0); accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0); @@ -84,7 +83,6 @@ private static AddressField constMethod; private static AddressField methodData; private static CIntField methodSize; - private static CIntField maxStack; private static CIntField maxLocals; private static CIntField sizeOfParameters; private static CIntField accessFlags; @@ -135,7 +133,7 @@ } /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */ public long getMethodSize() { return methodSize.getValue(this); } - public long getMaxStack() { return maxStack.getValue(this); } + public long getMaxStack() { return getConstMethod().getMaxStack(); } public long getMaxLocals() { return maxLocals.getValue(this); } public long getSizeOfParameters() { return sizeOfParameters.getValue(this); } public long getNameIndex() { return getConstMethod().getNameIndex(); } @@ -284,7 +282,6 @@ public void iterateFields(MetadataVisitor visitor) { visitor.doCInt(methodSize, true); - visitor.doCInt(maxStack, true); visitor.doCInt(maxLocals, true); visitor.doCInt(sizeOfParameters, true); visitor.doCInt(accessFlags, true); diff -r 11084bacb67d -r 21a10694fc13 hotspot/make/hotspot_version --- a/hotspot/make/hotspot_version Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/make/hotspot_version Wed Jul 05 18:31:15 2017 +0200 @@ -35,7 +35,7 @@ HS_MAJOR_VER=25 HS_MINOR_VER=0 -HS_BUILD_NUMBER=10 +HS_BUILD_NUMBER=11 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -1048,7 +1048,6 @@ const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); - const Address max_stack (G5_method, 0, in_bytes(Method::max_stack_offset())); const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); // slop factor is two extra slots on the expression stack so that @@ -1070,7 +1069,9 @@ __ lduh( size_of_parameters, Gtmp ); __ calc_mem_param_words(Gtmp, Gtmp); // space for native call parameters passed on the stack in words } else { - __ lduh(max_stack, Gtmp); // Full size expression stack + // Full size expression stack + __ ld_ptr(constMethod, Gtmp); + __ lduh(Gtmp, in_bytes(ConstMethod::max_stack_offset()), Gtmp); } __ add(Gtmp, fixed_size, Gtmp); // plus the fixed portion @@ -1206,7 +1207,9 @@ __ sub(O2, wordSize, O2); // prepush __ st_ptr(O2, XXX_STATE(_stack)); // PREPUSH - __ lduh(max_stack, O3); // Full size expression stack + // Full size expression stack + __ ld_ptr(constMethod, O3); + __ lduh(O3, in_bytes(ConstMethod::max_stack_offset()), O3); guarantee(!EnableInvokeDynamic, "no support yet for java.lang.invoke.MethodHandle"); //6815692 //6815692//if (EnableInvokeDynamic) //6815692// __ inc(O3, Method::extra_stack_entries()); @@ -1539,7 +1542,6 @@ const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); - const Address max_stack (G5_method, 0, in_bytes(Method::max_stack_offset())); const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); address entry_point = __ pc(); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/sparc/vm/frame_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -648,7 +648,7 @@ Method* m = *interpreter_frame_method_addr(); // validate the method we'd find in this potential sender - if (!Universe::heap()->is_valid_method(m)) return false; + if (!m->is_valid_method()) return false; // stack frames shouldn't be much larger than max_stack elements diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -36,12 +36,7 @@ #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/sharedRuntime.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" #ifndef CC_INTERP #ifndef FAST_DISPATCH @@ -523,7 +518,8 @@ delayed()->nop(); // Compute max expression stack+register save area - lduh(Lmethod, in_bytes(Method::max_stack_offset()), Gframe_size); // Load max stack. + ld_ptr(Lmethod, in_bytes(Method::const_offset()), Gframe_size); + lduh(Gframe_size, in_bytes(ConstMethod::max_stack_offset()), Gframe_size); // Load max stack. add( Gframe_size, frame::memory_parameter_word_sp_offset, Gframe_size ); // diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -37,13 +37,8 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/stubCodeGenerator.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/top.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif #ifdef COMPILER2 #include "opto/runtime.hpp" #endif diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,12 +26,7 @@ #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/stubRoutines.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" // Implementation of the platform-specific part of StubRoutines - for // a description of how to extend it, see the stubRoutines.hpp file. diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -496,7 +496,7 @@ const Address size_of_parameters(G5_method, Method::size_of_parameters_offset()); const Address size_of_locals (G5_method, Method::size_of_locals_offset()); - const Address max_stack (G5_method, Method::max_stack_offset()); + const Address constMethod (G5_method, Method::const_offset()); int rounded_vm_local_words = round_to( frame::interpreter_frame_vm_local_words, WordsPerLong ); const int extra_space = @@ -538,7 +538,8 @@ // see if the frame is greater than one page in size. If so, // then we need to verify there is enough stack space remaining // Frame_size = (max_stack + extra_space) * BytesPerWord; - __ lduh( max_stack, Gframe_size ); + __ ld_ptr( constMethod, Gframe_size ); + __ lduh( Gframe_size, in_bytes(ConstMethod::max_stack_offset()), Gframe_size ); __ add( Gframe_size, extra_space, Gframe_size ); __ round_to( Gframe_size, WordsPerLong ); __ sll( Gframe_size, Interpreter::logStackElementSize, Gframe_size); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp --- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -538,9 +538,9 @@ // compute full expression stack limit - const Address size_of_stack (rbx, Method::max_stack_offset()); const int extra_stack = 0; //6815692//Method::extra_stack_words(); - __ load_unsigned_short(rdx, size_of_stack); // get size of expression stack in words + __ movptr(rdx, Address(rbx, Method::const_offset())); + __ load_unsigned_short(rdx, Address(rdx, ConstMethod::max_stack_offset())); // get size of expression stack in words __ negptr(rdx); // so we can subtract in next step // Allocate expression stack __ lea(rsp, Address(rsp, rdx, Address::times_ptr, -extra_stack)); @@ -682,12 +682,12 @@ const Address stack_size(thread, Thread::stack_size_offset()); // locals + overhead, in bytes - const Address size_of_stack (rbx, Method::max_stack_offset()); - // Always give one monitor to allow us to start interp if sync method. - // Any additional monitors need a check when moving the expression stack - const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize; - const int extra_stack = 0; //6815692//Method::extra_stack_entries(); - __ load_unsigned_short(rax, size_of_stack); // get size of expression stack in words + // Always give one monitor to allow us to start interp if sync method. + // Any additional monitors need a check when moving the expression stack + const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize; + const int extra_stack = 0; //6815692//Method::extra_stack_entries(); + __ movptr(rax, Address(rbx, Method::const_offset())); + __ load_unsigned_short(rax, Address(rax, ConstMethod::max_stack_offset())); // get size of expression stack in words __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), extra_stack + one_monitor)); __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size)); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/x86/vm/frame_x86.cpp --- a/hotspot/src/cpu/x86/vm/frame_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -534,7 +534,7 @@ Method* m = *interpreter_frame_method_addr(); // validate the method we'd find in this potential sender - if (!Universe::heap()->is_valid_method(m)) return false; + if (!m->is_valid_method()) return false; // stack frames shouldn't be much larger than max_stack elements diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -36,18 +36,7 @@ #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/sharedRuntime.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" // Implementation of InterpreterMacroAssembler diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -36,18 +36,7 @@ #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/sharedRuntime.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" // Implementation of InterpreterMacroAssembler diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -37,19 +37,8 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/stubCodeGenerator.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/top.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifdef COMPILER2 #include "opto/runtime.hpp" #endif diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -37,19 +37,8 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/stubCodeGenerator.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/top.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifdef COMPILER2 #include "opto/runtime.hpp" #endif diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,18 +26,7 @@ #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/stubRoutines.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" // Implementation of the platform-specific part of StubRoutines - for // a description of how to extend it, see the stubRoutines.hpp file. diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,18 +26,7 @@ #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/stubRoutines.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" // Implementation of the platform-specific part of StubRoutines - for // a description of how to extend it, see the stubRoutines.hpp file. diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/zero/vm/interp_masm_zero.cpp --- a/hotspot/src/cpu/zero/vm/interp_masm_zero.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/zero/vm/interp_masm_zero.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -37,11 +37,6 @@ #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/sharedRuntime.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" // This file is intentionally empty diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp --- a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -38,14 +38,9 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/stubCodeGenerator.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "stack_zero.inline.hpp" #include "utilities/top.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifdef COMPILER2 #include "opto/runtime.hpp" #endif diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/cpu/zero/vm/stubRoutines_zero.cpp --- a/hotspot/src/cpu/zero/vm/stubRoutines_zero.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/cpu/zero/vm/stubRoutines_zero.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -27,9 +27,4 @@ #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/stubRoutines.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/bsd/vm/mutex_bsd.cpp --- a/hotspot/src/os/bsd/vm/mutex_bsd.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/bsd/vm/mutex_bsd.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,7 +26,7 @@ #include "mutex_bsd.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/mutex.hpp" -#include "thread_bsd.inline.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/events.hpp" // put OS-includes here diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp --- a/hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/bsd/vm/mutex_bsd.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -27,7 +27,7 @@ #include "os_bsd.inline.hpp" #include "runtime/interfaceSupport.hpp" -#include "thread_bsd.inline.hpp" +#include "runtime/thread.inline.hpp" // Reconciliation History diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/bsd/vm/os_bsd.cpp --- a/hotspot/src/os/bsd/vm/os_bsd.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -52,11 +52,11 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/statSampler.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" #include "runtime/timer.hpp" #include "services/attachListener.hpp" #include "services/runtimeService.hpp" -#include "thread_bsd.inline.hpp" #include "utilities/decoder.hpp" #include "utilities/defaultStream.hpp" #include "utilities/events.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/bsd/vm/threadCritical_bsd.cpp --- a/hotspot/src/os/bsd/vm/threadCritical_bsd.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/bsd/vm/threadCritical_bsd.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" -#include "thread_bsd.inline.hpp" // put OS-includes here # include diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/bsd/vm/thread_bsd.inline.hpp --- a/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -25,6 +25,10 @@ #ifndef OS_BSD_VM_THREAD_BSD_INLINE_HPP #define OS_BSD_VM_THREAD_BSD_INLINE_HPP +#ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE +#error "This file should only be included from thread.inline.hpp" +#endif + #include "runtime/atomic.hpp" #include "runtime/prefetch.hpp" #include "runtime/thread.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/linux/vm/mutex_linux.cpp --- a/hotspot/src/os/linux/vm/mutex_linux.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/linux/vm/mutex_linux.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,7 +26,7 @@ #include "mutex_linux.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/mutex.hpp" -#include "thread_linux.inline.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/events.hpp" // put OS-includes here diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/linux/vm/mutex_linux.inline.hpp --- a/hotspot/src/os/linux/vm/mutex_linux.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/linux/vm/mutex_linux.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -27,7 +27,7 @@ #include "os_linux.inline.hpp" #include "runtime/interfaceSupport.hpp" -#include "thread_linux.inline.hpp" +#include "runtime/thread.inline.hpp" // Reconciliation History diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/linux/vm/os_linux.cpp --- a/hotspot/src/os/linux/vm/os_linux.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/linux/vm/os_linux.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -52,11 +52,11 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/statSampler.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" #include "runtime/timer.hpp" #include "services/attachListener.hpp" #include "services/runtimeService.hpp" -#include "thread_linux.inline.hpp" #include "utilities/decoder.hpp" #include "utilities/defaultStream.hpp" #include "utilities/events.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/linux/vm/threadCritical_linux.cpp --- a/hotspot/src/os/linux/vm/threadCritical_linux.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/linux/vm/threadCritical_linux.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" -#include "thread_linux.inline.hpp" // put OS-includes here # include diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/linux/vm/thread_linux.inline.hpp --- a/hotspot/src/os/linux/vm/thread_linux.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/linux/vm/thread_linux.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -25,6 +25,10 @@ #ifndef OS_LINUX_VM_THREAD_LINUX_INLINE_HPP #define OS_LINUX_VM_THREAD_LINUX_INLINE_HPP +#ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE +#error "This file should only be included from thread.inline.hpp" +#endif + #include "runtime/atomic.hpp" #include "runtime/prefetch.hpp" #include "runtime/thread.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/solaris/vm/mutex_solaris.cpp --- a/hotspot/src/os/solaris/vm/mutex_solaris.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/solaris/vm/mutex_solaris.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,7 +26,7 @@ #include "mutex_solaris.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/mutex.hpp" -#include "thread_solaris.inline.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/events.hpp" // Solaris-specific include, therefore not in includeDB_* diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/solaris/vm/mutex_solaris.inline.hpp --- a/hotspot/src/os/solaris/vm/mutex_solaris.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/solaris/vm/mutex_solaris.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -27,6 +27,6 @@ #include "os_solaris.inline.hpp" #include "runtime/interfaceSupport.hpp" -#include "thread_solaris.inline.hpp" +#include "runtime/thread.inline.hpp" #endif // OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/solaris/vm/os_solaris.cpp --- a/hotspot/src/os/solaris/vm/os_solaris.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -52,12 +52,12 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/statSampler.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" #include "runtime/timer.hpp" #include "services/attachListener.hpp" #include "services/memTracker.hpp" #include "services/runtimeService.hpp" -#include "thread_solaris.inline.hpp" #include "utilities/decoder.hpp" #include "utilities/defaultStream.hpp" #include "utilities/events.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/solaris/vm/threadCritical_solaris.cpp --- a/hotspot/src/os/solaris/vm/threadCritical_solaris.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/solaris/vm/threadCritical_solaris.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" -#include "thread_solaris.inline.hpp" // OS-includes here #include diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/solaris/vm/thread_solaris.inline.hpp --- a/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -25,6 +25,10 @@ #ifndef OS_SOLARIS_VM_THREAD_SOLARIS_INLINE_HPP #define OS_SOLARIS_VM_THREAD_SOLARIS_INLINE_HPP +#ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE +#error "This file should only be included from thread.inline.hpp" +#endif + #include "runtime/atomic.hpp" #include "runtime/prefetch.hpp" #include "runtime/thread.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/windows/vm/mutex_windows.cpp --- a/hotspot/src/os/windows/vm/mutex_windows.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/windows/vm/mutex_windows.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,7 +26,7 @@ #include "mutex_windows.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/mutex.hpp" -#include "thread_windows.inline.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/events.hpp" // put OS-includes here diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/windows/vm/mutex_windows.inline.hpp --- a/hotspot/src/os/windows/vm/mutex_windows.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/windows/vm/mutex_windows.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -27,6 +27,6 @@ #include "os_windows.inline.hpp" #include "runtime/interfaceSupport.hpp" -#include "thread_windows.inline.hpp" +#include "runtime/thread.inline.hpp" #endif // OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/windows/vm/os_windows.cpp --- a/hotspot/src/os/windows/vm/os_windows.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -55,11 +55,11 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/statSampler.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" #include "runtime/timer.hpp" #include "services/attachListener.hpp" #include "services/runtimeService.hpp" -#include "thread_windows.inline.hpp" #include "utilities/decoder.hpp" #include "utilities/defaultStream.hpp" #include "utilities/events.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/windows/vm/threadCritical_windows.cpp --- a/hotspot/src/os/windows/vm/threadCritical_windows.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/windows/vm/threadCritical_windows.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" -#include "thread_windows.inline.hpp" // OS-includes here # include diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os/windows/vm/thread_windows.inline.hpp --- a/hotspot/src/os/windows/vm/thread_windows.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os/windows/vm/thread_windows.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -25,6 +25,10 @@ #ifndef OS_WINDOWS_VM_THREAD_WINDOWS_INLINE_HPP #define OS_WINDOWS_VM_THREAD_WINDOWS_INLINE_HPP +#ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE +#error "This file should only be included from thread.inline.hpp" +#endif + #include "runtime/atomic.hpp" #include "runtime/prefetch.hpp" #include "runtime/thread.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp --- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -48,8 +48,8 @@ #include "runtime/osThread.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" -#include "thread_bsd.inline.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp --- a/hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadLocalStorage.hpp" -#include "thread_bsd.inline.hpp" // Map stack pointer (%esp) to thread pointer for faster TLS access // diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp --- a/hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "runtime/frame.inline.hpp" -#include "thread_bsd.inline.hpp" +#include "runtime/thread.inline.hpp" // For Forte Analyzer AsyncGetCallTrace profiling support - thread is // currently interrupted by SIGPROF diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp --- a/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -54,8 +54,8 @@ #include "runtime/osThread.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" -#include "thread_bsd.inline.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.cpp --- a/hotspot/src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,8 +24,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadLocalStorage.hpp" -#include "thread_bsd.inline.hpp" void ThreadLocalStorage::generate_code_for_get_thread() { // nothing to do diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/bsd_zero/vm/thread_bsd_zero.cpp --- a/hotspot/src/os_cpu/bsd_zero/vm/thread_bsd_zero.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/bsd_zero/vm/thread_bsd_zero.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "runtime/frame.inline.hpp" -#include "thread_bsd.inline.hpp" +#include "runtime/thread.inline.hpp" void JavaThread::cache_global_variables() { // nothing to do diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp --- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -48,8 +48,8 @@ #include "runtime/osThread.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" -#include "thread_linux.inline.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/linux_sparc/vm/threadLS_linux_sparc.cpp --- a/hotspot/src/os_cpu/linux_sparc/vm/threadLS_linux_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/linux_sparc/vm/threadLS_linux_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadLocalStorage.hpp" -#include "thread_linux.inline.hpp" void ThreadLocalStorage::generate_code_for_get_thread() { } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/linux_sparc/vm/thread_linux_sparc.cpp --- a/hotspot/src/os_cpu/linux_sparc/vm/thread_linux_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/linux_sparc/vm/thread_linux_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "runtime/frame.inline.hpp" -#include "thread_linux.inline.hpp" +#include "runtime/thread.inline.hpp" // For Forte Analyzer AsyncGetCallTrace profiling support - thread is // currently interrupted by SIGPROF diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -48,8 +48,8 @@ #include "runtime/osThread.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" -#include "thread_linux.inline.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp --- a/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadLocalStorage.hpp" -#include "thread_linux.inline.hpp" // Map stack pointer (%esp) to thread pointer for faster TLS access // diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp --- a/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "runtime/frame.inline.hpp" -#include "thread_linux.inline.hpp" +#include "runtime/thread.inline.hpp" // For Forte Analyzer AsyncGetCallTrace profiling support - thread is // currently interrupted by SIGPROF diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp --- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -49,8 +49,8 @@ #include "runtime/osThread.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" -#include "thread_linux.inline.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/linux_zero/vm/threadLS_linux_zero.cpp --- a/hotspot/src/os_cpu/linux_zero/vm/threadLS_linux_zero.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/linux_zero/vm/threadLS_linux_zero.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,8 +24,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadLocalStorage.hpp" -#include "thread_linux.inline.hpp" void ThreadLocalStorage::generate_code_for_get_thread() { // nothing to do diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp --- a/hotspot/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "runtime/frame.inline.hpp" -#include "thread_linux.inline.hpp" +#include "runtime/thread.inline.hpp" void JavaThread::cache_global_variables() { // nothing to do diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp --- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -48,8 +48,8 @@ #include "runtime/osThread.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" -#include "thread_solaris.inline.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/solaris_sparc/vm/threadLS_solaris_sparc.cpp --- a/hotspot/src/os_cpu/solaris_sparc/vm/threadLS_solaris_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/solaris_sparc/vm/threadLS_solaris_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadLocalStorage.hpp" -#include "thread_solaris.inline.hpp" // Provides an entry point we can link against and // a buffer we can emit code into. The buffer is diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp --- a/hotspot/src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "runtime/frame.inline.hpp" -#include "thread_solaris.inline.hpp" +#include "runtime/thread.inline.hpp" // For Forte Analyzer AsyncGetCallTrace profiling support - thread is // currently interrupted by SIGPROF diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp --- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -48,8 +48,8 @@ #include "runtime/osThread.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" -#include "thread_solaris.inline.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/solaris_x86/vm/threadLS_solaris_x86.cpp --- a/hotspot/src/os_cpu/solaris_x86/vm/threadLS_solaris_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/solaris_x86/vm/threadLS_solaris_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadLocalStorage.hpp" -#include "thread_solaris.inline.hpp" #ifdef AMD64 extern "C" Thread* fs_load(ptrdiff_t tlsOffset); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp --- a/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "runtime/frame.inline.hpp" -#include "thread_solaris.inline.hpp" +#include "runtime/thread.inline.hpp" // For Forte Analyzer AsyncGetCallTrace profiling support - thread is // currently interrupted by SIGPROF diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp --- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -48,8 +48,8 @@ #include "runtime/osThread.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" -#include "thread_windows.inline.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp --- a/hotspot/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadLocalStorage.hpp" -#include "thread_windows.inline.hpp" // Provides an entry point we can link against and // a buffer we can emit code into. The buffer is diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp --- a/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "runtime/frame.inline.hpp" -#include "thread_windows.inline.hpp" +#include "runtime/thread.inline.hpp" // For Forte Analyzer AsyncGetCallTrace profiling support - thread is // currently interrupted by SIGPROF diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/asm/codeBuffer.cpp --- a/hotspot/src/share/vm/asm/codeBuffer.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/asm/codeBuffer.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -492,6 +492,26 @@ dest->verify_section_allocation(); } +// Anonymous classes need mirror to keep the metadata alive but +// for regular classes, the class_loader is sufficient. +static void append_oop_references(GrowableArray* oops, Klass* k) { + if (k->oop_is_instance()) { + InstanceKlass* ik = InstanceKlass::cast(k); + if (ik->is_anonymous()) { + oop o = ik->java_mirror(); + assert (o != NULL, "should have a mirror"); + if (!oops->contains(o)) { + oops->append(o); + } + return; // only need the mirror + } + } + oop cl = k->class_loader(); + if (cl != NULL && !oops->contains(cl)) { + oops->append(cl); + } +} + void CodeBuffer::finalize_oop_references(methodHandle mh) { No_Safepoint_Verifier nsv; @@ -509,7 +529,6 @@ if (md->metadata_is_immediate()) { Metadata* m = md->metadata_value(); if (oop_recorder()->is_real(m)) { - oop o = NULL; if (m->is_methodData()) { m = ((MethodData*)m)->method(); } @@ -517,16 +536,13 @@ m = ((Method*)m)->method_holder(); } if (m->is_klass()) { - o = ((Klass*)m)->class_loader(); + append_oop_references(&oops, (Klass*)m); } else { // XXX This will currently occur for MDO which don't // have a backpointer. This has to be fixed later. m->print(); ShouldNotReachHere(); } - if (o != NULL && oops.find(o) == -1) { - oops.append(o); - } } } } @@ -537,7 +553,6 @@ for (int i = 0; i < oop_recorder()->metadata_count(); i++) { Metadata* m = oop_recorder()->metadata_at(i); if (oop_recorder()->is_real(m)) { - oop o = NULL; if (m->is_methodData()) { m = ((MethodData*)m)->method(); } @@ -545,24 +560,18 @@ m = ((Method*)m)->method_holder(); } if (m->is_klass()) { - o = ((Klass*)m)->class_loader(); + append_oop_references(&oops, (Klass*)m); } else { m->print(); ShouldNotReachHere(); } - if (o != NULL && oops.find(o) == -1) { - oops.append(o); - } } } } // Add the class loader of Method* for the nmethod itself - oop cl = mh->method_holder()->class_loader(); - if (cl != NULL) { - oops.append(cl); - } + append_oop_references(&oops, mh->method_holder()); // Add any oops that we've found Thread* thread = Thread::current(); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/ci/ciReplay.cpp --- a/hotspot/src/share/vm/ci/ciReplay.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/ci/ciReplay.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -31,7 +31,7 @@ #include "memory/resourceArea.hpp" #include "utilities/copy.hpp" -#ifdef ASSERT +#ifndef PRODUCT // ciReplay @@ -939,4 +939,4 @@ ciMethodRecord* rec = replay_state->find_ciMethodRecord(method); return rec != NULL; } -#endif +#endif // PRODUCT diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/ci/ciReplay.hpp --- a/hotspot/src/share/vm/ci/ciReplay.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/ci/ciReplay.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -32,7 +32,7 @@ class ciReplay { CI_PACKAGE_ACCESS -#ifdef ASSERT +#ifndef PRODUCT private: static int replay_impl(TRAPS); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/classFileParser.cpp --- a/hotspot/src/share/vm/classfile/classFileParser.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -2184,7 +2184,7 @@ Method* m = Method::allocate( loader_data, code_length, access_flags, linenumber_table_length, total_lvt_length, exception_table_length, checked_exceptions_length, - ConstMethod::NORMAL, CHECK_(nullHandle)); + generic_signature_index, ConstMethod::NORMAL, CHECK_(nullHandle)); ClassLoadingService::add_class_method_size(m->size()*HeapWordSize); @@ -2192,7 +2192,6 @@ m->set_constants(cp()); m->set_name_index(name_index); m->set_signature_index(signature_index); - m->set_generic_signature_index(generic_signature_index); #ifdef CC_INTERP // hmm is there a gc issue here?? ResultTypeFinder rtf(cp->symbol_at(signature_index)); @@ -2950,7 +2949,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name, - Handle class_loader, + ClassLoaderData* loader_data, Handle protection_domain, KlassHandle host_klass, GrowableArray* cp_patches, @@ -2964,7 +2963,7 @@ // original class bytes. unsigned char *cached_class_file_bytes = NULL; jint cached_class_file_length; - ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader()); + Handle class_loader(THREAD, loader_data->class_loader()); bool has_default_methods = false; ResourceMark rm(THREAD); @@ -3005,7 +3004,7 @@ unsigned char* ptr = cfs->buffer(); unsigned char* end_ptr = cfs->buffer() + cfs->length(); - JvmtiExport::post_class_file_load_hook(name, class_loader, protection_domain, + JvmtiExport::post_class_file_load_hook(name, class_loader(), protection_domain, &ptr, &end_ptr, &cached_class_file_bytes, &cached_class_file_length); @@ -4004,8 +4003,7 @@ assert(k->size_helper() > 0, "layout_helper is initialized"); if ((!RegisterFinalizersAtInit && k->has_finalizer()) || k->is_abstract() || k->is_interface() - || (k->name() == vmSymbols::java_lang_Class() - && k->class_loader_data()->is_the_null_class_loader_data()) + || (k->name() == vmSymbols::java_lang_Class() && k->class_loader() == NULL) || k->size_helper() >= FastAllocateSizeLimit) { // Forbid fast-path allocation. jint lh = Klass::instance_layout_helper(k->size_helper(), true); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/classFileParser.hpp --- a/hotspot/src/share/vm/classfile/classFileParser.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/classFileParser.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -363,16 +363,16 @@ // "parsed_name" is updated by this method, and is the name found // while parsing the stream. instanceKlassHandle parseClassFile(Symbol* name, - Handle class_loader, + ClassLoaderData* loader_data, Handle protection_domain, TempNewSymbol& parsed_name, bool verify, TRAPS) { KlassHandle no_host_klass; - return parseClassFile(name, class_loader, protection_domain, no_host_klass, NULL, parsed_name, verify, THREAD); + return parseClassFile(name, loader_data, protection_domain, no_host_klass, NULL, parsed_name, verify, THREAD); } instanceKlassHandle parseClassFile(Symbol* name, - Handle class_loader, + ClassLoaderData* loader_data, Handle protection_domain, KlassHandle host_klass, GrowableArray* cp_patches, diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/classLoader.cpp --- a/hotspot/src/share/vm/classfile/classLoader.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/classLoader.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,6 +26,7 @@ #include "classfile/classFileParser.hpp" #include "classfile/classFileStream.hpp" #include "classfile/classLoader.hpp" +#include "classfile/classLoaderData.inline.hpp" #include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" @@ -910,11 +911,11 @@ // class file found, parse it ClassFileParser parser(stream); - Handle class_loader; + ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); Handle protection_domain; TempNewSymbol parsed_name = NULL; instanceKlassHandle result = parser.parseClassFile(h_name, - class_loader, + loader_data, protection_domain, parsed_name, false, diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/classLoaderData.cpp --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -65,13 +65,19 @@ ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL; ClassLoaderData::ClassLoaderData(Handle h_class_loader) : _class_loader(h_class_loader()), - _metaspace(NULL), _unloading(false), _klasses(NULL), - _claimed(0), _jmethod_ids(NULL), _handles(NULL), - _deallocate_list(NULL), _next(NULL), + _metaspace(NULL), _unloading(false), _keep_alive(false), _klasses(NULL), + _claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL), + _next(NULL), _dependencies(NULL), _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true)) { // empty } +void ClassLoaderData::init_dependencies(TRAPS) { + // Create empty dependencies array to add to. CMS requires this to be + // an oop so that it can track additions via card marks. We think. + _dependencies = (oop)oopFactory::new_objectArray(2, CHECK); +} + bool ClassLoaderData::claim() { if (_claimed == 1) { return false; @@ -86,6 +92,7 @@ } f->do_oop(&_class_loader); + f->do_oop(&_dependencies); _handles->oops_do(f); if (klass_closure != NULL) { classes_do(klass_closure); @@ -110,70 +117,100 @@ ClassLoaderData * const from_cld = this; ClassLoaderData * const to_cld = k->class_loader_data(); - // Records dependency between non-null class loaders only. - if (to_cld->is_the_null_class_loader_data() || from_cld->is_the_null_class_loader_data()) { + // Dependency to the null class loader data doesn't need to be recorded + // because the null class loader data never goes away. + if (to_cld->is_the_null_class_loader_data()) { return; } - // Check that this dependency isn't from the same or parent class_loader - oop to = to_cld->class_loader(); - oop from = from_cld->class_loader(); + oop to; + if (to_cld->is_anonymous()) { + // Anonymous class dependencies are through the mirror. + to = k->java_mirror(); + } else { + to = to_cld->class_loader(); - oop curr = from; - while (curr != NULL) { - if (curr == to) { - return; // this class loader is in the parent list, no need to add it. + // If from_cld is anonymous, even if it's class_loader is a parent of 'to' + // we still have to add it. The class_loader won't keep from_cld alive. + if (!from_cld->is_anonymous()) { + // Check that this dependency isn't from the same or parent class_loader + oop from = from_cld->class_loader(); + + oop curr = from; + while (curr != NULL) { + if (curr == to) { + return; // this class loader is in the parent list, no need to add it. + } + curr = java_lang_ClassLoader::parent(curr); + } } - curr = java_lang_ClassLoader::parent(curr); } // It's a dependency we won't find through GC, add it. This is relatively rare - from_cld->add_dependency(to_cld, CHECK); + // Must handle over GC point. + Handle dependency(THREAD, to); + from_cld->add_dependency(dependency, CHECK); } -bool ClassLoaderData::has_dependency(ClassLoaderData* dependency) { - oop loader = dependency->class_loader(); - // Get objArrayOop out of the class_loader oop and see if this dependency - // is there. Don't safepoint! These are all oops. - // Dependency list is (oop class_loader, objArrayOop next) - objArrayOop ok = (objArrayOop)java_lang_ClassLoader::dependencies(class_loader()); +void ClassLoaderData::add_dependency(Handle dependency, TRAPS) { + // Check first if this dependency is already in the list. + // Save a pointer to the last to add to under the lock. + objArrayOop ok = (objArrayOop)_dependencies; + objArrayOop last = NULL; while (ok != NULL) { - if (ok->obj_at(0) == loader) { - return true; + last = ok; + if (ok->obj_at(0) == dependency()) { + // Don't need to add it + return; } ok = (objArrayOop)ok->obj_at(1); } - return false; + + // Create a new dependency node with fields for (class_loader or mirror, next) + objArrayOop deps = oopFactory::new_objectArray(2, CHECK); + deps->obj_at_put(0, dependency()); + + // Must handle over more GC points + objArrayHandle new_dependency(THREAD, deps); + + // Add the dependency under lock + assert (last != NULL, "dependencies should be initialized"); + objArrayHandle last_handle(THREAD, last); + locked_add_dependency(last_handle, new_dependency); } -void ClassLoaderData::add_dependency(ClassLoaderData* dependency, TRAPS) { - // Minimize the number of duplicates in the list. - if (has_dependency(dependency)) { - return; - } +void ClassLoaderData::locked_add_dependency(objArrayHandle last_handle, + objArrayHandle new_dependency) { - // Create a new dependency node with fields for (class_loader, next) - objArrayOop deps = oopFactory::new_objectArray(2, CHECK); - deps->obj_at_put(0, dependency->class_loader()); + // Have to lock and put the new dependency on the end of the dependency + // array so the card mark for CMS sees that this dependency is new. + // Can probably do this lock free with some effort. + MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag); + + oop loader_or_mirror = new_dependency->obj_at(0); - // Add this lock free, using compare and exchange, need barriers for GC - // Do the barrier first. - HeapWord* addr = java_lang_ClassLoader::dependencies_addr(class_loader()); - while (true) { - oop old_dependency = java_lang_ClassLoader::dependencies(class_loader()); - deps->obj_at_put(1, old_dependency); - - oop newold = oopDesc::atomic_compare_exchange_oop((oop)deps, addr, old_dependency, true); - if (newold == old_dependency) { - update_barrier_set((void*)addr, (oop)deps); - // we won the race to add this dependency - break; + // Since the dependencies are only added, add to the end. + objArrayOop end = last_handle(); + objArrayOop last = NULL; + while (end != NULL) { + last = end; + // check again if another thread added it to the end. + if (end->obj_at(0) == loader_or_mirror) { + // Don't need to add it + return; } + end = (objArrayOop)end->obj_at(1); + } + assert (last != NULL, "dependencies should be initialized"); + // fill in the first element with the oop in new_dependency. + if (last->obj_at(0) == NULL) { + last->obj_at_put(0, new_dependency->obj_at(0)); + } else { + last->obj_at_put(1, new_dependency()); } } - void ClassLoaderDataGraph::clear_claimed_marks() { for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) { cld->clear_claimed(); @@ -187,7 +224,7 @@ // link the new item into the list _klasses = k; - if (TraceClassLoaderData && k->class_loader_data() != NULL) { + if (TraceClassLoaderData && Verbose && k->class_loader_data() != NULL) { ResourceMark rm; tty->print_cr("[TraceClassLoaderData] Adding k: " PTR_FORMAT " %s to CLD: " PTR_FORMAT " loader: " PTR_FORMAT " %s", @@ -195,8 +232,7 @@ k->external_name(), k->class_loader_data(), k->class_loader(), - k->class_loader() != NULL ? k->class_loader()->klass()->external_name() : "NULL" - ); + loader_name()); } } @@ -221,6 +257,38 @@ ShouldNotReachHere(); // should have found this class!! } + +bool ClassLoaderData::is_anonymous() const { + Klass* k = _klasses; + return (_keep_alive || (k != NULL && k->oop_is_instance() && + InstanceKlass::cast(k)->is_anonymous())); +} + +void ClassLoaderData::unload() { + _unloading = true; + + if (TraceClassLoaderData) { + ResourceMark rm; + tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this); + tty->print(" for instance "PTR_FORMAT" of %s", class_loader(), + loader_name()); + if (is_anonymous()) { + tty->print(" for anonymous class "PTR_FORMAT " ", _klasses); + } + tty->print_cr("]"); + } +} + +bool ClassLoaderData::is_alive(BoolObjectClosure* is_alive_closure) const { + bool alive = + is_anonymous() ? + is_alive_closure->do_object_b(_klasses->java_mirror()) : + class_loader() == NULL || is_alive_closure->do_object_b(class_loader()); + assert(!alive || claimed(), "must be claimed"); + return alive; +} + + ClassLoaderData::~ClassLoaderData() { Metaspace *m = _metaspace; if (m != NULL) { @@ -263,8 +331,8 @@ if (_metaspace != NULL) { return _metaspace; } - if (class_loader() == NULL) { - assert(this == the_null_class_loader_data(), "Must be"); + if (this == the_null_class_loader_data()) { + assert (class_loader() == NULL, "Must be"); size_t word_size = Metaspace::first_chunk_word_size(); set_metaspace(new Metaspace(_metaspace_lock, word_size)); } else { @@ -325,12 +393,19 @@ } } -#ifndef PRODUCT -void ClassLoaderData::print_loader(ClassLoaderData *loader_data, outputStream* out) { - oop class_loader = loader_data->class_loader(); - out->print("%s", SystemDictionary::loader_name(class_loader)); +// These anonymous class loaders are to contain classes used for JSR292 +ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) { + // Add a new class loader data to the graph. + ClassLoaderData* cld = ClassLoaderDataGraph::add(NULL, loader, CHECK_NULL); + return cld; } +const char* ClassLoaderData::loader_name() { + // Handles null class loader + return SystemDictionary::loader_name(class_loader()); +} + +#ifndef PRODUCT // Define to dump klasses #undef CLD_DUMP_KLASSES @@ -338,8 +413,7 @@ ResourceMark rm; out->print("ClassLoaderData CLD: "PTR_FORMAT", loader: "PTR_FORMAT", loader_klass: "PTR_FORMAT" %s {", this, class_loader(), - class_loader() != NULL ? class_loader()->klass() : NULL, - class_loader() != NULL ? class_loader()->klass()->external_name() : "NULL"); + class_loader() != NULL ? class_loader()->klass() : NULL, loader_name()); if (claimed()) out->print(" claimed "); if (is_unloading()) out->print(" unloading "); out->print(" handles " INTPTR_FORMAT, handles()); @@ -373,8 +447,8 @@ void ClassLoaderData::verify() { oop cl = class_loader(); - guarantee(this == class_loader_data(cl), "Must be the same"); - guarantee(cl != NULL || this == ClassLoaderData::the_null_class_loader_data(), "must be"); + guarantee(this == class_loader_data(cl) || is_anonymous(), "Must be the same"); + guarantee(cl != NULL || this == ClassLoaderData::the_null_class_loader_data() || is_anonymous(), "must be"); // Verify the integrity of the allocated space. if (metaspace_or_null() != NULL) { @@ -387,6 +461,7 @@ } } + // GC root of class loader data created. ClassLoaderData* ClassLoaderDataGraph::_head = NULL; ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL; @@ -395,19 +470,25 @@ // Add a new class loader data node to the list. Assign the newly created // ClassLoaderData into the java/lang/ClassLoader object as a hidden field -ClassLoaderData* ClassLoaderDataGraph::add(ClassLoaderData** cld_addr, Handle loader_data) { +ClassLoaderData* ClassLoaderDataGraph::add(ClassLoaderData** cld_addr, Handle loader, TRAPS) { // Not assigned a class loader data yet. // Create one. ClassLoaderData* *list_head = &_head; ClassLoaderData* next = _head; - ClassLoaderData* cld = new ClassLoaderData(loader_data); + ClassLoaderData* cld = new ClassLoaderData(loader); - // First, Atomically set it. - ClassLoaderData* old = (ClassLoaderData*) Atomic::cmpxchg_ptr(cld, cld_addr, NULL); - if (old != NULL) { - delete cld; - // Returns the data. - return old; + if (cld_addr != NULL) { + // First, Atomically set it + ClassLoaderData* old = (ClassLoaderData*) Atomic::cmpxchg_ptr(cld, cld_addr, NULL); + if (old != NULL) { + delete cld; + // Returns the data. + return old; + } + } else { + // Disallow unloading for this CLD during initialization if there is no + // class_loader oop to link this to. + cld->set_keep_alive(true); } // We won the race, and therefore the task of adding the data to the list of @@ -417,16 +498,22 @@ ClassLoaderData* exchanged = (ClassLoaderData*)Atomic::cmpxchg_ptr(cld, list_head, next); if (exchanged == next) { if (TraceClassLoaderData) { + ResourceMark rm; tty->print("[ClassLoaderData: "); tty->print("create class loader data "PTR_FORMAT, cld); - tty->print(" for instance "PTR_FORMAT" of ", cld->class_loader()); - loader_data->klass()->name()->print_symbol_on(tty); + tty->print(" for instance "PTR_FORMAT" of %s", cld->class_loader(), + cld->loader_name()); tty->print_cr("]"); } + // Create dependencies after the CLD is added to the list. Otherwise, + // the GC GC will not find the CLD and the _class_loader field will + // not be updated. + cld->init_dependencies(CHECK_NULL); return cld; } next = exchanged; } while (true); + } void ClassLoaderDataGraph::oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) { @@ -435,9 +522,19 @@ } } +void ClassLoaderDataGraph::keep_alive_oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) { + for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) { + if (cld->keep_alive()) { + cld->oops_do(f, klass_closure, must_claim); + } + } +} + void ClassLoaderDataGraph::always_strong_oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) { if (ClassUnloading) { ClassLoaderData::the_null_class_loader_data()->oops_do(f, klass_closure, must_claim); + // keep any special CLDs alive. + ClassLoaderDataGraph::keep_alive_oops_do(f, klass_closure, must_claim); } else { ClassLoaderDataGraph::oops_do(f, klass_closure, must_claim); } @@ -516,9 +613,10 @@ } #endif // PRODUCT + // Move class loader data from main list to the unloaded list for unloading // and deallocation later. -bool ClassLoaderDataGraph::do_unloading(BoolObjectClosure* is_alive) { +bool ClassLoaderDataGraph::do_unloading(BoolObjectClosure* is_alive_closure) { ClassLoaderData* data = _head; ClassLoaderData* prev = NULL; bool seen_dead_loader = false; @@ -527,8 +625,7 @@ bool has_redefined_a_class = JvmtiExport::has_redefined_a_class(); MetadataOnStackMark md_on_stack; while (data != NULL) { - if (data->class_loader() == NULL || is_alive->do_object_b(data->class_loader())) { - assert(data->claimed(), "class loader data must have been claimed"); + if (data->keep_alive() || data->is_alive(is_alive_closure)) { if (has_redefined_a_class) { data->classes_do(InstanceKlass::purge_previous_versions); } @@ -539,13 +636,7 @@ } seen_dead_loader = true; ClassLoaderData* dead = data; - dead->mark_for_unload(); - if (TraceClassLoaderData) { - tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, dead); - tty->print(" for instance "PTR_FORMAT" of ", dead->class_loader()); - dead->class_loader()->klass()->name()->print_symbol_on(tty); - tty->print_cr("]"); - } + dead->unload(); data = data->next(); // Remove from loader list. if (prev != NULL) { diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/classLoaderData.hpp --- a/hotspot/src/share/vm/classfile/classLoaderData.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -62,13 +62,14 @@ // CMS support. static ClassLoaderData* _saved_head; - static ClassLoaderData* add(ClassLoaderData** loader_data_addr, Handle class_loader); + static ClassLoaderData* add(ClassLoaderData** loader_data_addr, Handle class_loader, TRAPS); public: - static ClassLoaderData* find_or_create(Handle class_loader); + static ClassLoaderData* find_or_create(Handle class_loader, TRAPS); static void purge(); static void clear_claimed_marks(); static void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim); static void always_strong_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); + static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); static void classes_do(KlassClosure* klass_closure); static bool do_unloading(BoolObjectClosure* is_alive); @@ -101,10 +102,13 @@ oop _class_loader; // oop used to uniquely identify a class loader // class loader or a canonical class path + oop _dependencies; // oop to hold dependencies from this class loader + // data to others. Metaspace * _metaspace; // Meta-space where meta-data defined by the // classes in the class loader are allocated. Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. bool _unloading; // true if this class loader goes away + bool _keep_alive; // if this CLD can be unloaded for anonymous loaders volatile int _claimed; // true if claimed, for example during GC traces. // To avoid applying oop closure more than once. // Has to be an int because we cas it. @@ -129,8 +133,8 @@ static Metaspace* _ro_metaspace; static Metaspace* _rw_metaspace; - bool has_dependency(ClassLoaderData* cld); - void add_dependency(ClassLoaderData* to_loader_data, TRAPS); + void add_dependency(Handle dependency, TRAPS); + void locked_add_dependency(objArrayHandle last, objArrayHandle new_dependency); void set_next(ClassLoaderData* next) { _next = next; } ClassLoaderData* next() const { return _next; } @@ -150,7 +154,9 @@ bool claimed() const { return _claimed == 1; } bool claim(); - void mark_for_unload() { _unloading = true; } + void unload(); + bool keep_alive() const { return _keep_alive; } + bool is_alive(BoolObjectClosure* is_alive_closure) const; void classes_do(void f(InstanceKlass*)); @@ -168,6 +174,8 @@ return _the_null_class_loader_data; } + bool is_anonymous() const; + static void init_null_class_loader_data() { assert(_the_null_class_loader_data == NULL, "cannot initialize twice"); assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice"); @@ -194,6 +202,9 @@ assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded"); return _unloading; } + // Anonymous class loader data doesn't have anything to keep them from + // being unloaded during parsing the anonymous class. + void set_keep_alive(bool value) { _keep_alive = value; } unsigned int identity_hash() { return _class_loader == NULL ? 0 : _class_loader->identity_hash(); @@ -211,15 +222,18 @@ void print_value_on(outputStream* out) const PRODUCT_RETURN; void dump(outputStream * const out) PRODUCT_RETURN; void verify(); + const char* loader_name(); jobject add_handle(Handle h); void add_class(Klass* k); void remove_class(Klass* k); void record_dependency(Klass* to, TRAPS); + void init_dependencies(TRAPS); void add_to_deallocate_list(Metadata* m); static ClassLoaderData* class_loader_data(oop loader); + static ClassLoaderData* anonymous_class_loader_data(oop loader, TRAPS); static void print_loader(ClassLoaderData *loader_data, outputStream *out); // CDS support diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/classLoaderData.inline.hpp --- a/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -33,7 +33,7 @@ } -inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader) { +inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader, TRAPS) { assert(loader() != NULL,"Must be a class loader"); // Gets the class loader data out of the java/lang/ClassLoader object, if non-null // it's already in the loader_data, so no need to add @@ -42,5 +42,5 @@ if (loader_data_id) { return loader_data_id; } - return ClassLoaderDataGraph::add(loader_data_addr, loader); + return ClassLoaderDataGraph::add(loader_data_addr, loader, THREAD); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/defaultMethods.cpp --- a/hotspot/src/share/vm/classfile/defaultMethods.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -1148,12 +1148,11 @@ int code_length = bytecodes->length(); Method* m = Method::allocate(cp->pool_holder()->class_loader_data(), - code_length, flags, 0, 0, 0, 0, mt, CHECK_NULL); + code_length, flags, 0, 0, 0, 0, 0, mt, CHECK_NULL); m->set_constants(NULL); // This will get filled in later m->set_name_index(cp->utf8(name)); m->set_signature_index(cp->utf8(sig)); - m->set_generic_signature_index(0); #ifdef CC_INTERP ResultTypeFinder rtf(sig); m->set_result_index(rtf.type()); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/dictionary.cpp --- a/hotspot/src/share/vm/classfile/dictionary.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/dictionary.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -580,7 +580,7 @@ // class loader must be present; a null class loader is the // boostrap loader guarantee(loader_data != NULL || DumpSharedSpaces || - loader_data->is_the_null_class_loader_data() || + loader_data->class_loader() == NULL || loader_data->class_loader()->is_instance(), "checking type of class_loader"); e->verify(); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/javaClasses.cpp --- a/hotspot/src/share/vm/classfile/javaClasses.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -47,20 +47,9 @@ #include "runtime/java.hpp" #include "runtime/javaCalls.hpp" #include "runtime/safepoint.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vframe.hpp" #include "utilities/preserveException.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #define INJECTED_FIELD_COMPUTE_OFFSET(klass, name, signature, may_be_java) \ klass::_##name##_offset = JavaClasses::compute_injected_offset(JavaClasses::klass##_##name##_enum); @@ -2555,8 +2544,8 @@ void java_lang_invoke_MemberName::set_vmtarget(oop mname, Metadata* ref) { assert(is_instance(mname), "wrong type"); -#ifdef ASSERT // check the type of the vmtarget + oop dependency = NULL; if (ref != NULL) { switch (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR | @@ -2564,28 +2553,21 @@ case MN_IS_METHOD: case MN_IS_CONSTRUCTOR: assert(ref->is_method(), "should be a method"); + dependency = ((Method*)ref)->method_holder()->java_mirror(); break; case MN_IS_FIELD: assert(ref->is_klass(), "should be a class"); + dependency = ((Klass*)ref)->java_mirror(); break; default: ShouldNotReachHere(); } } -#endif //ASSERT mname->address_field_put(_vmtarget_offset, (address)ref); - oop loader = NULL; - if (ref != NULL) { - if (ref->is_klass()) { - loader = ((Klass*)ref)->class_loader(); - } else if (ref->is_method()) { - loader = ((Method*)ref)->method_holder()->class_loader(); - } else { - ShouldNotReachHere(); - } - } - // Add a reference to the loader to ensure the metadata is kept alive - mname->obj_field_put(_vmloader_offset, loader); + // Add a reference to the loader (actually mirror because anonymous classes will not have + // distinct loaders) to ensure the metadata is kept alive + // This mirror may be different than the one in clazz field. + mname->obj_field_put(_vmloader_offset, dependency); } intptr_t java_lang_invoke_MemberName::vmindex(oop mname) { @@ -2750,7 +2732,6 @@ bool java_lang_ClassLoader::offsets_computed = false; int java_lang_ClassLoader::_loader_data_offset = -1; -int java_lang_ClassLoader::_dependencies_offset = -1; int java_lang_ClassLoader::parallelCapable_offset = -1; ClassLoaderData** java_lang_ClassLoader::loader_data_addr(oop loader) { @@ -2762,18 +2743,6 @@ return *java_lang_ClassLoader::loader_data_addr(loader); } -oop java_lang_ClassLoader::dependencies(oop loader) { - return loader->obj_field(_dependencies_offset); -} - -HeapWord* java_lang_ClassLoader::dependencies_addr(oop loader) { - if (UseCompressedOops) { - return (HeapWord*)loader->obj_field_addr(_dependencies_offset); - } else { - return (HeapWord*)loader->obj_field_addr(_dependencies_offset); - } -} - void java_lang_ClassLoader::compute_offsets() { assert(!offsets_computed, "offsets should be initialized only once"); offsets_computed = true; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/javaClasses.hpp --- a/hotspot/src/share/vm/classfile/javaClasses.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -1125,8 +1125,7 @@ // Interface to java.lang.ClassLoader objects #define CLASSLOADER_INJECTED_FIELDS(macro) \ - macro(java_lang_ClassLoader, loader_data, intptr_signature, false) \ - macro(java_lang_ClassLoader, dependencies, object_signature, false) + macro(java_lang_ClassLoader, loader_data, intptr_signature, false) class java_lang_ClassLoader : AllStatic { private: @@ -1135,7 +1134,6 @@ hc_parent_offset = 0 }; static int _loader_data_offset; - static int _dependencies_offset; static bool offsets_computed; static int parent_offset; static int parallelCapable_offset; @@ -1146,9 +1144,6 @@ static ClassLoaderData** loader_data_addr(oop loader); static ClassLoaderData* loader_data(oop loader); - static oop dependencies(oop loader); - static HeapWord* dependencies_addr(oop loader); - static oop parent(oop loader); static bool isAncestor(oop loader, oop cl); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/loaderConstraints.cpp --- a/hotspot/src/share/vm/classfile/loaderConstraints.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/loaderConstraints.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -118,7 +118,7 @@ probe->name()->as_C_string()); for (int i = 0; i < probe->num_loaders(); i++) { tty->print_cr("[ [%d]: %s", i, - SystemDictionary::loader_name(probe->loader_data(i))); + probe->loader_data(i)->loader_name()); } } } @@ -129,7 +129,7 @@ if (TraceLoaderConstraints) { ResourceMark rm; tty->print_cr("[Purging loader %s from constraint for name %s", - SystemDictionary::loader_name(probe->loader_data(n)), + probe->loader_data(n)->loader_name(), probe->name()->as_C_string() ); } @@ -145,7 +145,7 @@ tty->print_cr("[New loader list:"); for (int i = 0; i < probe->num_loaders(); i++) { tty->print_cr("[ [%d]: %s", i, - SystemDictionary::loader_name(probe->loader_data(i))); + probe->loader_data(i)->loader_name()); } } @@ -400,7 +400,7 @@ for (int i = 0; i < p1->num_loaders(); i++) { tty->print_cr("[ [%d]: %s", i, - SystemDictionary::loader_name(p1->loader_data(i))); + p1->loader_data(i)->loader_name()); } if (p1->klass() == NULL) { tty->print_cr("[... and setting class object]"); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/systemDictionary.cpp --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -106,9 +106,9 @@ } -ClassLoaderData* SystemDictionary::register_loader(Handle class_loader) { +ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, TRAPS) { if (class_loader() == NULL) return ClassLoaderData::the_null_class_loader_data(); - return ClassLoaderDataGraph::find_or_create(class_loader); + return ClassLoaderDataGraph::find_or_create(class_loader, CHECK_NULL); } // ---------------------------------------------------------------------------- @@ -591,7 +591,7 @@ // UseNewReflection // Fix for 4474172; see evaluation for more details class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader())); - ClassLoaderData *loader_data = register_loader(class_loader); + ClassLoaderData *loader_data = register_loader(class_loader, CHECK_NULL); // Do lookup to see if class already exist and the protection domain // has the right access @@ -888,7 +888,7 @@ // of the call to resolve_instance_class_or_null(). // See evaluation 6790209 and 4474172 for more details. class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader())); - ClassLoaderData* loader_data = register_loader(class_loader); + ClassLoaderData* loader_data = register_loader(class_loader, CHECK_NULL); unsigned int d_hash = dictionary()->compute_hash(class_name, loader_data); int d_index = dictionary()->hash_to_index(d_hash); @@ -948,6 +948,18 @@ TRAPS) { TempNewSymbol parsed_name = NULL; + ClassLoaderData* loader_data; + if (host_klass.not_null()) { + // Create a new CLD for anonymous class, that uses the same class loader + // as the host_klass + assert(EnableInvokeDynamic, ""); + guarantee(host_klass->class_loader() == class_loader(), "should be the same"); + loader_data = ClassLoaderData::anonymous_class_loader_data(class_loader(), CHECK_NULL); + loader_data->record_dependency(host_klass(), CHECK_NULL); + } else { + loader_data = ClassLoaderData::class_loader_data(class_loader()); + } + // Parse the stream. Note that we do this even though this klass might // already be present in the SystemDictionary, otherwise we would not // throw potential ClassFormatErrors. @@ -959,7 +971,7 @@ // java.lang.Object through resolve_or_fail, not this path. instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name, - class_loader, + loader_data, protection_domain, host_klass, cp_patches, @@ -973,8 +985,6 @@ // Parsed name could be null if we threw an error before we got far // enough along to parse it -- in that case, there is nothing to clean up. if (parsed_name != NULL) { - ClassLoaderData* loader_data = class_loader_data(class_loader); - unsigned int p_hash = placeholders()->compute_hash(parsed_name, loader_data); int p_index = placeholders()->hash_to_index(p_hash); @@ -987,9 +997,8 @@ if (host_klass.not_null() && k.not_null()) { assert(EnableInvokeDynamic, ""); + k->set_host_klass(host_klass()); // If it's anonymous, initialize it now, since nobody else will. - k->class_loader_data()->record_dependency(host_klass(), CHECK_NULL); - k->set_host_klass(host_klass()); { MutexLocker mu_r(Compile_lock, THREAD); @@ -1002,11 +1011,11 @@ } // Rewrite and patch constant pool here. - k->link_class(THREAD); + k->link_class(CHECK_NULL); if (cp_patches != NULL) { k->constants()->patch_resolved_references(cp_patches); } - k->eager_initialize(THREAD); + k->eager_initialize(CHECK_NULL); // notify jvmti if (JvmtiExport::should_post_class_load()) { @@ -1039,7 +1048,7 @@ DoObjectLock = false; } - ClassLoaderData* loader_data = register_loader(class_loader); + ClassLoaderData* loader_data = register_loader(class_loader, CHECK_NULL); // Make sure we are synchronized on the class loader before we proceed Handle lockObject = compute_loader_lock_object(class_loader, THREAD); @@ -1059,7 +1068,7 @@ // java.lang.Object through resolve_or_fail, not this path. instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name, - class_loader, + loader_data, protection_domain, parsed_name, verify, @@ -2343,6 +2352,7 @@ // Helper for unpacking the return value from linkMethod and linkCallSite. static methodHandle unpack_method_and_appendix(Handle mname, + KlassHandle accessing_klass, objArrayHandle appendix_box, Handle* appendix_result, TRAPS) { @@ -2361,6 +2371,12 @@ #endif //PRODUCT } (*appendix_result) = Handle(THREAD, appendix); + // the target is stored in the cpCache and if a reference to this + // MethodName is dropped we need a way to make sure the + // class_loader containing this method is kept alive. + // FIXME: the appendix might also preserve this dependency. + ClassLoaderData* this_key = InstanceKlass::cast(accessing_klass())->class_loader_data(); + this_key->record_dependency(m->method_holder(), CHECK_NULL); // Can throw OOM return methodHandle(THREAD, m); } } @@ -2405,7 +2421,7 @@ &args, CHECK_(empty)); Handle mname(THREAD, (oop) result.get_jobject()); (*method_type_result) = method_type; - return unpack_method_and_appendix(mname, appendix_box, appendix_result, THREAD); + return unpack_method_and_appendix(mname, accessing_klass, appendix_box, appendix_result, THREAD); } @@ -2596,7 +2612,7 @@ &args, CHECK_(empty)); Handle mname(THREAD, (oop) result.get_jobject()); (*method_type_result) = method_type; - return unpack_method_and_appendix(mname, appendix_box, appendix_result, THREAD); + return unpack_method_and_appendix(mname, caller, appendix_box, appendix_result, THREAD); } // Since the identity hash code for symbols changes when the symbols are diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/classfile/systemDictionary.hpp --- a/hotspot/src/share/vm/classfile/systemDictionary.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -471,7 +471,7 @@ static void compute_java_system_loader(TRAPS); // Register a new class loader - static ClassLoaderData* register_loader(Handle class_loader); + static ClassLoaderData* register_loader(Handle class_loader, TRAPS); private: // Mirrors for primitive classes (created eagerly) static oop check_mirror(oop m) { @@ -531,7 +531,7 @@ InstanceKlass::cast((loader)->klass())->name()->as_C_string() ); } static const char* loader_name(ClassLoaderData* loader_data) { - return (loader_data->is_the_null_class_loader_data() ? "" : + return (loader_data->class_loader() == NULL ? "" : InstanceKlass::cast((loader_data->class_loader())->klass())->name()->as_C_string() ); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/compiler/compileBroker.cpp --- a/hotspot/src/share/vm/compiler/compileBroker.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -269,10 +269,12 @@ const char* comment, bool is_blocking) { assert(!_lock->is_locked(), "bad locking"); + InstanceKlass* holder = method->method_holder(); _compile_id = compile_id; _method = method(); - _method_loader = JNIHandles::make_global(_method->method_holder()->class_loader()); + _method_holder = JNIHandles::make_global( + holder->is_anonymous() ? holder->java_mirror(): holder->class_loader()); _osr_bci = osr_bci; _is_blocking = is_blocking; _comp_level = comp_level; @@ -283,7 +285,7 @@ _code_handle = NULL; _hot_method = NULL; - _hot_method_loader = NULL; + _hot_method_holder = NULL; _hot_count = hot_count; _time_queued = 0; // tidy _comment = comment; @@ -295,8 +297,12 @@ _hot_method = _method; } else { _hot_method = hot_method(); + // only add loader or mirror if different from _method_holder + InstanceKlass* hot_holder = hot_method->method_holder(); + _hot_method_holder = JNIHandles::make_global( + hot_holder->is_anonymous() ? hot_holder->java_mirror() : + hot_holder->class_loader()); } - _hot_method_loader = JNIHandles::make_global(_hot_method->method_holder()->class_loader()); } } @@ -321,8 +327,8 @@ void CompileTask::free() { set_code(NULL); assert(!_lock->is_locked(), "Should not be locked when freed"); - JNIHandles::destroy_global(_method_loader); - JNIHandles::destroy_global(_hot_method_loader); + JNIHandles::destroy_global(_method_holder); + JNIHandles::destroy_global(_hot_method_holder); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/compiler/compileBroker.hpp --- a/hotspot/src/share/vm/compiler/compileBroker.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/compiler/compileBroker.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -43,7 +43,7 @@ Monitor* _lock; uint _compile_id; Method* _method; - jobject _method_loader; + jobject _method_holder; int _osr_bci; bool _is_complete; bool _is_success; @@ -56,7 +56,7 @@ // Fields used for logging why the compilation was initiated: jlong _time_queued; // in units of os::elapsed_counter() Method* _hot_method; // which method actually triggered this task - jobject _hot_method_loader; + jobject _hot_method_holder; int _hot_count; // information about its invocation counter const char* _comment; // more info about the task diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -40,19 +40,8 @@ #include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // // ConcurrentMarkSweepPolicy methods diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -27,18 +27,7 @@ #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp" #include "gc_implementation/shared/concurrentGCThread.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" class ConcurrentMarkSweepGeneration; class CMSCollector; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -65,8 +65,7 @@ declare_toplevel_type(AFLBinaryTreeDictionary*) \ declare_toplevel_type(LinearAllocBlock) \ declare_toplevel_type(FreeBlockDictionary) \ - declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary) \ - declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary) \ + declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary) #define VM_INT_CONSTANTS_CMS(declare_constant) \ declare_constant(Generation::ConcurrentMarkSweep) \ diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -28,20 +28,8 @@ #include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/safepoint.hpp" -#include "runtime/thread.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/workgroup.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif bool DirtyCardQueue::apply_closure(CardTableEntryClosure* cl, bool consume, diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -302,16 +302,28 @@ for (size_t c = start_card + 1; c <= end_card; c++ /* yeah! */) { u_char entry = _array->offset_array(c); if (c - start_card > BlockOffsetArray::power_to_cards_back(1)) { - guarantee(entry > N_words, "Should be in logarithmic region"); + guarantee(entry > N_words, + err_msg("Should be in logarithmic region - " + "entry: " UINT32_FORMAT ", " + "_array->offset_array(c): " UINT32_FORMAT ", " + "N_words: " UINT32_FORMAT, + entry, _array->offset_array(c), N_words)); } size_t backskip = BlockOffsetArray::entry_to_cards_back(entry); size_t landing_card = c - backskip; guarantee(landing_card >= (start_card - 1), "Inv"); if (landing_card >= start_card) { - guarantee(_array->offset_array(landing_card) <= entry, "monotonicity"); + guarantee(_array->offset_array(landing_card) <= entry, + err_msg("Monotonicity - landing_card offset: " UINT32_FORMAT ", " + "entry: " UINT32_FORMAT, + _array->offset_array(landing_card), entry)); } else { guarantee(landing_card == start_card - 1, "Tautology"); - guarantee(_array->offset_array(landing_card) <= N_words, "Offset value"); + // Note that N_words is the maximum offset value + guarantee(_array->offset_array(landing_card) <= N_words, + err_msg("landing card offset: " UINT32_FORMAT ", " + "N_words: " UINT32_FORMAT, + _array->offset_array(landing_card), N_words)); } } } @@ -536,17 +548,27 @@ // The offset can be 0 if the block starts on a boundary. That // is checked by an assertion above. size_t start_index = _array->index_for(blk_start); - HeapWord* boundary = _array->address_for_index(start_index); + HeapWord* boundary = _array->address_for_index(start_index); assert((_array->offset_array(orig_index) == 0 && blk_start == boundary) || (_array->offset_array(orig_index) > 0 && _array->offset_array(orig_index) <= N_words), - "offset array should have been set"); + err_msg("offset array should have been set - " + "orig_index offset: " UINT32_FORMAT ", " + "blk_start: " PTR_FORMAT ", " + "boundary: " PTR_FORMAT, + _array->offset_array(orig_index), + blk_start, boundary)); for (size_t j = orig_index + 1; j <= end_index; j++) { assert(_array->offset_array(j) > 0 && _array->offset_array(j) <= (u_char) (N_words+BlockOffsetArray::N_powers-1), - "offset array should have been set"); + err_msg("offset array should have been set - " + UINT32_FORMAT " not > 0 OR " + UINT32_FORMAT " not <= " UINT32_FORMAT, + _array->offset_array(j), + _array->offset_array(j), + (u_char) (N_words+BlockOffsetArray::N_powers-1))); } #endif } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -78,7 +78,9 @@ virtual void resize(size_t new_word_size) = 0; virtual void set_bottom(HeapWord* new_bottom) { - assert(new_bottom <= _end, "new_bottom > _end"); + assert(new_bottom <= _end, + err_msg("new_bottom (" PTR_FORMAT ") > _end (" PTR_FORMAT ")", + new_bottom, _end)); _bottom = new_bottom; resize(pointer_delta(_end, _bottom)); } @@ -134,29 +136,42 @@ VirtualSpace _vs; u_char* _offset_array; // byte array keeping backwards offsets + void check_index(size_t index, const char* msg) const { + assert(index < _vs.committed_size(), + err_msg("%s - " + "index: " SIZE_FORMAT ", _vs.committed_size: " SIZE_FORMAT, + msg, index, _vs.committed_size())); + } + + void check_offset(size_t offset, const char* msg) const { + assert(offset <= N_words, + err_msg("%s - " + "offset: " UINT32_FORMAT", N_words: " UINT32_FORMAT, + msg, offset, N_words)); + } + // Bounds checking accessors: // For performance these have to devolve to array accesses in product builds. u_char offset_array(size_t index) const { - assert(index < _vs.committed_size(), "index out of range"); + check_index(index, "index out of range"); return _offset_array[index]; } void set_offset_array(size_t index, u_char offset) { - assert(index < _vs.committed_size(), "index out of range"); - assert(offset <= N_words, "offset too large"); + check_index(index, "index out of range"); + check_offset(offset, "offset too large"); _offset_array[index] = offset; } void set_offset_array(size_t index, HeapWord* high, HeapWord* low) { - assert(index < _vs.committed_size(), "index out of range"); + check_index(index, "index out of range"); assert(high >= low, "addresses out of order"); - assert(pointer_delta(high, low) <= N_words, "offset too large"); + check_offset(pointer_delta(high, low), "offset too large"); _offset_array[index] = (u_char) pointer_delta(high, low); } void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) { - assert(index_for(right - 1) < _vs.committed_size(), - "right address out of range"); + check_index(index_for(right - 1), "right address out of range"); assert(left < right, "Heap addresses out of order"); size_t num_cards = pointer_delta(right, left) >> LogN_words; if (UseMemSetInBOT) { @@ -171,7 +186,7 @@ } void set_offset_array(size_t left, size_t right, u_char offset) { - assert(right < _vs.committed_size(), "right address out of range"); + check_index(right, "right index out of range"); assert(left <= right, "indexes out of order"); size_t num_cards = right - left + 1; if (UseMemSetInBOT) { @@ -186,11 +201,10 @@ } void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const { - assert(index < _vs.committed_size(), "index out of range"); + check_index(index, "index out of range"); assert(high >= low, "addresses out of order"); - assert(pointer_delta(high, low) <= N_words, "offset too large"); - assert(_offset_array[index] == pointer_delta(high, low), - "Wrong offset"); + check_offset(pointer_delta(high, low), "offset too large"); + assert(_offset_array[index] == pointer_delta(high, low), "Wrong offset"); } bool is_card_boundary(HeapWord* p) const; @@ -481,7 +495,6 @@ blk_start, blk_end); } - public: G1BlockOffsetArrayContigSpace(G1BlockOffsetSharedArray* array, MemRegion mr); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -49,16 +49,17 @@ char* pc = (char*)p; assert(pc >= (char*)_reserved.start() && pc < (char*)_reserved.end(), - "p not in range."); + err_msg("p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")", + p, (char*)_reserved.start(), (char*)_reserved.end())); size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char)); size_t result = delta >> LogN; - assert(result < _vs.committed_size(), "bad index from address"); + check_index(result, "bad index from address"); return result; } inline HeapWord* G1BlockOffsetSharedArray::address_for_index(size_t index) const { - assert(index < _vs.committed_size(), "bad index"); + check_index(index, "index out of range"); HeapWord* result = _reserved.start() + (index << LogN_words); assert(result >= _reserved.start() && result < _reserved.end(), err_msg("bad address from index result " PTR_FORMAT diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -27,19 +27,7 @@ #include "gc_implementation/g1/heapRegion.hpp" #include "gc_implementation/g1/satbQueue.hpp" #include "runtime/mutexLocker.hpp" -#include "runtime/thread.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap, int max_covered_regions) : diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -28,18 +28,7 @@ #include "memory/allocation.inline.hpp" #include "runtime/mutex.hpp" #include "runtime/mutexLocker.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" PtrQueue::PtrQueue(PtrQueueSet* qset, bool perm, bool active) : _qset(qset), _buf(NULL), _index(0), _active(active), diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -52,14 +52,22 @@ PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(which); + PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); + CLDToOopClosure mark_and_push_from_clds(&mark_and_push_closure, true); CodeBlobToOopClosure mark_and_push_in_blobs(&mark_and_push_closure, /*do_marking=*/ true); if (_java_thread != NULL) - _java_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs); + _java_thread->oops_do( + &mark_and_push_closure, + &mark_and_push_from_clds, + &mark_and_push_in_blobs); if (_vm_thread != NULL) - _vm_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs); + _vm_thread->oops_do( + &mark_and_push_closure, + &mark_and_push_from_clds, + &mark_and_push_in_blobs); // Do the real work cm->follow_marking_stacks(); @@ -89,7 +97,8 @@ { ResourceMark rm; CodeBlobToOopClosure each_active_code_blob(&mark_and_push_closure, /*do_marking=*/ true); - Threads::oops_do(&mark_and_push_closure, &each_active_code_blob); + CLDToOopClosure mark_and_push_from_cld(&mark_and_push_closure); + Threads::oops_do(&mark_and_push_closure, &mark_and_push_from_cld, &each_active_code_blob); } break; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -495,8 +495,9 @@ ParallelScavengeHeap::ParStrongRootsScope psrs; Universe::oops_do(mark_and_push_closure()); JNIHandles::oops_do(mark_and_push_closure()); // Global (strong) JNI handles + CLDToOopClosure mark_and_push_from_cld(mark_and_push_closure()); CodeBlobToOopClosure each_active_code_blob(mark_and_push_closure(), /*do_marking=*/ true); - Threads::oops_do(mark_and_push_closure(), &each_active_code_blob); + Threads::oops_do(mark_and_push_closure(), &mark_and_push_from_cld, &each_active_code_blob); ObjectSynchronizer::oops_do(mark_and_push_closure()); FlatProfiler::oops_do(mark_and_push_closure()); Management::oops_do(mark_and_push_closure()); @@ -584,7 +585,8 @@ // General strong roots. Universe::oops_do(adjust_root_pointer_closure()); JNIHandles::oops_do(adjust_root_pointer_closure()); // Global (strong) JNI handles - Threads::oops_do(adjust_root_pointer_closure(), NULL); + CLDToOopClosure adjust_from_cld(adjust_root_pointer_closure()); + Threads::oops_do(adjust_root_pointer_closure(), &adjust_from_cld, NULL); ObjectSynchronizer::oops_do(adjust_root_pointer_closure()); FlatProfiler::oops_do(adjust_root_pointer_closure()); Management::oops_do(adjust_root_pointer_closure()); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -2436,7 +2436,8 @@ // General strong roots. Universe::oops_do(adjust_root_pointer_closure()); JNIHandles::oops_do(adjust_root_pointer_closure()); // Global (strong) JNI handles - Threads::oops_do(adjust_root_pointer_closure(), NULL); + CLDToOopClosure adjust_from_cld(adjust_root_pointer_closure()); + Threads::oops_do(adjust_root_pointer_closure(), &adjust_from_cld, NULL); ObjectSynchronizer::oops_do(adjust_root_pointer_closure()); FlatProfiler::oops_do(adjust_root_pointer_closure()); Management::oops_do(adjust_root_pointer_closure()); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -65,7 +65,8 @@ case threads: { ResourceMark rm; - Threads::oops_do(&roots_closure, NULL); + CLDToOopClosure* cld_closure = NULL; // Not needed. All CLDs are already visited. + Threads::oops_do(&roots_closure, cld_closure, NULL); } break; @@ -120,13 +121,14 @@ PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); PSScavengeRootsClosure roots_closure(pm); + CLDToOopClosure* roots_from_clds = NULL; // Not needed. All CLDs are already visited. CodeBlobToOopClosure roots_in_blobs(&roots_closure, /*do_marking=*/ true); if (_java_thread != NULL) - _java_thread->oops_do(&roots_closure, &roots_in_blobs); + _java_thread->oops_do(&roots_closure, roots_from_clds, &roots_in_blobs); if (_vm_thread != NULL) - _vm_thread->oops_do(&roots_closure, &roots_in_blobs); + _vm_thread->oops_do(&roots_closure, roots_from_clds, &roots_in_blobs); // Do the real work pm->drain_stacks(false); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp --- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -28,19 +28,7 @@ #include "gc_implementation/shared/spaceDecorator.hpp" #include "memory/sharedHeap.hpp" #include "oops/oop.inline.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif - +#include "runtime/thread.inline.hpp" MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) { _lgrp_spaces = new (ResourceObj::C_HEAP, mtGC) GrowableArray(0, true); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_interface/collectedHeap.cpp --- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -30,19 +30,8 @@ #include "oops/oop.inline.hpp" #include "oops/instanceMirrorKlass.hpp" #include "runtime/init.hpp" +#include "runtime/thread.inline.hpp" #include "services/heapDumper.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifdef ASSERT diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_interface/collectedHeap.hpp --- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -289,11 +289,6 @@ // (A scavenge is a GC which is not a full GC.) virtual bool is_scavengable(const void *p) = 0; - // Returns "TRUE" if "p" is a method oop in the - // current heap, with high probability. This predicate - // is not stable, in general. - bool is_valid_method(Method* p) const; - void set_gc_cause(GCCause::Cause v) { if (UsePerfData) { _gc_lastcause = _gc_cause; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp --- a/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -31,21 +31,9 @@ #include "oops/arrayOop.hpp" #include "prims/jvmtiExport.hpp" #include "runtime/sharedRuntime.hpp" -#include "runtime/thread.hpp" +#include "runtime/thread.inline.hpp" #include "services/lowMemoryDetector.hpp" #include "utilities/copy.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // Inline allocation implementations. @@ -242,36 +230,6 @@ return (oop)obj; } -// Returns "TRUE" if "p" is a method oop in the -// current heap with high probability. NOTE: The main -// current consumers of this interface are Forte:: -// and ThreadProfiler::. In these cases, the -// interpreter frame from which "p" came, may be -// under construction when sampled asynchronously, so -// the clients want to check that it represents a -// valid method before using it. Nonetheless since -// the clients do not typically lock out GC, the -// predicate is_valid_method() is not stable, so -// it is possible that by the time "p" is used, it -// is no longer valid. -inline bool CollectedHeap::is_valid_method(Method* p) const { - return - p != NULL && - - // Check whether "method" is metadata - p->is_metadata() && - - // See if GC is active; however, there is still an - // apparently unavoidable window after this call - // and before the client of this interface uses "p". - // If the client chooses not to lock out GC, then - // it's a risk the client must accept. - !is_gc_active() && - - // Check that p is a Method*. - p->is_method(); -} - inline void CollectedHeap::oop_iterate_no_header(OopClosure* cl) { NoHeaderExtendedOopClosure no_header_cl(cl); oop_iterate(&no_header_cl); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/interpreter/abstractInterpreter.hpp --- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -27,6 +27,7 @@ #include "code/stubs.hpp" #include "interpreter/bytecodes.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" #include "utilities/top.hpp" #ifdef TARGET_ARCH_MODEL_x86_32 @@ -47,18 +48,6 @@ #ifdef TARGET_ARCH_MODEL_ppc # include "interp_masm_ppc.hpp" #endif -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // This file contains the platform-independent parts // of the abstract interpreter and the abstract interpreter generator. diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/interpreter/interpreterRuntime.hpp --- a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -31,19 +31,8 @@ #include "oops/method.hpp" #include "runtime/frame.inline.hpp" #include "runtime/signature.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/top.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // The InterpreterRuntime is called by the interpreter for everything // that cannot/should not be dealt with in assembly and needs C support. diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/interpreter/linkResolver.cpp --- a/hotspot/src/share/vm/interpreter/linkResolver.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -43,19 +43,8 @@ #include "runtime/handles.inline.hpp" #include "runtime/reflection.hpp" #include "runtime/signature.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif //------------------------------------------------------------------------------------------------------------------------ // Implementation of FieldAccessInfo diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/allocation.cpp --- a/hotspot/src/share/vm/memory/allocation.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/allocation.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -66,10 +66,17 @@ } bool MetaspaceObj::is_metadata() const { - // ClassLoaderDataGraph::contains((address)this); has lock inversion problems + // GC Verify checks use this in guarantees. + // TODO: either replace them with is_metaspace_object() or remove them. + // is_metaspace_object() is slower than this test. This test doesn't + // seem very useful for metaspace objects anymore though. return !Universe::heap()->is_in_reserved(this); } +bool MetaspaceObj::is_metaspace_object() const { + return Metaspace::contains((void*)this); +} + void MetaspaceObj::print_address_on(outputStream* st) const { st->print(" {"INTPTR_FORMAT"}", this); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/allocation.hpp --- a/hotspot/src/share/vm/memory/allocation.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/allocation.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -245,6 +245,7 @@ class MetaspaceObj { public: bool is_metadata() const; + bool is_metaspace_object() const; // more specific test but slower bool is_shared() const; void print_address_on(outputStream* st) const; // nonvirtual address printing diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/binaryTreeDictionary.cpp --- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -290,7 +290,7 @@ assert(chunk->list() == this, "list should be set for chunk"); assert(tail() != NULL, "The tree list is embedded in the first chunk"); // which means that the list can never be empty. - assert(!verify_chunk_in_free_list(chunk), "Double entry"); + assert(!this->verify_chunk_in_free_list(chunk), "Double entry"); assert(head() == NULL || head()->prev() == NULL, "list invariant"); assert(tail() == NULL || tail()->next() == NULL, "list invariant"); @@ -300,7 +300,7 @@ assert(!tail() || size() == tail()->size(), "Wrong sized chunk in list"); FreeList_t::increment_count(); - debug_only(increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));) + debug_only(this->increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));) assert(head() == NULL || head()->prev() == NULL, "list invariant"); assert(tail() == NULL || tail()->next() == NULL, "list invariant"); } @@ -314,7 +314,7 @@ assert(chunk->list() == this, "list should be set for chunk"); assert(head() != NULL, "The tree list is embedded in the first chunk"); assert(chunk != NULL, "returning NULL chunk"); - assert(!verify_chunk_in_free_list(chunk), "Double entry"); + assert(!this->verify_chunk_in_free_list(chunk), "Double entry"); assert(head() == NULL || head()->prev() == NULL, "list invariant"); assert(tail() == NULL || tail()->next() == NULL, "list invariant"); @@ -328,7 +328,7 @@ head()->link_after(chunk); assert(!head() || size() == head()->size(), "Wrong sized chunk in list"); FreeList_t::increment_count(); - debug_only(increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));) + debug_only(this->increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));) assert(head() == NULL || head()->prev() == NULL, "list invariant"); assert(tail() == NULL || tail()->next() == NULL, "list invariant"); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/collectorPolicy.cpp --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -37,19 +37,8 @@ #include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifndef SERIALGC #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp" #include "gc_implementation/concurrentMarkSweep/cmsGCAdaptivePolicyCounters.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/defNewGeneration.cpp --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -38,20 +38,9 @@ #include "oops/instanceRefKlass.hpp" #include "oops/oop.inline.hpp" #include "runtime/java.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/copy.hpp" #include "utilities/stack.inline.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // // DefNewGeneration functions. diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/filemap.cpp --- a/hotspot/src/share/vm/memory/filemap.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/filemap.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/classLoader.hpp" #include "classfile/symbolTable.hpp" +#include "classfile/altHashing.hpp" #include "memory/filemap.hpp" #include "runtime/arguments.hpp" #include "runtime/java.hpp" @@ -82,8 +83,37 @@ close(); } +// Fill in the fileMapInfo structure with data about this VM instance. -// Fill in the fileMapInfo structure with data about this VM instance. +// This method copies the vm version info into header_version. If the version is too +// long then a truncated version, which has a hash code appended to it, is copied. +// +// Using a template enables this method to verify that header_version is an array of +// length JVM_IDENT_MAX. This ensures that the code that writes to the CDS file and +// the code that reads the CDS file will both use the same size buffer. Hence, will +// use identical truncation. This is necessary for matching of truncated versions. +template static void get_header_version(char (&header_version) [N]) { + assert(N == JVM_IDENT_MAX, "Bad header_version size"); + + const char *vm_version = VM_Version::internal_vm_info_string(); + const int version_len = (int)strlen(vm_version); + + if (version_len < (JVM_IDENT_MAX-1)) { + strcpy(header_version, vm_version); + + } else { + // Get the hash value. Use a static seed because the hash needs to return the same + // value over multiple jvm invocations. + unsigned int hash = AltHashing::murmur3_32(8191, (const jbyte*)vm_version, version_len); + + // Truncate the ident, saving room for the 8 hex character hash value. + strncpy(header_version, vm_version, JVM_IDENT_MAX-9); + + // Append the hash code as eight hex digits. + sprintf(&header_version[JVM_IDENT_MAX-9], "%08x", hash); + header_version[JVM_IDENT_MAX-1] = 0; // Null terminate. + } +} void FileMapInfo::populate_header(size_t alignment) { _header._magic = 0xf00baba2; @@ -95,13 +125,7 @@ // invoked with. // JVM version string ... changes on each build. - const char *vm_version = VM_Version::internal_vm_info_string(); - if (strlen(vm_version) < (JVM_IDENT_MAX-1)) { - strcpy(_header._jvm_ident, vm_version); - } else { - fail_stop("JVM Ident field for shared archive is too long" - " - truncated to <%s>", _header._jvm_ident); - } + get_header_version(_header._jvm_ident); // Build checks on classpath and jar files _header._num_jars = 0; @@ -434,8 +458,9 @@ fail_continue("The shared archive file has a bad magic number."); return false; } - if (strncmp(_header._jvm_ident, VM_Version::internal_vm_info_string(), - JVM_IDENT_MAX-1) != 0) { + char header_version[JVM_IDENT_MAX]; + get_header_version(header_version); + if (strncmp(_header._jvm_ident, header_version, JVM_IDENT_MAX-1) != 0) { fail_continue("The shared archive file was created by a different" " version or build of HotSpot."); return false; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/freeBlockDictionary.cpp --- a/hotspot/src/share/vm/memory/freeBlockDictionary.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/freeBlockDictionary.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -29,18 +29,7 @@ #include "memory/freeBlockDictionary.hpp" #include "memory/metablock.hpp" #include "memory/metachunk.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" #ifndef PRODUCT template Mutex* FreeBlockDictionary::par_lock() const { diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/gcLocker.hpp --- a/hotspot/src/share/vm/memory/gcLocker.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/gcLocker.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -29,21 +29,18 @@ #include "memory/genCollectedHeap.hpp" #include "memory/universe.hpp" #include "oops/oop.hpp" +#include "runtime/thread.inline.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif // The direct lock/unlock calls do not force a collection if an unlock diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/genMarkSweep.cpp --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -43,21 +43,10 @@ #include "runtime/fprofiler.hpp" #include "runtime/handles.inline.hpp" #include "runtime/synchronizer.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" #include "utilities/copy.hpp" #include "utilities/events.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, bool clear_all_softrefs) { diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/iterator.cpp --- a/hotspot/src/share/vm/memory/iterator.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/iterator.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -30,6 +30,10 @@ k->oops_do(_oop_closure); } +void CLDToOopClosure::do_cld(ClassLoaderData* cld) { + cld->oops_do(_oop_closure, &_klass_closure, _must_claim_cld); +} + void ObjectToOopClosure::do_object(oop obj) { obj->oop_iterate(_cl); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/iterator.hpp --- a/hotspot/src/share/vm/memory/iterator.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/iterator.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -135,6 +135,20 @@ virtual void do_klass(Klass* k); }; +class CLDToOopClosure { + OopClosure* _oop_closure; + KlassToOopClosure _klass_closure; + bool _must_claim_cld; + + public: + CLDToOopClosure(OopClosure* oop_closure, bool must_claim_cld = true) : + _oop_closure(oop_closure), + _klass_closure(oop_closure), + _must_claim_cld(must_claim_cld) {} + + void do_cld(ClassLoaderData* cld); +}; + // ObjectClosure is used for iterating through an object space class ObjectClosure : public Closure { diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/metachunk.hpp --- a/hotspot/src/share/vm/memory/metachunk.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/metachunk.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -123,9 +123,7 @@ void assert_is_mangled() const {/* Don't check "\*/} -#ifdef ASSERT - void mangle(); -#endif // ASSERT + NOT_PRODUCT(void mangle();) void print_on(outputStream* st) const; void verify(); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/metaspace.cpp --- a/hotspot/src/share/vm/memory/metaspace.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/metaspace.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -36,6 +36,7 @@ #include "memory/universe.hpp" #include "runtime/globals.hpp" #include "runtime/mutex.hpp" +#include "runtime/orderAccess.hpp" #include "services/memTracker.hpp" #include "utilities/copy.hpp" #include "utilities/debug.hpp" @@ -108,7 +109,6 @@ size_t Metablock::_overhead = 0; #endif - // Pointer to list of Metachunks. class ChunkList VALUE_OBJ_CLASS_SPEC { // List of free chunks @@ -325,10 +325,12 @@ bool expand_by(size_t words, bool pre_touch = false); bool shrink_by(size_t words); +#ifdef ASSERT // Debug support static void verify_virtual_space_total(); static void verify_virtual_space_count(); void mangle(); +#endif void print_on(outputStream* st) const; }; @@ -621,8 +623,8 @@ void locked_print_chunks_in_use_on(outputStream* st) const; void verify(); + NOT_PRODUCT(void mangle_freed_chunks();) #ifdef ASSERT - void mangle_freed_chunks(); void verify_allocation_total(); #endif }; @@ -711,7 +713,7 @@ bottom(), top(), end(), word_size()); } -#ifdef ASSERT +#ifndef PRODUCT void Metachunk::mangle() { // Mangle the payload of the chunk and not the links that // maintain list of chunks. @@ -719,7 +721,7 @@ size_t word_size = capacity_word_size() - overhead(); Copy::fill_to_words(start, word_size, metadata_chunk_initialize); } -#endif // ASSERT +#endif // PRODUCT void Metachunk::verify() { #ifdef ASSERT @@ -917,10 +919,12 @@ vs->high_boundary()); } +#ifdef ASSERT void VirtualSpaceNode::mangle() { size_t word_size = capacity_words_in_vs(); Copy::fill_to_words((HeapWord*) low(), word_size, 0xf1f1f1f1); } +#endif // ASSERT // VirtualSpaceList methods // Space allocated from the VirtualSpace @@ -1007,6 +1011,8 @@ delete new_entry; return false; } else { + // ensure lock-free iteration sees fully initialized node + OrderAccess::storestore(); link_vs(new_entry, vs_word_size); return true; } @@ -1096,7 +1102,6 @@ } } -#ifndef PRODUCT bool VirtualSpaceList::contains(const void *ptr) { VirtualSpaceNode* list = virtual_space_list(); VirtualSpaceListIterator iter(list); @@ -1108,7 +1113,6 @@ } return false; } -#endif // PRODUCT // MetaspaceGC methods @@ -1985,16 +1989,14 @@ locked_print_chunks_in_use_on(gclog_or_tty); } + // Mangle freed memory. + NOT_PRODUCT(mangle_freed_chunks();) + // Have to update before the chunks_in_use lists are emptied // below. chunk_manager->inc_free_chunks_total(sum_capacity_in_chunks_in_use(), sum_count_in_chunks_in_use()); -#ifdef ASSERT - // Mangle freed memory. - mangle_freed_chunks(); -#endif // ASSERT - // Add all the chunks in use by this space manager // to the global list of free chunks. @@ -2273,7 +2275,7 @@ " waste " SIZE_FORMAT, curr_total, used, free, capacity, waste); } -#ifdef ASSERT +#ifndef PRODUCT void SpaceManager::mangle_freed_chunks() { for (ChunkIndex index = SmallIndex; index < NumberOfInUseLists; @@ -2291,11 +2293,16 @@ } } } -#endif // ASSERT +#endif // PRODUCT // MetaspaceAux +size_t MetaspaceAux::used_in_bytes() { + return (Metaspace::class_space_list()->used_words_sum() + + Metaspace::space_list()->used_words_sum()) * BytesPerWord; +} + size_t MetaspaceAux::used_in_bytes(Metaspace::MetadataType mdtype) { size_t used = 0; ClassLoaderDataGraphMetaspaceIterator iter; @@ -2324,6 +2331,11 @@ // The total words available for metadata allocation. This // uses Metaspace capacity_words() which is the total words // in chunks allocated for a Metaspace. +size_t MetaspaceAux::capacity_in_bytes() { + return (Metaspace::class_space_list()->capacity_words_sum() + + Metaspace::space_list()->capacity_words_sum()) * BytesPerWord; +} + size_t MetaspaceAux::capacity_in_bytes(Metaspace::MetadataType mdtype) { size_t capacity = free_chunks_total(mdtype); ClassLoaderDataGraphMetaspaceIterator iter; @@ -2336,6 +2348,11 @@ return capacity * BytesPerWord; } +size_t MetaspaceAux::reserved_in_bytes() { + return (Metaspace::class_space_list()->virtual_space_total() + + Metaspace::space_list()->virtual_space_total()) * BytesPerWord; +} + size_t MetaspaceAux::reserved_in_bytes(Metaspace::MetadataType mdtype) { size_t reserved = (mdtype == Metaspace::ClassType) ? Metaspace::class_space_list()->virtual_space_total() : @@ -2739,15 +2756,17 @@ } } -#ifndef PRODUCT -bool Metaspace::contains(const void * ptr) const { +bool Metaspace::contains(const void * ptr) { if (MetaspaceShared::is_in_shared_space(ptr)) { return true; } - MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag); + // This is checked while unlocked. As long as the virtualspaces are added + // at the end, the pointer will be in one of them. The virtual spaces + // aren't deleted presently. When they are, some sort of locking might + // be needed. Note, locking this can cause inversion problems with the + // caller in MetaspaceObj::is_metadata() function. return space_list()->contains(ptr) || class_space_list()->contains(ptr); } -#endif void Metaspace::verify() { vsm()->verify(); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/metaspace.hpp --- a/hotspot/src/share/vm/memory/metaspace.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/metaspace.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -135,11 +135,7 @@ static bool is_initialized() { return _class_space_list != NULL; } -#ifndef PRODUCT - bool contains(const void *ptr) const; - bool contains_class(const void *ptr) const; -#endif - + static bool contains(const void *ptr); void dump(outputStream* const out) const; void print_on(outputStream* st) const; @@ -160,25 +156,16 @@ public: // Total of space allocated to metadata in all Metaspaces - static size_t used_in_bytes() { - return used_in_bytes(Metaspace::ClassType) + - used_in_bytes(Metaspace::NonClassType); - } + static size_t used_in_bytes(); // Total of available space in all Metaspaces // Total of capacity allocated to all Metaspaces. This includes // space in Metachunks not yet allocated and in the Metachunk // freelist. - static size_t capacity_in_bytes() { - return capacity_in_bytes(Metaspace::ClassType) + - capacity_in_bytes(Metaspace::NonClassType); - } + static size_t capacity_in_bytes(); // Total space reserved in all Metaspaces - static size_t reserved_in_bytes() { - return reserved_in_bytes(Metaspace::ClassType) + - reserved_in_bytes(Metaspace::NonClassType); - } + static size_t reserved_in_bytes(); static size_t min_chunk_size(); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/resourceArea.cpp --- a/hotspot/src/share/vm/memory/resourceArea.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/resourceArea.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,18 +26,7 @@ #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "runtime/mutexLocker.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" //------------------------------ResourceMark----------------------------------- debug_only(int ResourceArea::_warned;) // to suppress multiple warnings diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/resourceArea.hpp --- a/hotspot/src/share/vm/memory/resourceArea.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/resourceArea.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,18 +26,7 @@ #define SHARE_VM_MEMORY_RESOURCEAREA_HPP #include "memory/allocation.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" // The resource area holds temporary data structures in the VM. // The actual allocation areas are thread local. Typical usage: diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/sharedHeap.cpp --- a/hotspot/src/share/vm/memory/sharedHeap.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -154,10 +154,12 @@ if (!_process_strong_tasks->is_task_claimed(SH_PS_JNIHandles_oops_do)) JNIHandles::oops_do(roots); // All threads execute this; the individual threads are task groups. + CLDToOopClosure roots_from_clds(roots); + CLDToOopClosure* roots_from_clds_p = (is_scavenging ? NULL : &roots_from_clds); if (ParallelGCThreads > 0) { - Threads::possibly_parallel_oops_do(roots, code_roots); + Threads::possibly_parallel_oops_do(roots, roots_from_clds_p ,code_roots); } else { - Threads::oops_do(roots, code_roots); + Threads::oops_do(roots, roots_from_clds_p, code_roots); } if (!_process_strong_tasks-> is_task_claimed(SH_PS_ObjectSynchronizer_oops_do)) ObjectSynchronizer::oops_do(roots); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/space.cpp --- a/hotspot/src/share/vm/memory/space.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/space.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -790,7 +790,9 @@ // Very general, slow implementation. HeapWord* ContiguousSpace::block_start_const(const void* p) const { - assert(MemRegion(bottom(), end()).contains(p), "p not in space"); + assert(MemRegion(bottom(), end()).contains(p), + err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", + p, bottom(), end())); if (p >= top()) { return top(); } else { @@ -800,19 +802,27 @@ last = cur; cur += oop(cur)->size(); } - assert(oop(last)->is_oop(), "Should be an object start"); + assert(oop(last)->is_oop(), + err_msg(PTR_FORMAT " should be an object start", last)); return last; } } size_t ContiguousSpace::block_size(const HeapWord* p) const { - assert(MemRegion(bottom(), end()).contains(p), "p not in space"); + assert(MemRegion(bottom(), end()).contains(p), + err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", + p, bottom(), end())); HeapWord* current_top = top(); - assert(p <= current_top, "p is not a block start"); - assert(p == current_top || oop(p)->is_oop(), "p is not a block start"); - if (p < current_top) + assert(p <= current_top, + err_msg("p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT, + p, current_top)); + assert(p == current_top || oop(p)->is_oop(), + err_msg("p (" PTR_FORMAT ") is not a block start - " + "current_top: " PTR_FORMAT ", is_oop: %s", + p, current_top, BOOL_TO_STR(oop(p)->is_oop()))); + if (p < current_top) { return oop(p)->size(); - else { + } else { assert(p == current_top, "just checking"); return pointer_delta(end(), (HeapWord*) p); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp --- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -28,19 +28,8 @@ #include "memory/threadLocalAllocBuffer.inline.hpp" #include "memory/universe.inline.hpp" #include "oops/oop.inline.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/copy.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // Thread-Local Edens support diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/memory/universe.cpp --- a/hotspot/src/share/vm/memory/universe.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/memory/universe.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -62,6 +62,7 @@ #include "runtime/javaCalls.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/synchronizer.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" #include "runtime/vm_operations.hpp" #include "services/memoryService.hpp" @@ -69,18 +70,6 @@ #include "utilities/events.hpp" #include "utilities/hashtable.inline.hpp" #include "utilities/preserveException.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifndef SERIALGC #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp" #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp" @@ -418,6 +407,10 @@ assert(i == _fullgc_alot_dummy_array->length(), "just checking"); } #endif + + // Initialize dependency array for null class loader + ClassLoaderData::the_null_class_loader_data()->init_dependencies(CHECK); + } // CDS support for patching vtables in metadata in the shared archive. @@ -425,14 +418,10 @@ // from MetaspaceObj, because the latter does not have virtual functions. // If the metadata type has a vtable, it cannot be shared in the read-only // section of the CDS archive, because the vtable pointer is patched. -static inline void* dereference(void* addr) { - return *(void**)addr; -} - static inline void add_vtable(void** list, int* n, void* o, int count) { guarantee((*n) < count, "vtable list too small"); - void* vtable = dereference(o); - assert(dereference(vtable) != NULL, "invalid vtable"); + void* vtable = dereference_vptr(o); + assert(*(void**)(vtable) != NULL, "invalid vtable"); list[(*n)++] = vtable; } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/compiledICHolder.cpp --- a/hotspot/src/share/vm/oops/compiledICHolder.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/compiledICHolder.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -48,8 +48,8 @@ // Verification void CompiledICHolder::verify_on(outputStream* st) { - guarantee(holder_method()->is_metadata(), "should be in permspace"); + guarantee(holder_method()->is_metadata(), "should be in metaspace"); guarantee(holder_method()->is_method(), "should be method"); - guarantee(holder_klass()->is_metadata(), "should be in permspace"); + guarantee(holder_klass()->is_metadata(), "should be in metaspace"); guarantee(holder_klass()->is_klass(), "should be klass"); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/constMethod.cpp --- a/hotspot/src/share/vm/oops/constMethod.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/constMethod.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -39,16 +39,19 @@ int localvariable_table_length, int exception_table_length, int checked_exceptions_length, + u2 generic_signature_index, MethodType method_type, TRAPS) { int size = ConstMethod::size(byte_code_size, compressed_line_number_size, localvariable_table_length, exception_table_length, - checked_exceptions_length); + checked_exceptions_length, + generic_signature_index); return new (loader_data, size, true, THREAD) ConstMethod( byte_code_size, compressed_line_number_size, localvariable_table_length, - exception_table_length, checked_exceptions_length, method_type, size); + exception_table_length, checked_exceptions_length, generic_signature_index, + method_type, size); } ConstMethod::ConstMethod(int byte_code_size, @@ -56,6 +59,7 @@ int localvariable_table_length, int exception_table_length, int checked_exceptions_length, + u2 generic_signature_index, MethodType method_type, int size) { @@ -66,7 +70,8 @@ set_stackmap_data(NULL); set_code_size(byte_code_size); set_constMethod_size(size); - set_inlined_tables_length(checked_exceptions_length, + set_inlined_tables_length(generic_signature_index, + checked_exceptions_length, compressed_line_number_size, localvariable_table_length, exception_table_length); @@ -90,7 +95,8 @@ int compressed_line_number_size, int local_variable_table_length, int exception_table_length, - int checked_exceptions_length) { + int checked_exceptions_length, + u2 generic_signature_index) { int extra_bytes = code_size; if (compressed_line_number_size > 0) { extra_bytes += compressed_line_number_size; @@ -108,6 +114,9 @@ extra_bytes += sizeof(u2); extra_bytes += exception_table_length * sizeof(ExceptionTableElement); } + if (generic_signature_index != 0) { + extra_bytes += sizeof(u2); + } int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord; return align_object_size(header_size() + extra_words); } @@ -125,10 +134,17 @@ return code_end(); } -u2* ConstMethod::checked_exceptions_length_addr() const { +u2* ConstMethod::generic_signature_index_addr() const { // Located at the end of the constMethod. + assert(has_generic_signature(), "called only if generic signature exists"); + return last_u2_element(); +} + +u2* ConstMethod::checked_exceptions_length_addr() const { + // Located immediately before the generic signature index. assert(has_checked_exceptions(), "called only if table is present"); - return last_u2_element(); + return has_generic_signature() ? (last_u2_element() - 1) : + last_u2_element(); } u2* ConstMethod::exception_table_length_addr() const { @@ -137,8 +153,10 @@ // If checked_exception present, locate immediately before them. return (u2*) checked_exceptions_start() - 1; } else { - // Else, the exception table is at the end of the constMethod. - return last_u2_element(); + // Else, the exception table is at the end of the constMethod or + // immediately before the generic signature index. + return has_generic_signature() ? (last_u2_element() - 1) : + last_u2_element(); } } @@ -152,25 +170,30 @@ // If checked_exception present, locate immediately before them. return (u2*) checked_exceptions_start() - 1; } else { - // Else, the linenumber table is at the end of the constMethod. - return last_u2_element(); + // Else, the linenumber table is at the end of the constMethod or + // immediately before the generic signature index. + return has_generic_signature() ? (last_u2_element() - 1) : + last_u2_element(); } } } - // Update the flags to indicate the presence of these optional fields. -void ConstMethod::set_inlined_tables_length( - int checked_exceptions_len, - int compressed_line_number_size, - int localvariable_table_len, - int exception_table_len) { +void ConstMethod::set_inlined_tables_length(u2 generic_signature_index, + int checked_exceptions_len, + int compressed_line_number_size, + int localvariable_table_len, + int exception_table_len) { // Must be done in the order below, otherwise length_addr accessors // will not work. Only set bit in header if length is positive. assert(_flags == 0, "Error"); if (compressed_line_number_size > 0) { _flags |= _has_linenumber_table; } + if (generic_signature_index != 0) { + _flags |= _has_generic_signature; + *(generic_signature_index_addr()) = generic_signature_index; + } if (checked_exceptions_len > 0) { _flags |= _has_checked_exceptions; *(checked_exceptions_length_addr()) = checked_exceptions_len; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/constMethod.hpp --- a/hotspot/src/share/vm/oops/constMethod.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/constMethod.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -45,7 +45,7 @@ // | constMethod_size | // | interp_kind | flags | code_size | // | name index | signature index | -// | method_idnum | generic_signature_index | +// | method_idnum | max_stack | // |------------------------------------------------------| // | | // | byte codes | @@ -55,26 +55,29 @@ // | (see class CompressedLineNumberReadStream) | // | (note that length is unknown until decompressed) | // | (access flags bit tells whether table is present) | -// | (indexed from start of ConstMethod*) | +// | (indexed from start of ConstMethod*) | // | (elements not necessarily sorted!) | // |------------------------------------------------------| // | localvariable table elements + length (length last) | // | (length is u2, elements are 6-tuples of u2) | // | (see class LocalVariableTableElement) | // | (access flags bit tells whether table is present) | -// | (indexed from end of ConstMethod*) | +// | (indexed from end of ConstMethod*) | // |------------------------------------------------------| // | exception table + length (length last) | // | (length is u2, elements are 4-tuples of u2) | // | (see class ExceptionTableElement) | // | (access flags bit tells whether table is present) | -// | (indexed from end of ConstMethod*) | +// | (indexed from end of ConstMethod*) | // |------------------------------------------------------| // | checked exceptions elements + length (length last) | // | (length is u2, elements are u2) | // | (see class CheckedExceptionElement) | // | (access flags bit tells whether table is present) | -// | (indexed from end of ConstMethod*) | +// | (indexed from end of ConstMethod*) | +// |------------------------------------------------------| +// | generic signature index (u2) | +// | (indexed from start of constMethodOop) | // |------------------------------------------------------| @@ -118,7 +121,8 @@ _has_checked_exceptions = 2, _has_localvariable_table = 4, _has_exception_table = 8, - _is_overpass = 16 + _has_generic_signature = 16, + _is_overpass = 32 }; // Bit vector of signature @@ -145,7 +149,7 @@ u2 _method_idnum; // unique identification number for the method within the class // initially corresponds to the index into the methods array. // but this may change with redefinition - u2 _generic_signature_index; // Generic signature (index in constant pool, 0 if absent) + u2 _max_stack; // Maximum number of entries on the expression stack // Constructor @@ -154,6 +158,7 @@ int localvariable_table_length, int exception_table_length, int checked_exceptions_length, + u2 generic_signature_index, MethodType is_overpass, int size); public: @@ -164,17 +169,22 @@ int localvariable_table_length, int exception_table_length, int checked_exceptions_length, + u2 generic_signature_index, MethodType mt, TRAPS); bool is_constMethod() const { return true; } // Inlined tables - void set_inlined_tables_length(int checked_exceptions_len, + void set_inlined_tables_length(u2 generic_signature_index, + int checked_exceptions_len, int compressed_line_number_size, int localvariable_table_len, int exception_table_len); + bool has_generic_signature() const + { return (_flags & _has_generic_signature) != 0; } + bool has_linenumber_table() const { return (_flags & _has_linenumber_table) != 0; } @@ -252,8 +262,18 @@ void set_signature_index(int index) { _signature_index = index; } // generics support - int generic_signature_index() const { return _generic_signature_index; } - void set_generic_signature_index(int index) { _generic_signature_index = index; } + int generic_signature_index() const { + if (has_generic_signature()) { + return *generic_signature_index_addr(); + } else { + return 0; + } + } + void set_generic_signature_index(u2 index) { + assert(has_generic_signature(), ""); + u2* addr = generic_signature_index_addr(); + *addr = index; + } // Sizing static int header_size() { @@ -264,7 +284,8 @@ static int size(int code_size, int compressed_line_number_size, int local_variable_table_length, int exception_table_length, - int checked_exceptions_length); + int checked_exceptions_length, + u2 generic_signature_index); int size() const { return _constMethod_size;} void set_constMethod_size(int size) { _constMethod_size = size; } @@ -281,6 +302,7 @@ // linenumber table - note that length is unknown until decompression, // see class CompressedLineNumberReadStream. u_char* compressed_linenumber_table() const; // not preserved by gc + u2* generic_signature_index_addr() const; u2* checked_exceptions_length_addr() const; u2* localvariable_table_length_addr() const; u2* exception_table_length_addr() const; @@ -314,12 +336,19 @@ static ByteSize constants_offset() { return byte_offset_of(ConstMethod, _constants); } + static ByteSize max_stack_offset() + { return byte_offset_of(ConstMethod, _max_stack); } + // Unique id for the method static const u2 MAX_IDNUM; static const u2 UNSET_IDNUM; u2 method_idnum() const { return _method_idnum; } void set_method_idnum(u2 idnum) { _method_idnum = idnum; } + // max stack + int max_stack() const { return _max_stack; } + void set_max_stack(int size) { _max_stack = size; } + // Deallocation for RedefineClasses void deallocate_contents(ClassLoaderData* loader_data); bool is_klass() const { return false; } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/constantPool.cpp --- a/hotspot/src/share/vm/oops/constantPool.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/constantPool.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -340,9 +340,7 @@ do_resolve = this_oop->tag_at(which).is_unresolved_klass(); if (do_resolve) { ClassLoaderData* this_key = this_oop->pool_holder()->class_loader_data(); - if (!this_key->is_the_null_class_loader_data()) { - this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM - } + this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM this_oop->klass_at_put(which, k()); } } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/instanceKlass.cpp --- a/hotspot/src/share/vm/oops/instanceKlass.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -51,20 +51,9 @@ #include "runtime/handles.inline.hpp" #include "runtime/javaCalls.hpp" #include "runtime/mutexLocker.hpp" +#include "runtime/thread.inline.hpp" #include "services/threadService.hpp" #include "utilities/dtrace.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifndef SERIALGC #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp" #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/klass.cpp --- a/hotspot/src/share/vm/oops/klass.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/klass.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -373,29 +373,22 @@ debug_only(verify();) } -void Klass::remove_from_sibling_list() { - // remove receiver from sibling list - InstanceKlass* super = superklass(); - assert(super != NULL || this == SystemDictionary::Object_klass(), "should have super"); - if (super == NULL) return; // special case: class Object - if (super->subklass() == this) { - // first subklass - super->set_subklass(_next_sibling); - } else { - Klass* sib = super->subklass(); - while (sib->next_sibling() != this) { - sib = sib->next_sibling(); - }; - sib->set_next_sibling(_next_sibling); - } -} - bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { assert(is_metadata(), "p is not meta-data"); assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace"); + +#ifdef ASSERT // The class is alive iff the class loader is alive. oop loader = class_loader(); - return (loader == NULL) || is_alive->do_object_b(loader); + bool loader_alive = (loader == NULL) || is_alive->do_object_b(loader); +#endif // ASSERT + + // The class is alive if it's mirror is alive (which should be marked if the + // loader is alive) unless it's an anoymous class. + bool mirror_alive = is_alive->do_object_b(java_mirror()); + assert(!mirror_alive || loader_alive, "loader must be alive if the mirror is" + " but not the other way around with anonymous classes"); + return mirror_alive; } void Klass::clean_weak_klass_links(BoolObjectClosure* is_alive) { @@ -416,10 +409,10 @@ Klass* sub = current->subklass_oop(); while (sub != NULL && !sub->is_loader_alive(is_alive)) { #ifndef PRODUCT - if (TraceClassUnloading && WizardMode) { - ResourceMark rm; + if (TraceClassUnloading && WizardMode) { + ResourceMark rm; tty->print_cr("[Unlinking class (subclass) %s]", sub->external_name()); - } + } #endif sub = sub->next_sibling_oop(); } @@ -431,16 +424,16 @@ // Find and set the first alive sibling Klass* sibling = current->next_sibling_oop(); while (sibling != NULL && !sibling->is_loader_alive(is_alive)) { - if (TraceClassUnloading && WizardMode) { - ResourceMark rm; + if (TraceClassUnloading && WizardMode) { + ResourceMark rm; tty->print_cr("[Unlinking class (sibling) %s]", sibling->external_name()); - } + } sibling = sibling->next_sibling_oop(); - } + } current->set_next_sibling(sibling); if (sibling != NULL) { stack.push(sibling); -} + } // Clean the implementors list and method data. if (current->oop_is_instance()) { @@ -554,7 +547,11 @@ InstanceKlass* ik = (InstanceKlass*) this; if (ik->is_anonymous()) { assert(EnableInvokeDynamic, ""); - intptr_t hash = ik->java_mirror()->identity_hash(); + intptr_t hash = 0; + if (ik->java_mirror() != NULL) { + // java_mirror might not be created yet, return 0 as hash. + hash = ik->java_mirror()->identity_hash(); + } char hash_buf[40]; sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash); size_t hash_len = strlen(hash_buf); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/klass.hpp --- a/hotspot/src/share/vm/oops/klass.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/klass.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -267,7 +267,6 @@ Klass* subklass() const; Klass* next_sibling() const; void append_to_sibling_list(); // add newly created receiver to superklass' subklass list - void remove_from_sibling_list(); // remove receiver from sibling list void set_next_link(Klass* k) { _next_link = k; } Klass* next_link() const { return _next_link; } // The next klass defined by the class loader. @@ -581,8 +580,8 @@ // garbage collection support virtual void oops_do(OopClosure* cl); - // Checks if the class loader is alive. - // Iff the class loader is alive the Klass is considered alive. + // Iff the class loader (or mirror for anonymous classes) is alive the + // Klass is considered alive. // The is_alive closure passed in depends on the Garbage Collector used. bool is_loader_alive(BoolObjectClosure* is_alive); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/markOop.cpp --- a/hotspot/src/share/vm/oops/markOop.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/markOop.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,19 +24,7 @@ #include "precompiled.hpp" #include "oops/markOop.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif - +#include "runtime/thread.inline.hpp" void markOopDesc::print_on(outputStream* st) const { if (is_locked()) { diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/method.cpp --- a/hotspot/src/share/vm/oops/method.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/method.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -64,6 +64,7 @@ int localvariable_table_length, int exception_table_length, int checked_exceptions_length, + u2 generic_signature_index, ConstMethod::MethodType method_type, TRAPS) { assert(!access_flags.is_native() || byte_code_size == 0, @@ -74,6 +75,7 @@ localvariable_table_length, exception_table_length, checked_exceptions_length, + generic_signature_index, method_type, CHECK_NULL); @@ -1034,7 +1036,7 @@ methodHandle m; { Method* m_oop = Method::allocate(loader_data, 0, accessFlags_from(flags_bits), - 0, 0, 0, 0, ConstMethod::NORMAL, CHECK_(empty)); + 0, 0, 0, 0, 0, ConstMethod::NORMAL, CHECK_(empty)); m = methodHandle(THREAD, m_oop); } m->set_constants(cp()); @@ -1082,6 +1084,7 @@ assert(!m->is_native(), "cannot rewrite native methods"); // Allocate new Method* AccessFlags flags = m->access_flags(); + u2 generic_signature_index = m->generic_signature_index(); int checked_exceptions_len = m->checked_exceptions_length(); int localvariable_len = m->localvariable_table_length(); int exception_table_len = m->exception_table_length(); @@ -1094,6 +1097,7 @@ localvariable_len, exception_table_len, checked_exceptions_len, + generic_signature_index, m->method_type(), CHECK_(methodHandle())); methodHandle newm (THREAD, newm_oop); @@ -1814,6 +1818,23 @@ loader_data->jmethod_ids()->clear_all_methods(); } + +// Check that this pointer is valid by checking that the vtbl pointer matches +bool Method::is_valid_method() const { + if (this == NULL) { + return false; + } else if (!is_metaspace_object()) { + return false; + } else { + Method m; + // This assumes that the vtbl pointer is the first word of a C++ object. + // This assumption is also in universe.cpp patch_klass_vtble + void* vtbl2 = dereference_vptr((void*)&m); + void* this_vtbl = dereference_vptr((void*)this); + return vtbl2 == this_vtbl; + } +} + #ifndef PRODUCT void Method::print_jmethod_ids(ClassLoaderData* loader_data, outputStream* out) { out->print_cr("jni_method_id count = %d", loader_data->jmethod_ids()->count_methods()); @@ -1935,7 +1956,7 @@ guarantee(constMethod()->is_metadata(), "should be metadata"); MethodData* md = method_data(); guarantee(md == NULL || - md->is_metadata(), "should be in permspace"); + md->is_metadata(), "should be metadata"); guarantee(md == NULL || md->is_methodData(), "should be method data"); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/method.hpp --- a/hotspot/src/share/vm/oops/method.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/method.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -73,12 +73,10 @@ // |------------------------------------------------------| // | result_index (C++ interpreter only) | // |------------------------------------------------------| -// | method_size | max_stack | -// | max_locals | size_of_parameters | +// | method_size | max_locals | +// | size_of_parameters | intrinsic_id| flags | // |------------------------------------------------------| -// |intrinsic_id| flags | throwout_count | -// |------------------------------------------------------| -// | num_breakpoints | (unused) | +// | throwout_count | num_breakpoints | // |------------------------------------------------------| // | invocation_counter | // | backedge_counter | @@ -118,7 +116,6 @@ int _result_index; // C++ interpreter needs for converting results to/from stack #endif u2 _method_size; // size of this object - u2 _max_stack; // Maximum number of entries on the expression stack u2 _max_locals; // Number of local variables used by this method u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none) @@ -166,10 +163,12 @@ int localvariable_table_length, int exception_table_length, int checked_exceptions_length, + u2 generic_signature_index, ConstMethod::MethodType method_type, TRAPS); - Method() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); } + // CDS and vtbl checking can create an empty Method to get vtbl pointer. + Method(){} // The Method vtable is restored by this call when the Method is in the // shared archive. See patch_klass_vtables() in metaspaceShared.cpp for @@ -288,9 +287,9 @@ // max stack // return original max stack size for method verification - int verifier_max_stack() const { return _max_stack; } - int max_stack() const { return _max_stack + extra_stack_entries(); } - void set_max_stack(int size) { _max_stack = size; } + int verifier_max_stack() const { return constMethod()->max_stack(); } + int max_stack() const { return constMethod()->max_stack() + extra_stack_entries(); } + void set_max_stack(int size) { constMethod()->set_max_stack(size); } // max locals int max_locals() const { return _max_locals; } @@ -606,7 +605,6 @@ static ByteSize from_interpreted_offset() { return byte_offset_of(Method, _from_interpreted_entry ); } static ByteSize interpreter_entry_offset() { return byte_offset_of(Method, _i2i_entry ); } static ByteSize signature_handler_offset() { return in_ByteSize(sizeof(Method) + wordSize); } - static ByteSize max_stack_offset() { return byte_offset_of(Method, _max_stack ); } // for code generation static int method_data_offset_in_bytes() { return offset_of(Method, _method_data); } @@ -812,6 +810,9 @@ const char* internal_name() const { return "{method}"; } + // Check for valid method pointer + bool is_valid_method() const; + // Verify void verify() { verify_on(tty); } void verify_on(outputStream* st); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/objArrayKlass.cpp --- a/hotspot/src/share/vm/oops/objArrayKlass.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -88,11 +88,6 @@ } if (!supers_exist) { // Oops. Not allocated yet. Back out, allocate it, and retry. -#ifndef PRODUCT - if (WizardMode) { - tty->print_cr("Must retry array klass creation for depth %d",n); - } -#endif KlassHandle ek; { MutexUnlocker mu(MultiArray_lock); diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/oop.cpp --- a/hotspot/src/share/vm/oops/oop.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/oop.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -27,19 +27,8 @@ #include "classfile/javaClasses.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/copy.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif bool always_do_update_barrier = false; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/oops/oopsHierarchy.cpp --- a/hotspot/src/share/vm/oops/oopsHierarchy.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/oops/oopsHierarchy.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,20 +26,8 @@ #include "gc_interface/collectedHeap.hpp" #include "gc_interface/collectedHeap.inline.hpp" #include "oops/oopsHierarchy.hpp" -#include "runtime/thread.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/globalDefinitions.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifdef CHECK_UNHANDLED_OOPS diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/prims/forte.cpp --- a/hotspot/src/share/vm/prims/forte.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/prims/forte.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -216,10 +216,7 @@ // not yet valid. *method_p = method; - - // See if gc may have invalidated method since we validated frame - - if (!Universe::heap()->is_valid_method(method)) return false; + if (!method->is_valid_method()) return false; intptr_t bcx = fr->interpreter_frame_bcx(); @@ -394,19 +391,11 @@ bool fully_decipherable = find_initial_Java_frame(thd, &top_frame, &initial_Java_frame, &method, &bci); // The frame might not be walkable but still recovered a method - // (e.g. an nmethod with no scope info for the pc + // (e.g. an nmethod with no scope info for the pc) if (method == NULL) return; - CollectedHeap* ch = Universe::heap(); - - // The method is not stored GC safe so see if GC became active - // after we entered AsyncGetCallTrace() and before we try to - // use the Method*. - // Yes, there is still a window after this check and before - // we use Method* below, but we can't lock out GC so that - // has to be an acceptable risk. - if (!ch->is_valid_method(method)) { + if (!method->is_valid_method()) { trace->num_frames = ticks_GC_active; // -2 return; } @@ -440,13 +429,7 @@ bci = st.bci(); method = st.method(); - // The method is not stored GC safe so see if GC became active - // after we entered AsyncGetCallTrace() and before we try to - // use the Method*. - // Yes, there is still a window after this check and before - // we use Method* below, but we can't lock out GC so that - // has to be an acceptable risk. - if (!ch->is_valid_method(method)) { + if (!method->is_valid_method()) { // we throw away everything we've gathered in this sample since // none of it is safe trace->num_frames = ticks_GC_active; // -2 diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/prims/jni.cpp --- a/hotspot/src/share/vm/prims/jni.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/prims/jni.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -69,6 +69,7 @@ #include "runtime/reflection.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/signature.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vm_operations.hpp" #include "services/runtimeService.hpp" #include "trace/tracing.hpp" @@ -79,19 +80,15 @@ #include "utilities/histogram.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif static jint CurrentVersion = JNI_VERSION_1_6; @@ -5044,6 +5041,9 @@ #include "gc_interface/collectedHeap.hpp" #include "utilities/quickSort.hpp" +#if INCLUDE_VM_STRUCTS +#include "runtime/vmStructs.hpp" +#endif #define run_unit_test(unit_test_function_call) \ tty->print_cr("Running test: " #unit_test_function_call); \ @@ -5056,6 +5056,9 @@ run_unit_test(CollectedHeap::test_is_in()); run_unit_test(QuickSort::test_quick_sort()); run_unit_test(AltHashing::test_alt_hash()); +#if INCLUDE_VM_STRUCTS + run_unit_test(VMStructs::test()); +#endif tty->print_cr("All internal VM tests passed"); } } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/prims/jvmti.xml --- a/hotspot/src/share/vm/prims/jvmti.xml Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/prims/jvmti.xml Wed Jul 05 18:31:15 2017 +0200 @@ -2370,11 +2370,11 @@ jvmtiError err; err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, - &frames, &count); + frames, &count); if (err == JVMTI_ERROR_NONE && count >= 1) { char *methodName; err = (*jvmti)->GetMethodName(jvmti, frames[0].method, - &methodName, NULL); + &methodName, NULL, NULL); if (err == JVMTI_ERROR_NONE) { printf("Executing method: %s", methodName); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/prims/jvmtiEnv.cpp --- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -53,24 +53,12 @@ #include "runtime/osThread.hpp" #include "runtime/reflectionUtils.hpp" #include "runtime/signature.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vframe.hpp" #include "runtime/vmThread.hpp" #include "services/threadService.hpp" #include "utilities/exceptions.hpp" #include "utilities/preserveException.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif - #define FIXLATER 0 // REMOVE this when completed. diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/prims/jvmtiImpl.cpp --- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -41,22 +41,11 @@ #include "runtime/os.hpp" #include "runtime/serviceThread.hpp" #include "runtime/signature.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vframe.hpp" #include "runtime/vframe_hp.hpp" #include "runtime/vm_operations.hpp" #include "utilities/exceptions.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // // class JvmtiAgentThread diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/prims/unsafe.cpp --- a/hotspot/src/share/vm/prims/unsafe.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/prims/unsafe.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -996,7 +996,7 @@ // not just a literal string. For such ldc instructions, the verifier uses the // type Object instead of String, if the loaded constant is not in fact a String. -static oop +static instanceKlassHandle Unsafe_DefineAnonymousClass_impl(JNIEnv *env, jclass host_class, jbyteArray data, jobjectArray cp_patches_jh, HeapWord* *temp_alloc, @@ -1073,32 +1073,39 @@ anon_klass = instanceKlassHandle(THREAD, anonk); } - // let caller initialize it as needed... - - return anon_klass->java_mirror(); + return anon_klass; } UNSAFE_ENTRY(jclass, Unsafe_DefineAnonymousClass(JNIEnv *env, jobject unsafe, jclass host_class, jbyteArray data, jobjectArray cp_patches_jh)) { + instanceKlassHandle anon_klass; + jobject res_jh = NULL; + UnsafeWrapper("Unsafe_DefineAnonymousClass"); ResourceMark rm(THREAD); HeapWord* temp_alloc = NULL; - jobject res_jh = NULL; - - { oop res_oop = Unsafe_DefineAnonymousClass_impl(env, - host_class, data, cp_patches_jh, + anon_klass = Unsafe_DefineAnonymousClass_impl(env, host_class, data, + cp_patches_jh, &temp_alloc, THREAD); - if (res_oop != NULL) - res_jh = JNIHandles::make_local(env, res_oop); - } + if (anon_klass() != NULL) + res_jh = JNIHandles::make_local(env, anon_klass->java_mirror()); // try/finally clause: if (temp_alloc != NULL) { FREE_C_HEAP_ARRAY(HeapWord, temp_alloc, mtInternal); } + // The anonymous class loader data has been artificially been kept alive to + // this point. The mirror and any instances of this class have to keep + // it alive afterwards. + if (anon_klass() != NULL) { + anon_klass->class_loader_data()->set_keep_alive(false); + } + + // let caller initialize it as needed... + return (jclass) res_jh; } UNSAFE_END diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -1485,14 +1485,6 @@ } } } - if (UseNUMA) { - if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) { - FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M); - } - // For those collectors or operating systems (eg, Windows) that do - // not support full UseNUMA, we will map to UseNUMAInterleaving for now - UseNUMAInterleaving = true; - } } void Arguments::set_g1_gc_flags() { @@ -3332,6 +3324,22 @@ return JNI_OK; } +jint Arguments::adjust_after_os() { +#if INCLUDE_ALTERNATE_GCS + if (UseParallelGC || UseParallelOldGC) { + if (UseNUMA) { + if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) { + FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M); + } + // For those collectors or operating systems (eg, Windows) that do + // not support full UseNUMA, we will map to UseNUMAInterleaving for now + UseNUMAInterleaving = true; + } + } +#endif + return JNI_OK; +} + int Arguments::PropertyList_count(SystemProperty* pl) { int count = 0; while(pl != NULL) { diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/arguments.hpp --- a/hotspot/src/share/vm/runtime/arguments.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/arguments.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -409,6 +409,8 @@ public: // Parses the arguments static jint parse(const JavaVMInitArgs* args); + // Adjusts the arguments after the OS have adjusted the arguments + static jint adjust_after_os(); // Check for consistency in the selection of the garbage collector. static bool check_gc_consistency(); // Check consistecy or otherwise of VM argument settings diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/deoptimization.cpp --- a/hotspot/src/share/vm/runtime/deoptimization.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/deoptimization.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -721,7 +721,7 @@ guarantee(false, "wrong number of expression stack elements during deopt"); } VerifyOopClosure verify; - iframe->oops_interpreted_do(&verify, &rm, false); + iframe->oops_interpreted_do(&verify, NULL, &rm, false); callee_size_of_parameters = mh->size_of_parameters(); callee_max_locals = mh->max_locals(); is_top_frame = false; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/fprofiler.hpp --- a/hotspot/src/share/vm/runtime/fprofiler.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/fprofiler.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,18 +26,6 @@ #define SHARE_VM_RUNTIME_FPROFILER_HPP #include "runtime/timer.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // a simple flat profiler for Java diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/frame.cpp --- a/hotspot/src/share/vm/runtime/frame.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/frame.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -879,7 +879,8 @@ } -void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) { +void frame::oops_interpreted_do(OopClosure* f, CLDToOopClosure* cld_f, + const RegisterMap* map, bool query_oop_map_cache) { assert(is_interpreted_frame(), "Not an interpreted frame"); assert(map != NULL, "map must be set"); Thread *thread = Thread::current(); @@ -906,6 +907,16 @@ } // process fixed part + if (cld_f != NULL) { + // The method pointer in the frame might be the only path to the method's + // klass, and the klass needs to be kept alive while executing. The GCs + // don't trace through method pointers, so typically in similar situations + // the mirror or the class loader of the klass are installed as a GC root. + // To minimze the overhead of doing that here, we ask the GC to pass down a + // closure that knows how to keep klasses alive given a ClassLoaderData. + cld_f->do_cld(m->method_holder()->class_loader_data()); + } + #if !defined(PPC) || defined(ZERO) if (m->is_native()) { #ifdef CC_INTERP @@ -1108,7 +1119,7 @@ } -void frame::oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) { +void frame::oops_do_internal(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) { #ifndef PRODUCT // simulate GC crash here to dump java thread in error report if (CrashGCForDumpingJavaThread) { @@ -1117,7 +1128,7 @@ } #endif if (is_interpreted_frame()) { - oops_interpreted_do(f, map, use_interpreter_oop_map_cache); + oops_interpreted_do(f, cld_f, map, use_interpreter_oop_map_cache); } else if (is_entry_frame()) { oops_entry_do(f, map); } else if (CodeCache::contains(pc())) { @@ -1278,7 +1289,7 @@ } } COMPILER2_PRESENT(assert(DerivedPointerTable::is_empty(), "must be empty before verify");) - oops_do_internal(&VerifyOopClosure::verify_oop, NULL, (RegisterMap*)map, false); + oops_do_internal(&VerifyOopClosure::verify_oop, NULL, NULL, (RegisterMap*)map, false); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/frame.hpp --- a/hotspot/src/share/vm/runtime/frame.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/frame.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -413,19 +413,19 @@ // Oops-do's void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f); - void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true); + void oops_interpreted_do(OopClosure* f, CLDToOopClosure* cld_f, const RegisterMap* map, bool query_oop_map_cache = true); private: void oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f); // Iteration of oops - void oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache); + void oops_do_internal(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache); void oops_entry_do(OopClosure* f, const RegisterMap* map); void oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map); int adjust_offset(Method* method, int index); // helper for above fn public: // Memory management - void oops_do(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cf, map, true); } + void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cld_f, cf, map, true); } void nmethods_do(CodeBlobClosure* cf); // RedefineClasses support for finding live interpreted methods on the stack diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/handles.cpp --- a/hotspot/src/share/vm/runtime/handles.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/handles.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -27,21 +27,18 @@ #include "oops/constantPool.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" +#include "runtime/thread.inline.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif #ifdef ASSERT diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/handles.inline.hpp --- a/hotspot/src/share/vm/runtime/handles.inline.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/handles.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,18 +26,7 @@ #define SHARE_VM_RUNTIME_HANDLES_INLINE_HPP #include "runtime/handles.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" // these inline functions are in a separate file to break an include cycle // between Thread and Handle diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/interfaceSupport.hpp --- a/hotspot/src/share/vm/runtime/interfaceSupport.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/interfaceSupport.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -31,22 +31,11 @@ #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" #include "runtime/safepoint.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/preserveException.hpp" #include "utilities/top.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // Wrapper for all entry points to the virtual machine. // The HandleMarkCleaner is a faster version of HandleMark. diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/java.cpp --- a/hotspot/src/share/vm/runtime/java.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/java.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -54,6 +54,7 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/statSampler.hpp" #include "runtime/task.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" #include "runtime/vm_operations.hpp" #include "services/memReporter.hpp" @@ -79,18 +80,6 @@ #ifdef TARGET_ARCH_ppc # include "vm_version_ppc.hpp" #endif -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifndef SERIALGC #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" #include "gc_implementation/parallelScavenge/psScavenge.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/javaCalls.cpp --- a/hotspot/src/share/vm/runtime/javaCalls.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/javaCalls.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -39,18 +39,7 @@ #include "runtime/mutexLocker.hpp" #include "runtime/signature.hpp" #include "runtime/stubRoutines.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" // ----------------------------------------------------- // Implementation of JavaCallWrapper diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/javaCalls.hpp --- a/hotspot/src/share/vm/runtime/javaCalls.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/javaCalls.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -29,6 +29,7 @@ #include "oops/method.hpp" #include "runtime/handles.hpp" #include "runtime/javaFrameAnchor.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" #ifdef TARGET_ARCH_x86 # include "jniTypes_x86.hpp" @@ -45,18 +46,6 @@ #ifdef TARGET_ARCH_ppc # include "jniTypes_ppc.hpp" #endif -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // A JavaCallWrapper is constructed before each JavaCall and destructed after the call. // Its purpose is to allocate/deallocate a new handle block and to save/restore the last diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/jniHandles.cpp --- a/hotspot/src/share/vm/runtime/jniHandles.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/jniHandles.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -28,18 +28,7 @@ #include "prims/jvmtiExport.hpp" #include "runtime/jniHandles.hpp" #include "runtime/mutexLocker.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" JNIHandleBlock* JNIHandles::_global_handles = NULL; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/memprofiler.cpp --- a/hotspot/src/share/vm/runtime/memprofiler.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/memprofiler.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -35,19 +35,8 @@ #include "runtime/mutexLocker.hpp" #include "runtime/os.hpp" #include "runtime/task.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifndef PRODUCT diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/mutex.cpp --- a/hotspot/src/share/vm/runtime/mutex.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/mutex.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,22 +26,19 @@ #include "precompiled.hpp" #include "runtime/mutex.hpp" #include "runtime/osThread.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/events.hpp" #ifdef TARGET_OS_FAMILY_linux # include "mutex_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "mutex_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "mutex_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "mutex_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/mutexLocker.cpp --- a/hotspot/src/share/vm/runtime/mutexLocker.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -25,20 +25,9 @@ #include "precompiled.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/safepoint.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadLocalStorage.hpp" #include "runtime/vmThread.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // Mutexes used in the VM (see comment in mutexLocker.hpp): // diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/objectMonitor.cpp --- a/hotspot/src/share/vm/runtime/objectMonitor.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -34,25 +34,21 @@ #include "runtime/objectMonitor.inline.hpp" #include "runtime/osThread.hpp" #include "runtime/stubRoutines.hpp" -#include "runtime/thread.hpp" +#include "runtime/thread.inline.hpp" #include "services/threadService.hpp" #include "utilities/dtrace.hpp" #include "utilities/preserveException.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif #if defined(__GNUC__) && !defined(IA64) diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/os.cpp --- a/hotspot/src/share/vm/runtime/os.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/os.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -44,6 +44,7 @@ #include "runtime/mutexLocker.hpp" #include "runtime/os.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "services/attachListener.hpp" #include "services/memTracker.hpp" #include "services/threadService.hpp" @@ -51,19 +52,15 @@ #include "utilities/events.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif # include diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/safepoint.cpp --- a/hotspot/src/share/vm/runtime/safepoint.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/safepoint.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -48,6 +48,7 @@ #include "runtime/stubRoutines.hpp" #include "runtime/sweeper.hpp" #include "runtime/synchronizer.hpp" +#include "runtime/thread.inline.hpp" #include "services/memTracker.hpp" #include "services/runtimeService.hpp" #include "utilities/events.hpp" @@ -71,18 +72,6 @@ # include "nativeInst_ppc.hpp" # include "vmreg_ppc.inline.hpp" #endif -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifndef SERIALGC #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" #include "gc_implementation/shared/concurrentGCThread.hpp" diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/synchronizer.cpp --- a/hotspot/src/share/vm/runtime/synchronizer.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -36,24 +36,21 @@ #include "runtime/osThread.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/synchronizer.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/preserveException.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif #if defined(__GNUC__) && !defined(IA64) diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/task.cpp --- a/hotspot/src/share/vm/runtime/task.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/task.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,22 +26,19 @@ #include "memory/allocation.hpp" #include "runtime/init.hpp" #include "runtime/task.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif int PeriodicTask::_num_tasks = 0; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/thread.cpp --- a/hotspot/src/share/vm/runtime/thread.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/thread.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -65,6 +65,7 @@ #include "runtime/statSampler.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/task.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" #include "runtime/threadLocalStorage.hpp" #include "runtime/vframe.hpp" @@ -83,19 +84,15 @@ #include "utilities/preserveException.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif #ifndef SERIALGC #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" @@ -826,7 +823,7 @@ return false; } -void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) { +void Thread::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) { active_handles()->oops_do(f); // Do oop for ThreadShadow f->do_oop((oop*)&_pending_exception); @@ -2705,7 +2702,7 @@ } }; -void JavaThread::oops_do(OopClosure* f, CodeBlobClosure* cf) { +void JavaThread::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) { // Verify that the deferred card marks have been flushed. assert(deferred_card_mark().is_empty(), "Should be empty during GC"); @@ -2713,7 +2710,7 @@ // since there may be more than one thread using each ThreadProfiler. // Traverse the GCHandles - Thread::oops_do(f, cf); + Thread::oops_do(f, cld_f, cf); assert( (!has_last_Java_frame() && java_call_counter() == 0) || (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!"); @@ -2741,7 +2738,7 @@ // Traverse the execution stack for(StackFrameStream fst(this); !fst.is_done(); fst.next()) { - fst.current()->oops_do(f, cf, fst.register_map()); + fst.current()->oops_do(f, cld_f, cf, fst.register_map()); } } @@ -2875,7 +2872,7 @@ void JavaThread::verify() { // Verify oops in the thread. - oops_do(&VerifyOopClosure::verify_oop, NULL); + oops_do(&VerifyOopClosure::verify_oop, NULL, NULL); // Verify the stack frames. frames_do(frame_verify); @@ -3125,7 +3122,7 @@ static void oops_print(frame* f, const RegisterMap *map) { PrintAndVerifyOopClosure print; f->print_value(); - f->oops_do(&print, NULL, (RegisterMap*)map); + f->oops_do(&print, NULL, NULL, (RegisterMap*)map); } // Print our all the locations that contain oops and whether they are @@ -3227,8 +3224,8 @@ #endif } -void CompilerThread::oops_do(OopClosure* f, CodeBlobClosure* cf) { - JavaThread::oops_do(f, cf); +void CompilerThread::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) { + JavaThread::oops_do(f, cld_f, cf); if (_scanned_nmethod != NULL && cf != NULL) { // Safepoints can occur when the sweeper is scanning an nmethod so // process it here to make sure it isn't unloaded in the middle of @@ -3334,6 +3331,9 @@ jint os_init_2_result = os::init_2(); if (os_init_2_result != JNI_OK) return os_init_2_result; + jint adjust_after_os_result = Arguments::adjust_after_os(); + if (adjust_after_os_result != JNI_OK) return adjust_after_os_result; + // intialize TLS ThreadLocalStorage::init(); @@ -4198,14 +4198,14 @@ // uses the Threads_lock to gurantee this property. It also makes sure that // all threads gets blocked when exiting or starting). -void Threads::oops_do(OopClosure* f, CodeBlobClosure* cf) { +void Threads::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) { ALL_JAVA_THREADS(p) { - p->oops_do(f, cf); + p->oops_do(f, cld_f, cf); } - VMThread::vm_thread()->oops_do(f, cf); + VMThread::vm_thread()->oops_do(f, cld_f, cf); } -void Threads::possibly_parallel_oops_do(OopClosure* f, CodeBlobClosure* cf) { +void Threads::possibly_parallel_oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) { // Introduce a mechanism allowing parallel threads to claim threads as // root groups. Overhead should be small enough to use all the time, // even in sequential code. @@ -4222,12 +4222,12 @@ int cp = SharedHeap::heap()->strong_roots_parity(); ALL_JAVA_THREADS(p) { if (p->claim_oops_do(is_par, cp)) { - p->oops_do(f, cf); + p->oops_do(f, cld_f, cf); } } VMThread* vmt = VMThread::vm_thread(); if (vmt->claim_oops_do(is_par, cp)) { - vmt->oops_do(f, cf); + vmt->oops_do(f, cld_f, cf); } } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/thread.hpp --- a/hotspot/src/share/vm/runtime/thread.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/thread.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -480,8 +480,10 @@ // GC support // Apply "f->do_oop" to all root oops in "this". + // Apply "cld_f->do_cld" to CLDs that are otherwise not kept alive. + // Used by JavaThread::oops_do. // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames - virtual void oops_do(OopClosure* f, CodeBlobClosure* cf); + virtual void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf); // Handles the parallel case for the method below. private: @@ -1405,7 +1407,7 @@ void frames_do(void f(frame*, const RegisterMap*)); // Memory operations - void oops_do(OopClosure* f, CodeBlobClosure* cf); + void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf); // Sweeper operations void nmethods_do(CodeBlobClosure* cf); @@ -1825,7 +1827,7 @@ // GC support // Apply "f->do_oop" to all root oops in "this". // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames - void oops_do(OopClosure* f, CodeBlobClosure* cf); + void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf); #ifndef PRODUCT private: @@ -1892,9 +1894,9 @@ // Apply "f->do_oop" to all root oops in all threads. // This version may only be called by sequential code. - static void oops_do(OopClosure* f, CodeBlobClosure* cf); + static void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf); // This version may be called by sequential or parallel code. - static void possibly_parallel_oops_do(OopClosure* f, CodeBlobClosure* cf); + static void possibly_parallel_oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf); // This creates a list of GCTasks, one per thread. static void create_thread_roots_tasks(GCTaskQueue* q); // This creates a list of GCTasks, one per thread, for marking objects. diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/thread.inline.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/vm/runtime/thread.inline.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2012, 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. + * + */ + +#ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP +#define SHARE_VM_RUNTIME_THREAD_INLINE_HPP + +#define SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE + +#include "runtime/thread.hpp" +#ifdef TARGET_OS_FAMILY_linux +# include "thread_linux.inline.hpp" +#endif +#ifdef TARGET_OS_FAMILY_solaris +# include "thread_solaris.inline.hpp" +#endif +#ifdef TARGET_OS_FAMILY_windows +# include "thread_windows.inline.hpp" +#endif +#ifdef TARGET_OS_FAMILY_bsd +# include "thread_bsd.inline.hpp" +#endif + +#undef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE + +#endif // SHARE_VM_RUNTIME_THREAD_INLINE_HPP diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/threadLocalStorage.cpp --- a/hotspot/src/share/vm/runtime/threadLocalStorage.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/threadLocalStorage.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -23,22 +23,19 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadLocalStorage.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif // static member initialization diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/vmStructs.cpp --- a/hotspot/src/share/vm/runtime/vmStructs.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -95,6 +95,7 @@ #include "runtime/serviceThread.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/virtualspace.hpp" #include "runtime/vmStructs.hpp" #include "utilities/array.hpp" @@ -115,18 +116,6 @@ #ifdef TARGET_ARCH_ppc # include "vmStructs_ppc.hpp" #endif -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifdef TARGET_OS_ARCH_linux_x86 # include "vmStructs_linux_x86.hpp" #endif @@ -366,7 +355,6 @@ nonstatic_field(Method, _access_flags, AccessFlags) \ nonstatic_field(Method, _vtable_index, int) \ nonstatic_field(Method, _method_size, u2) \ - nonstatic_field(Method, _max_stack, u2) \ nonstatic_field(Method, _max_locals, u2) \ nonstatic_field(Method, _size_of_parameters, u2) \ nonstatic_field(Method, _interpreter_throwout_count, u2) \ @@ -389,7 +377,7 @@ nonstatic_field(ConstMethod, _name_index, u2) \ nonstatic_field(ConstMethod, _signature_index, u2) \ nonstatic_field(ConstMethod, _method_idnum, u2) \ - nonstatic_field(ConstMethod, _generic_signature_index, u2) \ + nonstatic_field(ConstMethod, _max_stack, u2) \ nonstatic_field(ObjArrayKlass, _element_klass, Klass*) \ nonstatic_field(ObjArrayKlass, _bottom_klass, Klass*) \ volatile_nonstatic_field(Symbol, _refcount, int) \ @@ -2107,8 +2095,7 @@ declare_toplevel_type(FreeList*) \ declare_toplevel_type(FreeList) \ declare_toplevel_type(MetablockTreeDictionary*) \ - declare_type(MetablockTreeDictionary, FreeBlockDictionary) \ - declare_type(MetablockTreeDictionary, FreeBlockDictionary) + declare_type(MetablockTreeDictionary, FreeBlockDictionary) /* NOTE that we do not use the last_entry() macro here; it is used */ @@ -2292,6 +2279,7 @@ declare_constant(ConstMethod::_has_checked_exceptions) \ declare_constant(ConstMethod::_has_localvariable_table) \ declare_constant(ConstMethod::_has_exception_table) \ + declare_constant(ConstMethod::_has_generic_signature) \ \ /*************************************/ \ /* InstanceKlass enum */ \ @@ -3215,3 +3203,17 @@ void vmStructs_init() { debug_only(VMStructs::init()); } + +#ifndef PRODUCT +void VMStructs::test() { + // Check for duplicate entries in type array + for (int i = 0; localHotSpotVMTypes[i].typeName != NULL; i++) { + for (int j = i + 1; localHotSpotVMTypes[j].typeName != NULL; j++) { + if (strcmp(localHotSpotVMTypes[i].typeName, localHotSpotVMTypes[j].typeName) == 0) { + tty->print_cr("Duplicate entries for '%s'", localHotSpotVMTypes[i].typeName); + assert(false, "Duplicate types in localHotSpotVMTypes array"); + } + } + } +} +#endif diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/vmStructs.hpp --- a/hotspot/src/share/vm/runtime/vmStructs.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/vmStructs.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -123,6 +123,11 @@ // the data structure (debug build only) static void init(); +#ifndef PRODUCT + // Execute unit tests + static void test(); +#endif + private: // Look up a type in localHotSpotVMTypes using strcmp() (debug build only). // Returns 1 if found, 0 if not. diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/vmThread.cpp --- a/hotspot/src/share/vm/runtime/vmThread.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/vmThread.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -31,24 +31,13 @@ #include "runtime/interfaceSupport.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/os.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" #include "runtime/vm_operations.hpp" #include "services/runtimeService.hpp" #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/xmlstream.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifndef USDT2 HS_DTRACE_PROBE_DECL3(hotspot, vmops__request, char *, uintptr_t, int); @@ -668,8 +657,8 @@ } -void VMThread::oops_do(OopClosure* f, CodeBlobClosure* cf) { - Thread::oops_do(f, cf); +void VMThread::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) { + Thread::oops_do(f, cld_f, cf); _vm_queue->oops_do(f); } @@ -701,5 +690,5 @@ #endif void VMThread::verify() { - oops_do(&VerifyOopClosure::verify_oop, NULL); + oops_do(&VerifyOopClosure::verify_oop, NULL, NULL); } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/vmThread.hpp --- a/hotspot/src/share/vm/runtime/vmThread.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/vmThread.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,19 +26,8 @@ #define SHARE_VM_RUNTIME_VMTHREAD_HPP #include "runtime/perfData.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vm_operations.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // // Prioritized queue of VM operations. @@ -137,7 +126,7 @@ static VMThread* vm_thread() { return _vm_thread; } // GC support - void oops_do(OopClosure* f, CodeBlobClosure* cf); + void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf); // Debugging void print_on(outputStream* st) const; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/vm_operations.cpp --- a/hotspot/src/share/vm/runtime/vm_operations.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/vm_operations.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -34,20 +34,9 @@ #include "runtime/deoptimization.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/sweeper.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vm_operations.hpp" #include "services/threadService.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #define VM_OP_NAME_INITIALIZE(name) #name, diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/runtime/vm_version.cpp --- a/hotspot/src/share/vm/runtime/vm_version.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/runtime/vm_version.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -243,19 +243,21 @@ #ifndef FLOAT_ARCH #if defined(__SOFTFP__) - #define FLOAT_ARCH "-sflt" + #define FLOAT_ARCH_STR "-sflt" #elif defined(E500V2) - #define FLOAT_ARCH "-e500v2" + #define FLOAT_ARCH_STR "-e500v2" #elif defined(ARM) - #define FLOAT_ARCH "-vfp" + #define FLOAT_ARCH_STR "-vfp" #elif defined(PPC) - #define FLOAT_ARCH "-hflt" + #define FLOAT_ARCH_STR "-hflt" #else - #define FLOAT_ARCH "" + #define FLOAT_ARCH_STR "" #endif + #else + #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH) #endif - return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH + return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH_STR " JRE (" JRE_RELEASE_VERSION "), built on " __DATE__ " " __TIME__ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER; } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/services/memSnapshot.cpp --- a/hotspot/src/share/vm/services/memSnapshot.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/services/memSnapshot.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -261,17 +261,19 @@ VMMemRegion* cur = (VMMemRegion*)current(); assert(cur->is_reserved_region() && cur->contains_region(rec), "Sanity check"); + if (rec->is_same_region(cur)) { + // release whole reserved region #ifdef ASSERT - VMMemRegion* next_reg = (VMMemRegion*)peek_next(); - // should not have any committed memory in this reserved region - assert(next_reg == NULL || !next_reg->is_committed_region(), "Sanity check"); + VMMemRegion* next_region = (VMMemRegion*)peek_next(); + // should not have any committed memory in this reserved region + assert(next_region == NULL || !next_region->is_committed_region(), "Sanity check"); #endif - if (rec->is_same_region(cur)) { remove(); } else if (rec->addr() == cur->addr() || rec->addr() + rec->size() == cur->addr() + cur->size()) { // released region is at either end of this region cur->exclude_region(rec->addr(), rec->size()); + assert(check_reserved_region(), "Integrity check"); } else { // split the reserved region and release the middle address high_addr = cur->addr() + cur->size(); size_t sz = high_addr - rec->addr(); @@ -280,10 +282,14 @@ if (MemTracker::track_callsite()) { MemPointerRecordEx tmp(rec->addr() + rec->size(), cur->flags(), sz, ((VMMemRegionEx*)cur)->pc()); - return insert_reserved_region(&tmp); + bool ret = insert_reserved_region(&tmp); + assert(!ret || check_reserved_region(), "Integrity check"); + return ret; } else { MemPointerRecord tmp(rec->addr() + rec->size(), cur->flags(), sz); - return insert_reserved_region(&tmp); + bool ret = insert_reserved_region(&tmp); + assert(!ret || check_reserved_region(), "Integrity check"); + return ret; } } return true; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/services/memSnapshot.hpp --- a/hotspot/src/share/vm/services/memSnapshot.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/services/memSnapshot.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -146,6 +146,23 @@ // reset current position inline void reset() { _pos = 0; } #ifdef ASSERT + // check integrity of records on current reserved memory region. + bool check_reserved_region() { + VMMemRegion* reserved_region = (VMMemRegion*)current(); + assert(reserved_region != NULL && reserved_region->is_reserved_region(), + "Sanity check"); + // all committed regions that follow current reserved region, should all + // belong to the reserved region. + VMMemRegion* next_region = (VMMemRegion*)next(); + for (; next_region != NULL && next_region->is_committed_region(); + next_region = (VMMemRegion*)next() ) { + if(!reserved_region->contains_region(next_region)) { + return false; + } + } + return true; + } + virtual bool is_dup_pointer(const MemPointer* ptr1, const MemPointer* ptr2) const { VMMemRegion* p1 = (VMMemRegion*)ptr1; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/services/memTracker.cpp --- a/hotspot/src/share/vm/services/memTracker.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/services/memTracker.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -69,15 +69,12 @@ void MemTracker::init_tracking_options(const char* option_line) { _tracking_level = NMT_off; - if (strncmp(option_line, "=summary", 8) == 0) { + if (strcmp(option_line, "=summary") == 0) { _tracking_level = NMT_summary; - } else if (strncmp(option_line, "=detail", 7) == 0) { + } else if (strcmp(option_line, "=detail") == 0) { _tracking_level = NMT_detail; - } else { - char msg[255]; - //+1 to remove the '=' character - jio_snprintf(msg, 255, "Unknown option given to XX:NativeMemoryTracking: %s", option_line+1); - vm_exit_during_initialization(msg, NULL); + } else if (strcmp(option_line, "=off") != 0) { + vm_exit_during_initialization("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", NULL); } } diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/services/memTracker.hpp --- a/hotspot/src/share/vm/services/memTracker.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/services/memTracker.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -109,10 +109,6 @@ #include "services/memSnapshot.hpp" #include "services/memTrackWorker.hpp" -#ifdef SOLARIS -#include "thread_solaris.inline.hpp" -#endif - extern bool NMT_track_callsite; #ifdef ASSERT diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/utilities/array.cpp --- a/hotspot/src/share/vm/utilities/array.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/utilities/array.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,19 +24,8 @@ #include "precompiled.hpp" #include "memory/resourceArea.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/array.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifdef ASSERT diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/utilities/debug.cpp --- a/hotspot/src/share/vm/utilities/debug.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/utilities/debug.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -44,6 +44,7 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/stubCodeGenerator.hpp" #include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/vframe.hpp" #include "services/heapDumper.hpp" #include "utilities/defaultStream.hpp" @@ -52,19 +53,15 @@ #include "utilities/vmError.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" -# include "thread_linux.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.inline.hpp" -# include "thread_solaris.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" -# include "thread_windows.inline.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" -# include "thread_bsd.inline.hpp" #endif #ifndef ASSERT diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/utilities/events.cpp --- a/hotspot/src/share/vm/utilities/events.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/utilities/events.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,22 +26,11 @@ #include "memory/allocation.inline.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/osThread.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" #include "runtime/threadLocalStorage.hpp" #include "runtime/timer.hpp" #include "utilities/events.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif EventLog* Events::_logs = NULL; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/utilities/exceptions.cpp --- a/hotspot/src/share/vm/utilities/exceptions.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/utilities/exceptions.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -30,21 +30,10 @@ #include "runtime/init.hpp" #include "runtime/java.hpp" #include "runtime/javaCalls.hpp" +#include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" #include "utilities/events.hpp" #include "utilities/exceptions.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // Implementation of ThreadShadow diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/utilities/globalDefinitions.hpp --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -1280,4 +1280,12 @@ #define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0])) +// Dereference vptr +// All C++ compilers that we know of have the vtbl pointer in the first +// word. If there are exceptions, this function needs to be made compiler +// specific. +static inline void* dereference_vptr(void* addr) { + return *(void**)addr; +} + #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/utilities/growableArray.cpp --- a/hotspot/src/share/vm/utilities/growableArray.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/utilities/growableArray.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -24,19 +24,9 @@ #include "precompiled.hpp" #include "memory/resourceArea.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/growableArray.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif + #ifdef ASSERT void GenericGrowableArray::set_nesting() { if (on_stack()) { diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/utilities/preserveException.hpp --- a/hotspot/src/share/vm/utilities/preserveException.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/utilities/preserveException.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -26,18 +26,7 @@ #define SHARE_VM_UTILITIES_PRESERVEEXCEPTION_HPP #include "runtime/handles.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif +#include "runtime/thread.inline.hpp" // This file provides more support for exception handling; see also exceptions.hpp class PreserveExceptionMark { diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/utilities/taskqueue.cpp --- a/hotspot/src/share/vm/utilities/taskqueue.cpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/utilities/taskqueue.cpp Wed Jul 05 18:31:15 2017 +0200 @@ -25,21 +25,10 @@ #include "precompiled.hpp" #include "oops/oop.inline.hpp" #include "runtime/os.hpp" +#include "runtime/thread.inline.hpp" #include "utilities/debug.hpp" #include "utilities/stack.inline.hpp" #include "utilities/taskqueue.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif #ifdef TRACESPINNING uint ParallelTaskTerminator::_total_yields = 0; diff -r 11084bacb67d -r 21a10694fc13 hotspot/src/share/vm/utilities/workgroup.hpp --- a/hotspot/src/share/vm/utilities/workgroup.hpp Thu Nov 29 11:30:24 2012 -0800 +++ b/hotspot/src/share/vm/utilities/workgroup.hpp Wed Jul 05 18:31:15 2017 +0200 @@ -25,19 +25,8 @@ #ifndef SHARE_VM_UTILITIES_WORKGROUP_HPP #define SHARE_VM_UTILITIES_WORKGROUP_HPP +#include "runtime/thread.inline.hpp" #include "utilities/taskqueue.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "thread_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "thread_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "thread_bsd.inline.hpp" -#endif // Task class hierarchy: // AbstractGangTask diff -r 11084bacb67d -r 21a10694fc13 hotspot/test/runtime/8003720/Asmator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/8003720/Asmator.java Wed Jul 05 18:31:15 2017 +0200 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +import jdk.internal.org.objectweb.asm.*; + +class Asmator { + static byte[] fixup(byte[] buf) throws java.io.IOException { + ClassReader cr = new ClassReader(buf); + ClassWriter cw = new ClassWriter(0); + ClassVisitor cv = new ClassVisitor(Opcodes.ASM4, cw) { + public MethodVisitor visitMethod( + final int access, + final String name, + final String desc, + final String signature, + final String[] exceptions) + { + MethodVisitor mv = super.visitMethod(access, + name, + desc, + signature, + exceptions); + if (mv == null) return null; + if (name.equals("callme")) { + // make receiver go dead! + mv.visitInsn(Opcodes.ACONST_NULL); + mv.visitVarInsn(Opcodes.ASTORE, 0); + } + return mv; + } + }; + cr.accept(cv, 0); + return cw.toByteArray(); + } +} diff -r 11084bacb67d -r 21a10694fc13 hotspot/test/runtime/8003720/Test8003720.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/8003720/Test8003720.java Wed Jul 05 18:31:15 2017 +0200 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2012, 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 8003720 + * @summary Method in interpreter stack frame can be deallocated + * @compile -XDignore.symbol.file -source 1.7 -target 1.7 Victim.java + * @run main/othervm -Xverify:all -Xint Test8003720 + */ + +// Attempts to make the JVM unload a class while still executing one of its methods. +public class Test8003720 { + final static String VICTIM_CLASS_NAME = "Victim"; + final static boolean QUIET = true; + final static long DURATION = 30000; + + public interface CallMe { void callme(); } + + public static void main(String... av) throws Throwable { + newVictimClassLoader(); + System.gc(); + + newVictimClass(); + System.gc(); + + newVictimInstance(); + System.gc(); + + ((CallMe)newVictimInstance()).callme(); + } + + public static Object newVictimInstance() throws Throwable { + return newVictimClass().newInstance(); + } + + public static Class newVictimClass() throws Throwable { + return Class.forName(VICTIM_CLASS_NAME, true, new VictimClassLoader()); + } + + public static ClassLoader newVictimClassLoader() throws Throwable { + return new VictimClassLoader(); + } + + public static void println(String line) { + if (!QUIET) { + System.out.println(line); + } + } +} diff -r 11084bacb67d -r 21a10694fc13 hotspot/test/runtime/8003720/Victim.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/8003720/Victim.java Wed Jul 05 18:31:15 2017 +0200 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2012, 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. + * + */ + +public class Victim implements Test8003720.CallMe { + public void callme() { + // note: Victim.this is dead here + Test8003720.println("executing in loader=" + Victim.class.getClassLoader()); + + long now = System.currentTimeMillis(); + + while ((System.currentTimeMillis() - now) < Test8003720.DURATION) { + long count = VictimClassLoader.counter++; + if (count % 1000000 == 0) System.gc(); + if (count % 16180000 == 0) blurb(); + new Object[1].clone(); + } + } + static void blurb() { + Test8003720.println("count=" + VictimClassLoader.counter); + } + static { + blather(); + } + static void blather() { + new java.util.ArrayList(1000000); + Class c = Victim.class; + Test8003720.println("initializing " + c + "#" + System.identityHashCode(c) + " in " + c.getClassLoader()); + } +} diff -r 11084bacb67d -r 21a10694fc13 hotspot/test/runtime/8003720/VictimClassLoader.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/8003720/VictimClassLoader.java Wed Jul 05 18:31:15 2017 +0200 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2012, 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. + * + */ + +public class VictimClassLoader extends ClassLoader { + public static long counter = 0; + + private int which = (int) ++counter; + + protected VictimClassLoader() { + super(VictimClassLoader.class.getClassLoader()); + } + + protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + Class c; + if (!name.endsWith("Victim")) { + c = super.loadClass(name, resolve); + return c; + } + + c = findLoadedClass(name); + if (c != null) { + return c; + } + + byte[] buf = readClassFile(name); + c = defineClass(name, buf, 0, buf.length); + resolveClass(c); + + if (c.getClassLoader() != this) { + throw new AssertionError(); + } + + Test8003720.println("loaded " + c + "#" + System.identityHashCode(c) + " in " + c.getClassLoader()); + return c; + } + + static byte[] readClassFile(String name) { + try { + String rname = name.substring(name.lastIndexOf('.') + 1) + ".class"; + java.net.URL url = VictimClassLoader.class.getResource(rname); + Test8003720.println("found " + rname + " = " + url); + + java.net.URLConnection connection = url.openConnection(); + int contentLength = connection.getContentLength(); + byte[] buf = readFully(connection.getInputStream(), contentLength); + + return Asmator.fixup(buf); + } catch (java.io.IOException ex) { + throw new Error(ex); + } + } + + static byte[] readFully(java.io.InputStream in, int len) throws java.io.IOException { + // Warning here: + return sun.misc.IOUtils.readFully(in, len, true); + } + + public void finalize() { + Test8003720.println("Goodbye from " + this); + } + + public String toString() { + return "VictimClassLoader#" + which; + } +} diff -r 11084bacb67d -r 21a10694fc13 jdk/.hgtags --- a/jdk/.hgtags Thu Nov 29 11:30:24 2012 -0800 +++ b/jdk/.hgtags Wed Jul 05 18:31:15 2017 +0200 @@ -187,3 +187,4 @@ f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63 26dbd73fb7662a29b3e47179fdc88a0bfa4e231e jdk8-b64 130d3a54d28becaac0846137256c2684adb34c33 jdk8-b65 +4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66 diff -r 11084bacb67d -r 21a10694fc13 jdk/makefiles/CompileDemos.gmk --- a/jdk/makefiles/CompileDemos.gmk Thu Nov 29 11:30:24 2012 -0800 +++ b/jdk/makefiles/CompileDemos.gmk Wed Jul 05 18:31:15 2017 +0200 @@ -194,15 +194,6 @@ ################################################################################################## -# Why do we install a demo jar into the main jre/lib/ext???????????????? -$(JDK_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar - $(MKDIR) -p $(@D) - $(CP) $< $@ - -BUILD_DEMOS += $(JDK_OUTPUTDIR)/lib/ext/zipfs.jar - -################################################################################################## - # In the old makefiles, j2dbench was not compiled. #$(eval $(call SetupDemo,J2DBench,java2d,/src,,j2dbench/J2DBench)) diff -r 11084bacb67d -r 21a10694fc13 jdk/makefiles/CompileJavaClasses.gmk --- a/jdk/makefiles/CompileJavaClasses.gmk Thu Nov 29 11:30:24 2012 -0800 +++ b/jdk/makefiles/CompileJavaClasses.gmk Wed Jul 05 18:31:15 2017 +0200 @@ -338,29 +338,14 @@ ########################################################################################## -# -# This is an empty jar (only contains manifest) and fits poorly into framework... -# create simple rule instead -# -MANAGEMENT_AGENT_JAR_DEPS := $(JDK_TOPDIR)/src/share/classes/sun/management/manifest - -$(JDK_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest - $(JAR) cfm $@ $(JDK_TOPDIR)/src/share/classes/sun/management/manifest - -JARS += $(JDK_OUTPUTDIR)/lib/management-agent.jar - -########################################################################################## - ifndef OPENJDK -$(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES_JAR,\ + $(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES,\ SETUP:=GENERATE_JDKBYTECODE,\ SRC:=$(JDK_TOPDIR)/src/closed/share/altclasses, \ - BIN:=$(JDK_OUTPUTDIR)/altclasses_classes,\ - JAR:=$(JDK_OUTPUTDIR)/lib/alt-rt.jar)) + BIN:=$(JDK_OUTPUTDIR)/altclasses_classes)) -$(BUILD_ALTCLASSES_JAR): $(BUILD_JDK) -JARS += $(JDK_OUTPUTDIR)/lib/alt-rt.jar + $(BUILD_ALTCLASSES): $(BUILD_JDK) endif @@ -383,7 +368,7 @@ SERVER_DIR:=$(SJAVAC_SERVER_DIR),\ SERVER_JVM:=$(SJAVAC_SERVER_JAVA))) -$(eval $(call SetupJavaCompilation,BUILD_JOBJC_JAR,\ +$(eval $(call SetupJavaCompilation,BUILD_JOBJC,\ SETUP:=GENERATE_15BYTECODE,\ DISABLE_SJAVAC:=true,\ SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \ @@ -395,11 +380,9 @@ JAR:=$(JDK_OUTPUTDIR)/lib/JObjC.jar, \ JARINDEX := true)) -$(BUILD_JOBJC_JAR) : $(BUILD_JDK) +$(BUILD_JOBJC) : $(BUILD_JDK) -JARS += $(JDK_OUTPUTDIR)/lib/JObjC.jar - -$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS_JAR,\ +$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS,\ SETUP:=GENERATE_JDKBYTECODE,\ SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \ $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \ @@ -409,16 +392,15 @@ BIN:=$(JDK_OUTPUTDIR)/jobjc_classes_headers,\ HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers_jobjc)) -$(BUILD_JOBJC_HEADERS_JAR) : $(BUILD_JDK) - -JARS += $(BUILD_JOBJC_HEADERS_JAR) +$(BUILD_JOBJC_HEADERS) : $(BUILD_JDK) endif ########################################################################################## # copy with -a to preserve timestamps so dependencies down the line aren't messed up -all: $(BUILD_JDK) $(JARS) $(COPY_EXTRA) $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \ +all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \ + $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \ $(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers .PHONY: all diff -r 11084bacb67d -r 21a10694fc13 jdk/makefiles/CreateJars.gmk --- a/jdk/makefiles/CreateJars.gmk Thu Nov 29 11:30:24 2012 -0800 +++ b/jdk/makefiles/CreateJars.gmk Wed Jul 05 18:31:15 2017 +0200 @@ -446,9 +446,7 @@ $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) else @@ -476,9 +474,7 @@ $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) else @@ -518,9 +514,8 @@ $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) + else $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR,,\ @@ -545,9 +540,7 @@ $(JCE_JAR_DST) : $(JCE_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) else @@ -567,75 +560,85 @@ ########################################################################################## -ifdef OPENJDK +US_EXPORT_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/US_export_policy.jar + +ifndef OPENJDK + + + $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar + $(ECHO) $(LOG_INFO) Copying $(@F) + $(install-file) + +else -# -# TODO fix so that SetupArchive does not write files into SRCS -# then we don't need this extra copying -# -# NOTE: We currently do not place restrictions on our limited export -# policy. This was not a typo. -# -US_EXPORT_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/US_export_policy.jar -US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited -US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp + # + # TODO fix so that SetupArchive does not write files into SRCS + # then we don't need this extra copying + # + # NOTE: We currently do not place restrictions on our limited export + # policy. This was not a typo. + # + US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited + US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp -$(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/% - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/% + $(install-file) -US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy + US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy -$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\ + $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\ SRCS:=$(US_EXPORT_POLICY_JAR_TMP), \ SUFFIXES:= .policy,\ JAR:=$(US_EXPORT_POLICY_JAR_DST), \ EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \ SKIP_METAINF := true)) -JARS += $(US_EXPORT_POLICY_JAR_DST) +endif -endif +JARS += $(US_EXPORT_POLICY_JAR_DST) ########################################################################################## +LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar -ifdef OPENJDK +ifndef OPENJDK + + $(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar + $(ECHO) $(LOG_INFO) Copying $(@F) + $(install-file) -# -# TODO fix so that SetupArchive does not write files into SRCS -# then we don't need this extra copying -# -LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar -LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp +else + + # + # TODO fix so that SetupArchive does not write files into SRCS + # then we don't need this extra copying + # + LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp -ifeq ($(UNLIMITED_CRYPTO), true) - LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited - LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy - LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited -else - LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited - LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \ - $(LOCAL_POLICY_JAR_TMP)/default_local.policy - LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited -endif + ifeq ($(UNLIMITED_CRYPTO), true) + LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited + LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy + LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited + else + LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited + LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \ + $(LOCAL_POLICY_JAR_TMP)/default_local.policy + LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited + endif -$(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/% - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/% + $(install-file) -$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\ + $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\ SRCS:=$(LOCAL_POLICY_JAR_TMP),\ SUFFIXES:= .policy,\ JAR:=$(LOCAL_POLICY_JAR_DST), \ EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \ SKIP_METAINF := true)) -JARS += $(LOCAL_POLICY_JAR_DST) +endif -endif +JARS += $(LOCAL_POLICY_JAR_DST) ########################################################################################## @@ -648,9 +651,7 @@ $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) else @@ -676,9 +677,7 @@ $(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) JARS += $(UCRYPTO_JAR_DST) @@ -897,14 +896,10 @@ $(LAUNCHER_SRC_FILES))) $(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/share/bin/% - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) $(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/% - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) $(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC) @@ -922,6 +917,55 @@ ########################################################################################## +# +# This is an empty jar (only contains manifest) and fits poorly into framework... +# create simple rule instead +# +$(IMAGES_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest + $(JAR) cfm $@ $< + +JARS += $(IMAGES_OUTPUTDIR)/lib/management-agent.jar + +########################################################################################## + +$(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar + $(install-file) + +JARS += $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar + +########################################################################################## + +ifeq ($(OPENJDK_TARGET_OS),macosx) + $(eval $(call SetupArchive,BUILD_JOBJC_JAR,,\ + SRCS:=$(JDK_OUTPUTDIR)/jobjc_classes,\ + JAR:=$(IMAGES_OUTPUTDIR)/lib/JObjC.jar, \ + JARINDEX:=true)) + + JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar +endif + +########################################################################################## + +ifndef OPENJDK + $(eval $(call SetupArchive,BUILD_ALT_RT_JAR,,\ + SRCS:=$(JDK_OUTPUTDIR)/altclasses_classes,\ + JAR:=$(IMAGES_OUTPUTDIR)/lib/alt-rt.jar)) + + JARS += $(IMAGES_OUTPUTDIR)/lib/alt-rt.jar +endif + +########################################################################################## + +# This file is imported from hotspot in Import.gmk. Copying it into images/lib so that +# all jars can be found in one place when creating images in Images.gmk. It needs to be +# done here so that clean targets can be simple and accurate. +$(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar: $(JDK_OUTPUTDIR)/lib/sa-jdi.jar + $(install-file) + +JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar + +########################################################################################## + -include $(CUSTOM_MAKE_DIR)/CreateJars.gmk ########################################################################################## diff -r 11084bacb67d -r 21a10694fc13 jdk/makefiles/Images.gmk --- a/jdk/makefiles/Images.gmk Thu Nov 29 11:30:24 2012 -0800 +++ b/jdk/makefiles/Images.gmk Wed Jul 05 18:31:15 2017 +0200 @@ -211,10 +211,11 @@ endif # Find all files to copy from $(JDK_OUTPUTDIR)/lib +# Jar files are not expected to be here ALL_JDKOUT_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \ - \( -name "_the*" -o -name "javac_state " \) ) + \( -name "_the*" -o -name "javac_state " -o -name "*.jar" \) ) # Find all files to copy from $(IMAGES_OUTPUTDIR)/lib -# This might not exist if building overlay-images +# This is were the jar files are and might not exist if building overlay-images ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),) ALL_IMAGES_LIB_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \ \( -name "_the*" -o -name "javac_state " \) ) diff -r 11084bacb67d -r 21a10694fc13 jdk/makefiles/Import.gmk --- a/jdk/makefiles/Import.gmk Thu Nov 29 11:30:24 2012 -0800 +++ b/jdk/makefiles/Import.gmk Wed Jul 05 18:31:15 2017 +0200 @@ -231,22 +231,6 @@ endef endif -ifndef OPENJDK - -IMPORT_TARGET_FILES += \ - $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar \ - $(JDK_OUTPUTDIR)/lib/security/local_policy.jar - -$(JDK_OUTPUTDIR)/lib/security/local_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar - $(ECHO) $(LOG_INFO) Copying $(@F) - $(install-file) - -$(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar - $(ECHO) $(LOG_INFO) Copying $(@F) - $(install-file) - -endif # OPENJDK - ####### all: $(IMPORT_TARGET_FILES) diff -r 11084bacb67d -r 21a10694fc13 jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java --- a/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java Thu Nov 29 11:30:24 2012 -0800 +++ b/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java Wed Jul 05 18:31:15 2017 +0200 @@ -25,7 +25,7 @@ package java.lang.invoke; -import static com.sun.xml.internal.ws.org.objectweb.asm.Opcodes.*; +import static jdk.internal.org.objectweb.asm.Opcodes.*; import static java.lang.invoke.LambdaForm.basicTypes; import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic; import static java.lang.invoke.MethodHandleStatics.*; @@ -40,9 +40,9 @@ import sun.invoke.util.ValueConversions; import sun.invoke.util.Wrapper; -import com.sun.xml.internal.ws.org.objectweb.asm.ClassWriter; -import com.sun.xml.internal.ws.org.objectweb.asm.MethodVisitor; -import com.sun.xml.internal.ws.org.objectweb.asm.Type; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.Type; /** * The flavor of method handle which emulates an invoke instruction diff -r 11084bacb67d -r 21a10694fc13 jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java --- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Thu Nov 29 11:30:24 2012 -0800 +++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Wed Jul 05 18:31:15 2017 +0200 @@ -34,7 +34,7 @@ import java.io.*; import java.util.*; -import com.sun.xml.internal.ws.org.objectweb.asm.*; +import jdk.internal.org.objectweb.asm.*; import java.lang.reflect.*; import static java.lang.invoke.MethodHandleStatics.*;