OpenJDK / jdk / hs
changeset 44928:1a0cba08a6cb
Merge
author | duke |
---|---|
date | Wed, 05 Jul 2017 23:21:33 +0200 |
parents | d554736d963e 05cc1320075a |
children | ca6e2248ebbc |
files | |
diffstat | 169 files changed, 2963 insertions(+), 2545 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags-top-repo Mon May 08 14:04:27 2017 +0100 +++ b/.hgtags-top-repo Wed Jul 05 23:21:33 2017 +0200 @@ -400,6 +400,7 @@ 8d26916eaa21b689835ffc1c0dbf12470aa9be61 jdk-9+154 688a3863c00ebc089ab17ee1fc46272cbbd96815 jdk-9+155 783ec7542cf7154e5d2b87f55bb97d28f81e9ada jdk-9+156 +4df5f619c9ead4604d2f97ed231b3a35ec688c41 jdk-10+1 4eb77fb98952dc477a4229575c81d2263a9ce711 jdk-9+157 a4087bc10a88a43ea3ad0919b5b4af1c86977221 jdk-9+158 fe8466adaef8178dba94be53c789a0aaa87d13bb jdk-9+159 @@ -410,3 +411,10 @@ 7810f75d016a52e32295c4233009de5ca90e31af jdk-9+164 aff4f339acd40942d3dab499846b52acd87b3af1 jdk-9+165 ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166 +35017c286513ddcbcc6b63b99679c604993fc639 jdk-9+167 +143d4c87bc1ef1ed6dadd613cd9dd4488fdefc29 jdk-9+168 +9c7248b787c39b034d4f48d4aa48df903836cca7 jdk-10+2 +06373236a30801f72e2a31ee5c691c2a1e500f57 jdk-10+3 +8ec175c61fc3f58328a3324f07d7ded00e060be3 jdk-10+4 +111e2e7d00f45c983cdbc9c59ae40552152fcc23 jdk-10+5 +03fe61bb7670644cf6e46b5cfafb6b27c0e0157e jdk-10+6 \ No newline at end of file
--- a/common/autoconf/basics.m4 Mon May 08 14:04:27 2017 +0100 +++ b/common/autoconf/basics.m4 Wed Jul 05 23:21:33 2017 +0200 @@ -1095,6 +1095,7 @@ OTOOL="true" fi BASIC_PATH_PROGS(READELF, [greadelf readelf]) + BASIC_PATH_PROGS(DOT, dot) BASIC_PATH_PROGS(HG, hg) BASIC_PATH_PROGS(STAT, stat) BASIC_PATH_PROGS(TIME, time)
--- a/common/autoconf/generated-configure.sh Mon May 08 14:04:27 2017 +0100 +++ b/common/autoconf/generated-configure.sh Wed Jul 05 23:21:33 2017 +0200 @@ -918,6 +918,7 @@ INCLUDE_SA UNLIMITED_CRYPTO CACERTS_FILE +ENABLE_FULL_DOCS ENABLE_HEADLESS_ONLY DEFAULT_MAKE_TARGET OS_VERSION_MICRO @@ -936,6 +937,7 @@ TIME STAT HG +DOT READELF OTOOL LDD @@ -994,9 +996,8 @@ OPENJDK_TARGET_CPU_ISADIR OPENJDK_TARGET_CPU_LEGACY_LIB OPENJDK_TARGET_CPU_LEGACY -REQUIRED_OS_VERSION -REQUIRED_OS_ARCH -REQUIRED_OS_NAME +OPENJDK_MODULE_TARGET_OS_ARCH +OPENJDK_MODULE_TARGET_OS_NAME COMPILE_TYPE OPENJDK_TARGET_CPU_ENDIAN OPENJDK_TARGET_CPU_BITS @@ -1139,6 +1140,7 @@ with_output_sync with_default_make_target enable_headless_only +enable_full_docs with_cacerts_file enable_unlimited_crypto with_copyright_year @@ -1291,6 +1293,7 @@ LDD OTOOL READELF +DOT HG STAT TIME @@ -1972,6 +1975,8 @@ --enable-debug set the debug level to fastdebug (shorthand for --with-debug-level=fastdebug) [disabled] --enable-headless-only only build headless (no GUI) support [disabled] + --enable-full-docs build complete documentation [enabled if all tools + found] --disable-unlimited-crypto Disable unlimited crypto policy [enabled] --disable-keep-packaged-modules @@ -2256,6 +2261,7 @@ LDD Override default value for LDD OTOOL Override default value for OTOOL READELF Override default value for READELF + DOT Override default value for DOT HG Override default value for HG STAT Override default value for STAT TIME Override default value for TIME @@ -5177,7 +5183,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1490900744 +DATE_WHEN_GENERATED=1492975963 ############################################################################### # @@ -16025,32 +16031,17 @@ $as_echo "$COMPILE_TYPE" >&6; } - if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then - REQUIRED_OS_NAME=SunOS - REQUIRED_OS_VERSION=5.10 - fi - if test "x$OPENJDK_TARGET_OS" = "xlinux"; then - REQUIRED_OS_NAME=Linux - REQUIRED_OS_VERSION=2.6 - fi - if test "x$OPENJDK_TARGET_OS" = "xwindows"; then - REQUIRED_OS_NAME=Windows - if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then - REQUIRED_OS_VERSION=5.2 - else - REQUIRED_OS_VERSION=5.1 - fi - fi - if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then - REQUIRED_OS_NAME="Mac OS X" - REQUIRED_OS_VERSION=11.2 - fi - if test "x$OPENJDK_TARGET_OS" = "xaix"; then - REQUIRED_OS_NAME=AIX - REQUIRED_OS_VERSION=7.1 - fi - REQUIRED_OS_ARCH=${OPENJDK_TARGET_CPU} - + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + OPENJDK_MODULE_TARGET_OS_NAME="macos" + else + OPENJDK_MODULE_TARGET_OS_NAME="$OPENJDK_TARGET_OS" + fi + + if test "x$OPENJDK_TARGET_CPU" = xx86_64; then + OPENJDK_MODULE_TARGET_OS_ARCH="amd64" + else + OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU" + fi @@ -22476,6 +22467,203 @@ # Publish this variable in the help. + if [ -z "${DOT+x}" ]; then + # The variable is not set by user, try to locate tool using the code snippet + for ac_prog in dot +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DOT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DOT in + [\\/]* | ?:[\\/]*) + ac_cv_path_DOT="$DOT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DOT=$ac_cv_path_DOT +if test -n "$DOT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5 +$as_echo "$DOT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DOT" && break +done + + else + # The variable is set, but is it from the command line or the environment? + + # Try to remove the string !DOT! from our list. + try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!DOT!/} + if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then + # If it failed, the variable was not from the command line. Ignore it, + # but warn the user (except for BASH, which is always set by the calling BASH). + if test "xDOT" != xBASH; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of DOT from the environment. Use command line variables instead." >&5 +$as_echo "$as_me: WARNING: Ignoring value of DOT from the environment. Use command line variables instead." >&2;} + fi + # Try to locate tool using the code snippet + for ac_prog in dot +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DOT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DOT in + [\\/]* | ?:[\\/]*) + ac_cv_path_DOT="$DOT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DOT=$ac_cv_path_DOT +if test -n "$DOT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5 +$as_echo "$DOT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DOT" && break +done + + else + # If it succeeded, then it was overridden by the user. We will use it + # for the tool. + + # First remove it from the list of overridden variables, so we can test + # for unknown variables in the end. + CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var" + + # Check if we try to supply an empty value + if test "x$DOT" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool DOT= (no value)" >&5 +$as_echo "$as_me: Setting user supplied tool DOT= (no value)" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DOT" >&5 +$as_echo_n "checking for DOT... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } + else + # Check if the provided tool contains a complete path. + tool_specified="$DOT" + tool_basename="${tool_specified##*/}" + if test "x$tool_basename" = "x$tool_specified"; then + # A command without a complete path is provided, search $PATH. + { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool DOT=$tool_basename" >&5 +$as_echo "$as_me: Will search for user supplied tool DOT=$tool_basename" >&6;} + # Extract the first word of "$tool_basename", so it can be a program name with args. +set dummy $tool_basename; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DOT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DOT in + [\\/]* | ?:[\\/]*) + ac_cv_path_DOT="$DOT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DOT=$ac_cv_path_DOT +if test -n "$DOT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5 +$as_echo "$DOT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$DOT" = x; then + as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5 + fi + else + # Otherwise we believe it is a complete path. Use it as it is. + { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool DOT=$tool_specified" >&5 +$as_echo "$as_me: Will use user supplied tool DOT=$tool_specified" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DOT" >&5 +$as_echo_n "checking for DOT... " >&6; } + if test ! -x "$tool_specified"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } + as_fn_error $? "User supplied tool DOT=$tool_specified does not exist or is not executable" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5 +$as_echo "$tool_specified" >&6; } + fi + fi + fi + + fi + + + + + # Publish this variable in the help. + + if [ -z "${HG+x}" ]; then # The variable is not set by user, try to locate tool using the code snippet for ac_prog in hg @@ -24723,6 +24911,101 @@ + # Should we build the complete docs, or just a lightweight version? + # Check whether --enable-full-docs was given. +if test "${enable_full_docs+set}" = set; then : + enableval=$enable_full_docs; +fi + + + # Verify dependencies + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for graphviz dot" >&5 +$as_echo_n "checking for graphviz dot... " >&6; } + if test "x$DOT" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, cannot generate full docs" >&5 +$as_echo "no, cannot generate full docs" >&6; } + FULL_DOCS_DEP_MISSING=true + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pandoc" >&5 +$as_echo_n "checking for pandoc... " >&6; } + if test "x$PANDOC" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, cannot generate full docs" >&5 +$as_echo "no, cannot generate full docs" >&6; } + FULL_DOCS_DEP_MISSING=true + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking full docs" >&5 +$as_echo_n "checking full docs... " >&6; } + if test "x$enable_full_docs" = xyes; then + if test "x$FULL_DOCS_DEP_MISSING" = "xtrue"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, missing dependencies" >&5 +$as_echo "no, missing dependencies" >&6; } + + # Print a helpful message on how to acquire the necessary build dependency. + # dot is the help tag: freetype, cups, alsa etc + MISSING_DEPENDENCY=dot + + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + cygwin_help $MISSING_DEPENDENCY + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + msys_help $MISSING_DEPENDENCY + else + PKGHANDLER_COMMAND= + + case $PKGHANDLER in + apt-get) + apt_help $MISSING_DEPENDENCY ;; + yum) + yum_help $MISSING_DEPENDENCY ;; + brew) + brew_help $MISSING_DEPENDENCY ;; + port) + port_help $MISSING_DEPENDENCY ;; + pkgutil) + pkgutil_help $MISSING_DEPENDENCY ;; + pkgadd) + pkgadd_help $MISSING_DEPENDENCY ;; + esac + + if test "x$PKGHANDLER_COMMAND" != x; then + HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'." + fi + fi + + as_fn_error $? "Cannot enable full docs with missing dependencies. See above. $HELP_MSG" "$LINENO" 5 + else + ENABLE_FULL_DOCS=true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, forced" >&5 +$as_echo "yes, forced" >&6; } + fi + elif test "x$enable_full_docs" = xno; then + ENABLE_FULL_DOCS=false + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, forced" >&5 +$as_echo "no, forced" >&6; } + elif test "x$enable_full_docs" = x; then + # Check for prerequisites + if test "x$FULL_DOCS_DEP_MISSING" = xtrue; then + ENABLE_FULL_DOCS=false + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, missing dependencies" >&5 +$as_echo "no, missing dependencies" >&6; } + else + ENABLE_FULL_DOCS=true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, dependencies present" >&5 +$as_echo "yes, dependencies present" >&6; } + fi + else + as_fn_error $? "--enable-full-docs can only take yes or no" "$LINENO" 5 + fi + + + # Choose cacerts source file # Check whether --with-cacerts-file was given.
--- a/common/autoconf/jdk-options.m4 Mon May 08 14:04:27 2017 +0100 +++ b/common/autoconf/jdk-options.m4 Wed Jul 05 23:21:33 2017 +0200 @@ -154,6 +154,55 @@ AC_SUBST(ENABLE_HEADLESS_ONLY) + # Should we build the complete docs, or just a lightweight version? + AC_ARG_ENABLE([full-docs], [AS_HELP_STRING([--enable-full-docs], + [build complete documentation @<:@enabled if all tools found@:>@])]) + + # Verify dependencies + AC_MSG_CHECKING([for graphviz dot]) + if test "x$DOT" != "x"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, cannot generate full docs]) + FULL_DOCS_DEP_MISSING=true + fi + + AC_MSG_CHECKING([for pandoc]) + if test "x$PANDOC" != "x"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, cannot generate full docs]) + FULL_DOCS_DEP_MISSING=true + fi + + AC_MSG_CHECKING([full docs]) + if test "x$enable_full_docs" = xyes; then + if test "x$FULL_DOCS_DEP_MISSING" = "xtrue"; then + AC_MSG_RESULT([no, missing dependencies]) + HELP_MSG_MISSING_DEPENDENCY([dot]) + AC_MSG_ERROR([Cannot enable full docs with missing dependencies. See above. $HELP_MSG]) + else + ENABLE_FULL_DOCS=true + AC_MSG_RESULT([yes, forced]) + fi + elif test "x$enable_full_docs" = xno; then + ENABLE_FULL_DOCS=false + AC_MSG_RESULT([no, forced]) + elif test "x$enable_full_docs" = x; then + # Check for prerequisites + if test "x$FULL_DOCS_DEP_MISSING" = xtrue; then + ENABLE_FULL_DOCS=false + AC_MSG_RESULT([no, missing dependencies]) + else + ENABLE_FULL_DOCS=true + AC_MSG_RESULT([yes, dependencies present]) + fi + else + AC_MSG_ERROR([--enable-full-docs can only take yes or no]) + fi + + AC_SUBST(ENABLE_FULL_DOCS) + # Choose cacerts source file AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file], [specify alternative cacerts file])])
--- a/common/autoconf/platform.m4 Mon May 08 14:04:27 2017 +0100 +++ b/common/autoconf/platform.m4 Wed Jul 05 23:21:33 2017 +0200 @@ -433,37 +433,22 @@ ]) -AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], +AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES], [ - if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then - REQUIRED_OS_NAME=SunOS - REQUIRED_OS_VERSION=5.10 - fi - if test "x$OPENJDK_TARGET_OS" = "xlinux"; then - REQUIRED_OS_NAME=Linux - REQUIRED_OS_VERSION=2.6 + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + OPENJDK_MODULE_TARGET_OS_NAME="macos" + else + OPENJDK_MODULE_TARGET_OS_NAME="$OPENJDK_TARGET_OS" fi - if test "x$OPENJDK_TARGET_OS" = "xwindows"; then - REQUIRED_OS_NAME=Windows - if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then - REQUIRED_OS_VERSION=5.2 - else - REQUIRED_OS_VERSION=5.1 - fi + + if test "x$OPENJDK_TARGET_CPU" = xx86_64; then + OPENJDK_MODULE_TARGET_OS_ARCH="amd64" + else + OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU" fi - if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then - REQUIRED_OS_NAME="Mac OS X" - REQUIRED_OS_VERSION=11.2 - fi - if test "x$OPENJDK_TARGET_OS" = "xaix"; then - REQUIRED_OS_NAME=AIX - REQUIRED_OS_VERSION=7.1 - fi - REQUIRED_OS_ARCH=${OPENJDK_TARGET_CPU} - AC_SUBST(REQUIRED_OS_NAME) - AC_SUBST(REQUIRED_OS_ARCH) - AC_SUBST(REQUIRED_OS_VERSION) + AC_SUBST(OPENJDK_MODULE_TARGET_OS_NAME) + AC_SUBST(OPENJDK_MODULE_TARGET_OS_ARCH) ]) #%%% Build and target systems %%% @@ -480,7 +465,7 @@ PLATFORM_EXTRACT_TARGET_AND_BUILD PLATFORM_SETUP_TARGET_CPU_BITS - PLATFORM_SET_RELEASE_FILE_OS_VALUES + PLATFORM_SET_MODULE_TARGET_OS_VALUES PLATFORM_SETUP_LEGACY_VARS ])
--- a/common/autoconf/spec.gmk.in Mon May 08 14:04:27 2017 +0100 +++ b/common/autoconf/spec.gmk.in Wed Jul 05 23:21:33 2017 +0200 @@ -101,10 +101,9 @@ OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@ OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@ -# OS values for use in release file. -REQUIRED_OS_NAME:=@REQUIRED_OS_NAME@ -REQUIRED_OS_ARCH:=@REQUIRED_OS_ARCH@ -REQUIRED_OS_VERSION:=@REQUIRED_OS_VERSION@ +# OS values for use in ModuleTarget class file attribute. +OPENJDK_MODULE_TARGET_OS_NAME:=@OPENJDK_MODULE_TARGET_OS_NAME@ +OPENJDK_MODULE_TARGET_OS_ARCH:=@OPENJDK_MODULE_TARGET_OS_ARCH@ LIBM:=@LIBM@ LIBDL:=@LIBDL@ @@ -245,6 +244,8 @@ # Only build headless support or not ENABLE_HEADLESS_ONLY := @ENABLE_HEADLESS_ONLY@ +ENABLE_FULL_DOCS := @ENABLE_FULL_DOCS@ + # JDK_OUTPUTDIR specifies where a working jvm is built. # You can run $(JDK_OUTPUTDIR)/bin/java # Though the layout of the contents of $(JDK_OUTPUTDIR) is not @@ -679,6 +680,7 @@ READELF:=@READELF@ EXPR:=@EXPR@ FILE:=@FILE@ +DOT:=@DOT@ HG:=@HG@ OBJCOPY:=@OBJCOPY@ SETFILE:=@SETFILE@ @@ -842,11 +844,6 @@ jre-$(VERSION_SHORT)+$(VERSION_BUILD)-compact3_$(OPENJDK_TARGET_BUNDLE_PLATFORM)_bin$(DEBUG_PART).tar.gz JDK_SYMBOLS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz JRE_SYMBOLS_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz -ifeq ($(OPENJDK_TARGET_OS), windows) - DEMOS_BUNDLE_NAME := jdk-$(BASE_NAME)_demo$(DEBUG_PART).zip -else - DEMOS_BUNDLE_NAME := jdk-$(BASE_NAME)_demo$(DEBUG_PART).tar.gz -endif TEST_BUNDLE_NAME := jdk-$(BASE_NAME)_bin-tests$(DEBUG_PART).tar.gz DOCS_BUNDLE_NAME := jdk-$(BASE_NAME)_doc-api-spec$(DEBUG_PART).tar.gz @@ -854,7 +851,6 @@ JRE_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JRE_BUNDLE_NAME) JDK_SYMBOLS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JDK_SYMBOLS_BUNDLE_NAME) JRE_SYMBOLS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JRE_SYMBOLS_BUNDLE_NAME) -DEMOS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(DEMOS_BUNDLE_NAME) TEST_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(TEST_BUNDLE_NAME) DOCS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(DOCS_BUNDLE_NAME)
--- a/common/bin/compare_exceptions.sh.incl Mon May 08 14:04:27 2017 +0100 +++ b/common/bin/compare_exceptions.sh.incl Wed Jul 05 23:21:33 2017 +0200 @@ -38,25 +38,9 @@ if [ "$OPENJDK_TARGET_OS" = "linux" ]; then STRIP_BEFORE_COMPARE=" - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so " ACCEPTED_BIN_DIFF=" - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so ./lib/client/libjsig.so ./lib/client/libjvm.so ./lib/libattach.so @@ -151,15 +135,6 @@ if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then STRIP_BEFORE_COMPARE=" - ./demo/jni/Poller/lib/libPoller.so - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so " SORT_SYMBOLS=" @@ -174,15 +149,6 @@ SKIP_BIN_DIFF="true" ACCEPTED_SMALL_SIZE_DIFF=" - ./demo/jni/Poller/lib/libPoller.so - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so ./lib/jli/libjli.so ./lib/jspawnhelper ./lib/libJdbcOdbc.so @@ -279,19 +245,9 @@ if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "sparcv9" ]; then STRIP_BEFORE_COMPARE=" - ./demo/jni/Poller/lib/libPoller.so - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so " SORT_SYMBOLS=" - ./demo/jvmti/waiters/lib/libwaiters.so ./lib/libjsig.so ./lib/libfontmanager.so ./lib/libjimage.so @@ -305,15 +261,6 @@ SKIP_BIN_DIFF="true" ACCEPTED_SMALL_SIZE_DIFF=" - ./demo/jni/Poller/lib/libPoller.so - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so - ./demo/jvmti/gctest/lib/libgctest.so - ./demo/jvmti/heapTracker/lib/libheapTracker.so - ./demo/jvmti/heapViewer/lib/libheapViewer.so - ./demo/jvmti/minst/lib/libminst.so - ./demo/jvmti/mtrace/lib/libmtrace.so - ./demo/jvmti/versionCheck/lib/libversionCheck.so - ./demo/jvmti/waiters/lib/libwaiters.so ./lib/client/libjvm.so ./lib/jli/libjli.so ./lib/jspawnhelper @@ -438,9 +385,6 @@ # Probably should add all libs here ACCEPTED_SMALL_SIZE_DIFF=" - ./demo/jvmti/gctest/lib/gctest.dll - ./demo/jvmti/heapTracker/lib/heapTracker.dll - ./demo/jvmti/minst/lib/minst.dll ./bin/attach.dll ./bin/jsoundds.dll ./bin/client/jvm.dll @@ -579,14 +523,6 @@ ./bin/wsgen ./bin/wsimport ./bin/xjc - ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.dylib - ./demo/jvmti/gctest/lib/libgctest.dylib - ./demo/jvmti/heapTracker/lib/libheapTracker.dylib - ./demo/jvmti/heapViewer/lib/libheapViewer.dylib - ./demo/jvmti/minst/lib/libminst.dylib - ./demo/jvmti/mtrace/lib/libmtrace.dylib - ./demo/jvmti/versionCheck/lib/libversionCheck.dylib - ./demo/jvmti/waiters/lib/libwaiters.dylib ./Contents/Home/bin/_javaws ./Contents/Home/bin/javaws ./Contents/Home/bin/idlj
--- a/common/conf/jib-profiles.js Mon May 08 14:04:27 2017 +0100 +++ b/common/conf/jib-profiles.js Wed Jul 05 23:21:33 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, 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 @@ -422,8 +422,9 @@ "linux-x64": { target_os: "linux", target_cpu: "x64", - dependencies: ["devkit"], - configure_args: concat(common.configure_args_64bit, "--with-zlib=system"), + dependencies: ["devkit", "graphviz", "pandoc"], + configure_args: concat(common.configure_args_64bit, + "--enable-full-docs", "--with-zlib=system"), default_make_targets: ["docs-bundles"], }, @@ -964,7 +965,23 @@ ext: "tar.gz", revision: "2.7.1-v120+1.0", module: "freetype-" + input.target_platform - } + }, + + graphviz: { + organization: common.organization, + ext: "tar.gz", + revision: "2.38.0-1+1.1", + module: "graphviz-" + input.target_platform, + configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot" + }, + + pandoc: { + organization: common.organization, + ext: "tar.gz", + revision: "1.17.2+1.0", + module: "pandoc-" + input.target_platform, + configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc" + }, }; return dependencies;
--- a/common/nb_native/nbproject/configurations.xml Mon May 08 14:04:27 2017 +0100 +++ b/common/nb_native/nbproject/configurations.xml Wed Jul 05 23:21:33 2017 +0200 @@ -982,52 +982,6 @@ </df> </df> <df name="src"> - <df name="demo"> - <df name="share"> - <df name="jvmti"> - <df name="agent_util"> - <in>agent_util.c</in> - </df> - <df name="compiledMethodLoad"> - <in>compiledMethodLoad.c</in> - </df> - <df name="gctest"> - <in>gctest.c</in> - </df> - <df name="heapTracker"> - <in>heapTracker.c</in> - </df> - <df name="heapViewer"> - <in>heapViewer.c</in> - </df> - <df name="java_crw_demo"> - <in>java_crw_demo.c</in> - </df> - <df name="minst"> - <in>minst.c</in> - </df> - <df name="mtrace"> - <in>mtrace.c</in> - </df> - <df name="versionCheck"> - <in>versionCheck.c</in> - </df> - <df name="waiters"> - <in>Agent.cpp</in> - <in>Monitor.cpp</in> - <in>Thread.cpp</in> - <in>waiters.cpp</in> - </df> - </df> - </df> - <df name="solaris"> - <df name="jni"> - <df name="Poller"> - <in>Poller.c</in> - </df> - </df> - </df> - </df> <df name="java.base"> <df name="linux"> <df name="native"> @@ -21533,89 +21487,6 @@ </incDir> </ccTool> </item> - <item path="../../jdk/src/demo/share/jvmti/agent_util/agent_util.c" - ex="false" - tool="0" - flavor2="3"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c" - ex="false" - tool="0" - flavor2="3"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/gctest/gctest.c" - ex="false" - tool="0" - flavor2="3"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/heapTracker/heapTracker.c" - ex="false" - tool="0" - flavor2="3"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/heapViewer/heapViewer.c" - ex="false" - tool="0" - flavor2="3"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/java_crw_demo/java_crw_demo.c" - ex="false" - tool="0" - flavor2="3"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/minst/minst.c" - ex="false" - tool="0" - flavor2="3"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/mtrace/mtrace.c" - ex="false" - tool="0" - flavor2="3"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/versionCheck/versionCheck.c" - ex="false" - tool="0" - flavor2="3"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/Agent.cpp" - ex="false" - tool="1" - flavor2="4"> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/Monitor.cpp" - ex="false" - tool="1" - flavor2="4"> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/Thread.cpp" - ex="false" - tool="1" - flavor2="4"> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/waiters.cpp" - ex="false" - tool="1" - flavor2="4"> - </item> <item path="../../jdk/src/java.base/macosx/native/libjava/HostLocaleProviderAdapter_md.c" ex="false" tool="0" @@ -30509,113 +30380,6 @@ </incDir> </cTool> </folder> - <folder path="0/jdk/src/demo"> - <cTool> - <preprocessorList> - <Elem>DEBUG</Elem> - </preprocessorList> - </cTool> - <ccTool> - <incDir> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/demo/share/jvmti/waiters</pElem> - <pElem>../../jdk/src/java.base/macosx/native/include</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>DEBUG</Elem> - </preprocessorList> - </ccTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/agent_util"> - <cTool> - <incDir> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/java.base/macosx/native/include</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/compiledMethodLoad"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/compiledMethodLoad</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/macosx/native/include</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/gctest"> - <cTool> - <incDir> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/macosx/native/include</pElem> - <pElem>../../jdk/src/demo/share/jvmti/gctest</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/heapTracker"> - <cTool> - <incDir> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/macosx/native/include</pElem> - <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/heapViewer"> - <cTool> - <incDir> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/demo/share/jvmti/heapViewer</pElem> - <pElem>../../jdk/src/java.base/macosx/native/include</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/java_crw_demo"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/minst"> - <cTool> - <incDir> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/macosx/native/include</pElem> - <pElem>../../jdk/src/demo/share/jvmti/minst</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/mtrace"> - <cTool> - <incDir> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/macosx/native/include</pElem> - <pElem>../../jdk/src/demo/share/jvmti/mtrace</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/versionCheck"> - <cTool> - <incDir> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/demo/share/jvmti/versionCheck</pElem> - <pElem>../../jdk/src/java.base/macosx/native/include</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> <folder path="0/jdk/src/java.base"> <cTool> <incDir> @@ -36906,106 +36670,6 @@ <cTool flags="3"> </cTool> </item> - <item path="../../jdk/src/demo/share/jvmti/agent_util/agent_util.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/gctest/gctest.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/heapTracker/heapTracker.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/heapViewer/heapViewer.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/java_crw_demo/java_crw_demo.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/minst/minst.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/mtrace/mtrace.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/versionCheck/versionCheck.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="5"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/Agent.cpp" - ex="false" - tool="1" - flavor2="0"> - <ccTool flags="2"> - </ccTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/Monitor.cpp" - ex="false" - tool="1" - flavor2="0"> - <ccTool flags="2"> - <preprocessorList> - <Elem>THIS_FILE="Monitor.cpp"</Elem> - </preprocessorList> - </ccTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/Thread.cpp" - ex="false" - tool="1" - flavor2="0"> - <ccTool flags="2"> - <preprocessorList> - <Elem>THIS_FILE="Thread.cpp"</Elem> - </preprocessorList> - </ccTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/waiters.cpp" - ex="false" - tool="1" - flavor2="0"> - <ccTool flags="2"> - <preprocessorList> - <Elem>THIS_FILE="waiters.cpp"</Elem> - </preprocessorList> - </ccTool> - </item> <item path="../../jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c" ex="false" tool="0" @@ -46197,183 +45861,6 @@ </preprocessorList> </cTool> </folder> - <folder path="0/jdk/src/demo"> - <cTool> - <preprocessorList> - <Elem>DEBUG</Elem> - </preprocessorList> - </cTool> - <ccTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/waiters</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/linux/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>DEBUG</Elem> - </preprocessorList> - </ccTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/agent_util"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/linux/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/compiledMethodLoad"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/compiledMethodLoad</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/linux/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="compiledMethodLoad.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/gctest"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/gctest</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/linux/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="gctest.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/heapTracker"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/linux/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="heapTracker.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/heapViewer"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/heapViewer</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/linux/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="heapViewer.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/java_crw_demo"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/linux/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="java_crw_demo.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/minst"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/minst</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/linux/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="minst.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/mtrace"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/mtrace</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/linux/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="mtrace.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/versionCheck"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/versionCheck</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/linux/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="versionCheck.c"</Elem> - </preprocessorList> - </cTool> - </folder> <folder path="0/jdk/src/java.base"> <cTool> <preprocessorList> @@ -55235,113 +54722,6 @@ <ccTool flags="0"> </ccTool> </item> - <item path="../../jdk/src/demo/share/jvmti/agent_util/agent_util.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="3"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="3"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/gctest/gctest.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="3"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/heapTracker/heapTracker.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="3"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/heapViewer/heapViewer.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="3"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/java_crw_demo/java_crw_demo.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="3"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/minst/minst.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="3"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/mtrace/mtrace.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="3"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/versionCheck/versionCheck.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="3"> - </cTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/Agent.cpp" - ex="false" - tool="1" - flavor2="0"> - <ccTool flags="0"> - </ccTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/Monitor.cpp" - ex="false" - tool="1" - flavor2="0"> - <ccTool flags="0"> - <preprocessorList> - <Elem>THIS_FILE="Monitor.cpp"</Elem> - </preprocessorList> - </ccTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/Thread.cpp" - ex="false" - tool="1" - flavor2="0"> - <ccTool flags="0"> - <preprocessorList> - <Elem>THIS_FILE="Thread.cpp"</Elem> - </preprocessorList> - </ccTool> - </item> - <item path="../../jdk/src/demo/share/jvmti/waiters/waiters.cpp" - ex="false" - tool="1" - flavor2="0"> - <ccTool flags="0"> - <preprocessorList> - <Elem>THIS_FILE="waiters.cpp"</Elem> - </preprocessorList> - </ccTool> - </item> - <item path="../../jdk/src/demo/solaris/jni/Poller/Poller.c" - ex="false" - tool="0" - flavor2="0"> - <cTool flags="2"> - </cTool> - </item> <item path="../../jdk/src/java.base/share/native/launcher/main.c" ex="false" tool="0" @@ -64674,8 +64054,6 @@ </cTool> <ccTool> <incDir> - <pElem>../../jdk/src/demo/share/jvmti/waiters</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> <pElem>../../jdk/src/java.base/share/native/include</pElem> <pElem>../../jdk/src/java.base/solaris/native/include</pElem> <pElem>../../jdk/src/java.base/unix/native/include</pElem> @@ -64699,189 +64077,6 @@ </preprocessorList> </ccTool> </folder> - <folder path="0/jdk/src/demo"> - <cTool> - <preprocessorList> - <Elem>DEBUG</Elem> - </preprocessorList> - </cTool> - <ccTool> - <preprocessorList> - <Elem>DEBUG</Elem> - </preprocessorList> - </ccTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/agent_util"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/solaris/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/compiledMethodLoad"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/compiledMethodLoad</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/solaris/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="compiledMethodLoad.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/gctest"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/gctest</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/solaris/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="gctest.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/heapTracker"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/solaris/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="heapTracker.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/heapViewer"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/heapViewer</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/solaris/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="heapViewer.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/java_crw_demo"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/heapTracker</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/solaris/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="java_crw_demo.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/minst"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/minst</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/solaris/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="minst.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/mtrace"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/mtrace</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/demo/share/jvmti/java_crw_demo</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/solaris/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="mtrace.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/share/jvmti/versionCheck"> - <cTool> - <incDir> - <pElem>../../jdk/src/demo/share/jvmti/versionCheck</pElem> - <pElem>../../jdk/src/demo/share/jvmti/agent_util</pElem> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/solaris/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="versionCheck.c"</Elem> - </preprocessorList> - </cTool> - </folder> - <folder path="0/jdk/src/demo/solaris"> - <cTool> - <incDir> - <pElem>../../jdk/src/java.base/share/native/include</pElem> - <pElem>../../jdk/src/java.base/solaris/native/include</pElem> - <pElem>../../jdk/src/java.base/unix/native/include</pElem> - <pElem>../../jdk/src/java.base/share/native/libjava</pElem> - <pElem>../../jdk/src/java.base/unix/native/libjava</pElem> - <pElem>../../build/support/demos/classes/jni/Poller</pElem> - <pElem>../../jdk/make</pElem> - </incDir> - <preprocessorList> - <Elem>THIS_FILE="Poller.c"</Elem> - </preprocessorList> - </cTool> - </folder> <folder path="0/jdk/src/java.base"> <cTool> <incDir>
--- a/hotspot/.hgtags Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/.hgtags Wed Jul 05 23:21:33 2017 +0200 @@ -560,6 +560,7 @@ a9fdfd55835ef9dccb7f317b07249bd66653b874 jdk-9+154 f3b3d77a1751897413aae43ac340a130b6fa2ae1 jdk-9+155 43139c588ea48b6504e52b6c3dec530b17b1fdb4 jdk-9+156 +1ea217626ba0995dd03127f8322ba3687926a085 jdk-10+1 b2d0a906afd73dcf27f572217eb1be0f196ec16c jdk-9+157 4e78f30935229f13ce7c43089621cf7169f5abac jdk-9+158 9211c2e89c1cd11ec2d5752b0f97131a7d7525c7 jdk-9+159 @@ -570,3 +571,10 @@ 0af429be8bbaeaaf0cb838e9af28c953dda6a9c8 jdk-9+164 c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165 560d7aa083a24b6a56443feb8de0f40435d33aa9 jdk-9+166 +48809c513ed5ebb4d4dbf2f454afcce2780db6db jdk-10+2 +6c3b6b3438c4a63e619f00bd5732d1260ffd5600 jdk-10+3 +8295ca08f5cb09c090eb048bbdd338d7e270c8bf jdk-10+4 +7b5ca2ff1f78873ca3ee99b6589d3cb4dde2e454 jdk-10+5 +762465099d938fd96cd1efda193bc1fa23d070d3 jdk-10+6 +1ca7ed1b17b5776930d641d1379834f3140a74e4 jdk-9+167 +fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168
--- a/hotspot/.mx.jvmci/.pydevproject Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/.mx.jvmci/.pydevproject Wed Jul 05 23:21:33 2017 +0200 @@ -3,7 +3,7 @@ <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> -<path>/.mx.jvmci</path> +<path>/mx.jvmci</path> </pydev_pathproperty> <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> <path>/mx</path>
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -1221,12 +1221,19 @@ obj.load_item(); // info for exceptions - CodeEmitInfo* info_for_exception = state_for(x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); CodeStub* stub; if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, + Deoptimization::Reason_class_check, + Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); }
--- a/hotspot/src/cpu/aarch64/vm/globalDefinitions_aarch64.hpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/cpu/aarch64/vm/globalDefinitions_aarch64.hpp Wed Jul 05 23:21:33 2017 +0200 @@ -34,10 +34,6 @@ #define SUPPORTS_NATIVE_CX8 -// The maximum B/BL offset range on AArch64 is 128MB. -#undef CODE_CACHE_DEFAULT_LIMIT -#define CODE_CACHE_DEFAULT_LIMIT (128*M) - // According to the ARMv8 ARM, "Concurrent modification and execution // of instructions can lead to the resulting instruction performing // any behavior that can be achieved by executing any sequence of
--- a/hotspot/src/cpu/arm/vm/c1_LIRAssembler_arm.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/cpu/arm/vm/c1_LIRAssembler_arm.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -1453,10 +1453,11 @@ ciKlass* k = op->klass(); assert_different_registers(res, k_RInfo, klass_RInfo, Rtemp); + if (stub->is_simple_exception_stub()) { // TODO: ARM - Late binding is used to prevent confusion of register allocator assert(stub->is_exception_throw_stub(), "must be"); ((SimpleExceptionStub*)stub)->set_obj(op->result_opr()); - + } ciMethodData* md; ciProfileData* data; int mdo_offset_bias = 0;
--- a/hotspot/src/cpu/arm/vm/c1_LIRGenerator_arm.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/cpu/arm/vm/c1_LIRGenerator_arm.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1412,12 +1412,20 @@ obj.load_item(); - CodeEmitInfo* info_for_exception = state_for(x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); + CodeStub* stub; if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, + Deoptimization::Reason_class_check, + Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, LIR_OprFact::illegalOpr, info_for_exception);
--- a/hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -1131,12 +1131,19 @@ obj.load_item(); LIR_Opr out_reg = rlock_result(x); CodeStub* stub; - CodeEmitInfo* info_for_exception = state_for(x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, + Deoptimization::Reason_class_check, + Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); }
--- a/hotspot/src/cpu/s390/vm/c1_LIRGenerator_s390.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/cpu/s390/vm/c1_LIRGenerator_s390.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -993,12 +993,19 @@ obj.load_item(); // info for exceptions - CodeEmitInfo* info_for_exception = state_for (x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); CodeStub* stub; if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, + Deoptimization::Reason_class_check, + Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); }
--- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -1196,11 +1196,18 @@ obj.load_item(); LIR_Opr out_reg = rlock_result(x); CodeStub* stub; - CodeEmitInfo* info_for_exception = state_for(x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, + Deoptimization::Reason_class_check, + Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); }
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -1429,12 +1429,17 @@ obj.load_item(); // info for exceptions - CodeEmitInfo* info_for_exception = state_for(x); + CodeEmitInfo* info_for_exception = + (x->needs_exception_state() ? state_for(x) : + state_for(x, x->state_before(), true /*ignore_xhandler*/)); CodeStub* stub; if (x->is_incompatible_class_change_check()) { assert(patching_info == NULL, "can't patch this"); stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); + } else if (x->is_invokespecial_receiver_check()) { + assert(patching_info == NULL, "can't patch this"); + stub = new DeoptimizeStub(info_for_exception, Deoptimization::Reason_class_check, Deoptimization::Action_none); } else { stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); }
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -763,12 +763,11 @@ FLAG_SET_DEFAULT(UseCRC32Intrinsics, false); } - if (supports_sse4_2()) { + if (supports_sse4_2() && supports_clmul()) { if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) { UseCRC32CIntrinsics = true; } - } - else if (UseCRC32CIntrinsics) { + } else if (UseCRC32CIntrinsics) { if (!FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) { warning("CRC32C intrinsics are not available on this CPU"); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/AltHashing.java Wed Jul 05 23:21:33 2017 +0200 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package sun.jvm.hotspot.memory; + +public class AltHashing { + public static long murmur3_32(long seed, byte[] data) { + long h1 = seed; + int len = data.length; + int count = len; + + int offset = 0; + + // body + while (count >= 4) { + long k1 = (data[offset] & 0x0FF) + | (data[offset + 1] & 0x0FF) << 8 + | (data[offset + 2] & 0x0FF) << 16 + | data[offset + 3] << 24; + + count -= 4; + offset += 4; + + k1 *= 0xcc9e2d51; + k1 = Integer.rotateLeft((int)k1, 15); + k1 *= 0x1b873593; + k1 &= 0xFFFFFFFFL; + + h1 ^= k1; + h1 = Integer.rotateLeft((int)h1, 13); + h1 = h1 * 5 + 0xe6546b64; + h1 &= 0xFFFFFFFFL; + } + + //tail + if (count > 0) { + long k1 = 0; + + switch (count) { + case 3: + k1 ^= (data[offset + 2] & 0xff) << 16; + // fall through + case 2: + k1 ^= (data[offset + 1] & 0xff) << 8; + // fall through + case 1: + k1 ^= (data[offset] & 0xff); + // fall through + default: + k1 *= 0xcc9e2d51; + k1 = Integer.rotateLeft((int)k1, 15); + k1 *= 0x1b873593; + k1 &= 0xFFFFFFFFL; + h1 ^= k1; + h1 &= 0xFFFFFFFFL; + } + } + + // finalization + h1 ^= len; + + // finalization mix force all bits of a hash block to avalanche + h1 ^= h1 >> 16; + h1 *= 0x85ebca6b; + h1 &= 0xFFFFFFFFL; + h1 ^= h1 >> 13; + h1 *= 0xc2b2ae35; + h1 &= 0xFFFFFFFFL; + h1 ^= h1 >> 16; + + return h1 & 0xFFFFFFFFL; + } +}
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/SymbolTable.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/SymbolTable.java Wed Jul 05 23:21:33 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -45,11 +45,14 @@ Type type = db.lookupType("SymbolTable"); theTableField = type.getAddressField("_the_table"); sharedTableField = type.getAddressField("_shared_table"); + type = db.lookupType("RehashableSymbolHashtable"); + seedField = type.getCIntegerField("_seed"); } // Fields private static AddressField theTableField; private static AddressField sharedTableField; + private static CIntegerField seedField; private CompactHashTable sharedTable; @@ -62,6 +65,17 @@ return table; } + public static long getSeed() { + return (long) seedField.getValue(); + } + + public static boolean useAlternateHashcode() { + if (getSeed() != 0) { + return true; + } + return false; + } + public SymbolTable(Address addr) { super(addr); } @@ -86,11 +100,17 @@ public Symbol probe(byte[] name) { long hashValue = hashSymbol(name); + // shared table does not use alternate hashing algorithm, + // it always uses the same original hash code. Symbol s = sharedTable.probe(name, hashValue); if (s != null) { return s; } + if (useAlternateHashcode()) { + hashValue = AltHashing.murmur3_32(getSeed(), name); + } + for (HashtableEntry e = (HashtableEntry) bucket(hashToIndex(hashValue)); e != null; e = (HashtableEntry) e.next()) { if (e.hash() == hashValue) { Symbol sym = Symbol.create(e.literalValue());
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/EventProvider.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/EventProvider.java Wed Jul 05 23:21:33 2017 +0200 @@ -24,7 +24,6 @@ import jdk.vm.ci.hotspot.EmptyEventProvider.EmptyCompilationEvent; import jdk.vm.ci.hotspot.EmptyEventProvider.EmptyCompilerFailureEvent; -import jdk.vm.ci.services.JVMCIPermission; /** * Service-provider class for logging compiler related events.
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java Wed Jul 05 23:21:33 2017 +0200 @@ -28,9 +28,9 @@ import jdk.vm.ci.runtime.JVMCICompiler; import jdk.vm.ci.runtime.JVMCICompilerFactory; import jdk.vm.ci.runtime.JVMCIRuntime; +import jdk.vm.ci.services.JVMCIPermission; import jdk.vm.ci.services.JVMCIServiceLocator; -import jdk.vm.ci.services.JVMCIPermission; -import jdk.vm.ci.services.Services; +import jdk.vm.ci.services.internal.ReflectionAccessJDK; final class HotSpotJVMCICompilerConfig { @@ -47,7 +47,7 @@ @Override public String getCompilerName() { - return "<none>"; + return "null"; } @Override @@ -73,19 +73,23 @@ JVMCICompilerFactory factory = null; String compilerName = Option.Compiler.getString(); if (compilerName != null) { - for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) { - if (f.getCompilerName().equals(compilerName)) { - factory = f; + if (compilerName.isEmpty() || compilerName.equals("null")) { + factory = new DummyCompilerFactory(); + } else { + for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) { + if (f.getCompilerName().equals(compilerName)) { + factory = f; + } } - } - if (factory == null) { - throw new JVMCIError("JVMCI compiler '%s' not found", compilerName); + if (factory == null) { + throw new JVMCIError("JVMCI compiler '%s' not found", compilerName); + } } } else { // Auto select a single available compiler for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) { if (factory == null) { - Services.exportJVMCITo(f.getClass()); + ReflectionAccessJDK.openJVMCITo(f.getClass()); factory = f; } else { // Multiple factories seen - cancel auto selection
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Wed Jul 05 23:21:33 2017 +0200 @@ -32,6 +32,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.ServiceLoader; import java.util.TreeMap; import jdk.internal.misc.VM; @@ -50,7 +51,6 @@ import jdk.vm.ci.runtime.JVMCICompiler; import jdk.vm.ci.runtime.JVMCICompilerFactory; import jdk.vm.ci.services.JVMCIServiceLocator; -import jdk.vm.ci.services.Services; /** * HotSpot implementation of a JVMCI runtime. @@ -88,7 +88,10 @@ */ public enum Option { // @formatter:off - Compiler(String.class, null, "Selects the system compiler."), + Compiler(String.class, null, "Selects the system compiler. This must match the getCompilerName() value returned " + + "by a jdk.vm.ci.runtime.JVMCICompilerFactory provider. " + + "An empty string or the value \"null\" selects a compiler " + + "that will raise an exception upon receiving a compilation request."), // Note: The following one is not used (see InitTimer.ENABLED). It is added here // so that -XX:+JVMCIPrintProperties shows the option. InitTimer(Boolean.class, false, "Specifies if initialization timing is enabled."), @@ -208,7 +211,7 @@ } public static HotSpotJVMCIBackendFactory findFactory(String architecture) { - for (HotSpotJVMCIBackendFactory factory : Services.load(HotSpotJVMCIBackendFactory.class)) { + for (HotSpotJVMCIBackendFactory factory : ServiceLoader.load(HotSpotJVMCIBackendFactory.class, ClassLoader.getSystemClassLoader())) { if (factory.getArchitecture().equalsIgnoreCase(architecture)) { return factory; }
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Wed Jul 05 23:21:33 2017 +0200 @@ -98,7 +98,7 @@ boolean aligned = ((displacement - headerSize) % sizeOfElement) == 0; if (displacement < 0 || displacement > (arrayEnd - sizeOfElement) || (kind == JavaKind.Object && !aligned)) { int index = (int) ((displacement - headerSize) / sizeOfElement); - throw new AssertionError("Unsafe array access: reading element of kind " + kind + + throw new IllegalArgumentException("Unsafe array access: reading element of kind " + kind + " at offset " + displacement + " (index ~ " + index + ") in " + type.toJavaName() + " object of length " + length); }
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Wed Jul 05 23:21:33 2017 +0200 @@ -801,8 +801,7 @@ } if (elementType.getName().startsWith("Ljava/")) { // Classes in a java.* package can only be defined by the - // boot class loader. This is enforced by ClassLoader.preDefineClass() - assert mirror().getClassLoader() == null; + // boot or platform class loader. return true; } ClassLoader thisCl = mirror().getClassLoader();
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/JVMCIServiceLocator.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/JVMCIServiceLocator.java Wed Jul 05 23:21:33 2017 +0200 @@ -24,12 +24,15 @@ import java.util.ArrayList; import java.util.List; +import java.util.ServiceLoader; + +import jdk.vm.ci.services.internal.ReflectionAccessJDK; /** * Service-provider class for the runtime to locate providers of JVMCI services where the latter are - * not in packages exported by the JVMCI module. As part of instantiating - * {@link JVMCIServiceLocator}, all JVMCI packages will be {@linkplain Services#exportJVMCITo(Class) - * exported} to the module defining the class of the instantiated object. + * not in packages exported by the JVMCI module. As part of instantiating a + * {@link JVMCIServiceLocator}, all JVMCI packages will be opened to the module defining the class + * of the instantiated object. * * While the {@link #getProvider(Class)} method can be used directly, it's usually easier to use * {@link #getProviders(Class)}. @@ -49,30 +52,39 @@ } /** - * Creates a capability for accessing JVMCI. Once successfully instantiated, JVMCI exports all - * its packages to the module defining the type of this object. + * Creates a capability for accessing JVMCI. Once successfully instantiated, JVMCI opens all its + * packages to the module defining the type of this object. * * @throws SecurityException if a security manager has been installed and it denies * {@link JVMCIPermission} */ protected JVMCIServiceLocator() { this(checkPermission()); - Services.exportJVMCITo(getClass()); + Services.checkJVMCIEnabled(); + ReflectionAccessJDK.openJVMCITo(getClass()); } /** * Gets the provider of the service defined by {@code service} or {@code null} if this object * does not have a provider for {@code service}. */ - public abstract <S> S getProvider(Class<S> service); + protected abstract <S> S getProvider(Class<S> service); /** - * Gets the providers of the service defined by {@code service} by querying the - * {@link JVMCIServiceLocator} providers obtained by {@link Services#load(Class)}. + * Gets the providers of the service defined by {@code service} by querying the available + * {@link JVMCIServiceLocator} providers. + * + * @throws SecurityException if a security manager is present and it denies + * {@link JVMCIPermission} */ public static <S> List<S> getProviders(Class<S> service) { + Services.checkJVMCIEnabled(); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new JVMCIPermission()); + } List<S> providers = new ArrayList<>(); - for (JVMCIServiceLocator access : Services.load(JVMCIServiceLocator.class)) { + for (JVMCIServiceLocator access : ServiceLoader.load(JVMCIServiceLocator.class, ClassLoader.getSystemClassLoader())) { S provider = access.getProvider(service); if (provider != null) { providers.add(provider);
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java Wed Jul 05 23:21:33 2017 +0200 @@ -22,167 +22,64 @@ */ package jdk.vm.ci.services; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.Formatter; -import java.util.Iterator; -import java.util.ServiceConfigurationError; -import java.util.ServiceLoader; -import java.util.Set; +import java.util.Map; /** - * A mechanism for accessing service providers via JVMCI. + * Provides utilities needed by JVMCI clients. */ public final class Services { + // This class must be compilable and executable on JDK 8 since it's used in annotation + // processors while building JDK 9 so use of API added in JDK 9 is made via reflection. + private Services() { } - private static int getJavaSpecificationVersion() { - String value = System.getProperty("java.specification.version"); - if (value.startsWith("1.")) { - value = value.substring(2); - } - return Integer.parseInt(value); - } - - /** - * The integer value corresponding to the value of the {@code java.specification.version} system - * property after any leading {@code "1."} has been stripped. - */ - public static final int JAVA_SPECIFICATION_VERSION = getJavaSpecificationVersion(); - - // Use reflection so that this compiles on Java 8 - private static final Method getModule; - private static final Method getPackages; - private static final Method addUses; - private static final Method isExported; - private static final Method addExports; - - static { - if (JAVA_SPECIFICATION_VERSION >= 9) { - try { - getModule = Class.class.getMethod("getModule"); - Class<?> moduleClass = getModule.getReturnType(); - getPackages = moduleClass.getMethod("getPackages"); - addUses = moduleClass.getMethod("addUses", Class.class); - isExported = moduleClass.getMethod("isExported", String.class, moduleClass); - addExports = moduleClass.getMethod("addExports", String.class, moduleClass); - } catch (NoSuchMethodException | SecurityException e) { - throw new InternalError(e); - } - } else { - getModule = null; - getPackages = null; - addUses = null; - isExported = null; - addExports = null; + @SuppressWarnings("unchecked") + private static Map<String, String> initSavedProperties() throws InternalError { + try { + Class<?> vmClass = Class.forName("jdk.internal.misc.VM"); + Method m = vmClass.getMethod("getSavedProperties"); + return (Map<String, String>) m.invoke(null); + } catch (Exception e) { + throw new InternalError(e); } } - @SuppressWarnings("unchecked") - static <T> T invoke(Method method, Object receiver, Object... args) { - try { - return (T) method.invoke(receiver, args); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new InternalError(e); + static final Map<String, String> SAVED_PROPERTIES = initSavedProperties(); + static final boolean JVMCI_ENABLED = Boolean.parseBoolean(SAVED_PROPERTIES.get("jdk.internal.vm.ci.enabled")); + + /** + * Checks that JVMCI is enabled in the VM and throws an error if it isn't. + */ + static void checkJVMCIEnabled() { + if (!JVMCI_ENABLED) { + throw new Error("The EnableJVMCI VM option must be true (i.e., -XX:+EnableJVMCI) to use JVMCI"); } } /** - * Performs any required security checks and dynamic reconfiguration to allow the module of a - * given class to access the classes in the JVMCI module. - * - * Note: This API uses {@link Class} instead of {@code Module} to provide backwards - * compatibility for JVMCI clients compiled against a JDK release earlier than 9. - * - * @param requestor a class requesting access to the JVMCI module for its module - * @throws SecurityException if a security manager is present and it denies - * {@link JVMCIPermission} + * Gets an unmodifiable copy of the system properties saved when {@link System} is initialized. */ - public static void exportJVMCITo(Class<?> requestor) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new JVMCIPermission()); - } - if (JAVA_SPECIFICATION_VERSION >= 9) { - Object jvmci = invoke(getModule, Services.class); - Object requestorModule = invoke(getModule, requestor); - if (jvmci != requestorModule) { - Set<String> packages = invoke(getPackages, jvmci); - for (String pkg : packages) { - // Export all JVMCI packages dynamically instead - // of requiring a long list of --add-exports - // options on the JVM command line. - boolean exported = invoke(isExported, jvmci, pkg, requestorModule); - if (!exported) { - invoke(addExports, jvmci, pkg, requestorModule); - } - } - } - } - } - - /** - * Gets an {@link Iterable} of the JVMCI providers available for a given service. - * - * @throws SecurityException if a security manager is present and it denies - * {@link JVMCIPermission} - */ - public static <S> Iterable<S> load(Class<S> service) { + public static Map<String, String> getSavedProperties() { + checkJVMCIEnabled(); SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new JVMCIPermission()); } - if (JAVA_SPECIFICATION_VERSION >= 9) { - Object jvmci = invoke(getModule, Services.class); - invoke(addUses, jvmci, service); - } - - // Restrict JVMCI clients to be on the class path or module path - return ServiceLoader.load(service, ClassLoader.getSystemClassLoader()); + return SAVED_PROPERTIES; } /** - * Gets the JVMCI provider for a given service for which at most one provider must be available. - * - * @param service the service whose provider is being requested - * @param required specifies if an {@link InternalError} should be thrown if no provider of - * {@code service} is available - * @throws SecurityException if a security manager is present and it denies - * {@link JVMCIPermission} + * Causes the JVMCI subsystem to be initialized if it isn't already initialized. */ - public static <S> S loadSingle(Class<S> service, boolean required) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new JVMCIPermission()); - } - if (JAVA_SPECIFICATION_VERSION >= 9) { - Object jvmci = invoke(getModule, Services.class); - invoke(addUses, jvmci, service); + public static void initializeJVMCI() { + checkJVMCIEnabled(); + try { + Class.forName("jdk.vm.ci.runtime.JVMCI"); + } catch (ClassNotFoundException e) { + throw new InternalError(e); } - // Restrict JVMCI clients to be on the class path or module path - Iterable<S> providers = ServiceLoader.load(service, ClassLoader.getSystemClassLoader()); - S singleProvider = null; - try { - for (Iterator<S> it = providers.iterator(); it.hasNext();) { - singleProvider = it.next(); - if (it.hasNext()) { - throw new InternalError(String.format("Multiple %s providers found", service.getName())); - } - } - } catch (ServiceConfigurationError e) { - // If the service is required we will bail out below. - } - if (singleProvider == null && required) { - String javaHome = System.getProperty("java.home"); - String vmName = System.getProperty("java.vm.name"); - Formatter errorMessage = new Formatter(); - errorMessage.format("The VM does not expose required service %s.%n", service.getName()); - errorMessage.format("Currently used Java home directory is %s.%n", javaHome); - errorMessage.format("Currently used VM configuration is: %s", vmName); - throw new UnsupportedOperationException(errorMessage.toString()); - } - return singleProvider; } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/internal/ReflectionAccessJDK.java Wed Jul 05 23:21:33 2017 +0200 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.services.internal; + +import java.lang.reflect.Method; +import java.util.Set; + +import jdk.vm.ci.services.Services; + +/** + * Reflection based access to API introduced in JDK 9. This allows the API to be used in code that + * must be compiled (but not executed) on JDK 8. + */ +public final class ReflectionAccessJDK { + + /** + * {@code Class.getModule()}. + */ + private static final Method getModule; + + /** + * {@code java.lang.Module.addOpens(String, Module)}. + */ + private static final Method addOpens; + + /** + * {@code java.lang.Module.getPackages(Module, String, Module)}. + */ + private static final Method getPackages; + + /** + * {@code java.lang.Module.isOpen(String, Module)}. + */ + private static final Method isOpenTo; + + /** + * Opens all JVMCI packages to the module of a given class. + * + * @param other all JVMCI packages will be opened to the module of this class + */ + @SuppressWarnings("unchecked") + public static void openJVMCITo(Class<?> other) { + try { + Object jvmci = getModule.invoke(Services.class); + Object otherModule = getModule.invoke(other); + if (jvmci != otherModule) { + Set<String> packages = (Set<String>) getPackages.invoke(jvmci); + for (String pkg : packages) { + boolean opened = (Boolean) isOpenTo.invoke(jvmci, pkg, otherModule); + if (!opened) { + addOpens.invoke(jvmci, pkg, otherModule); + } + } + } + } catch (Exception e) { + throw new InternalError(e); + } + } + + static { + try { + getModule = Class.class.getMethod("getModule"); + Class<?> moduleClass = getModule.getReturnType(); + getPackages = moduleClass.getMethod("getPackages"); + isOpenTo = moduleClass.getMethod("isOpen", String.class, moduleClass); + addOpens = moduleClass.getDeclaredMethod("addOpens", String.class, moduleClass); + } catch (NoSuchMethodException | SecurityException e) { + throw new InternalError(e); + } + } +}
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/module-info.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/module-info.java Wed Jul 05 23:21:33 2017 +0200 @@ -33,37 +33,4 @@ jdk.vm.ci.hotspot.aarch64.AArch64HotSpotJVMCIBackendFactory, jdk.vm.ci.hotspot.amd64.AMD64HotSpotJVMCIBackendFactory, jdk.vm.ci.hotspot.sparc.SPARCHotSpotJVMCIBackendFactory; - - exports jdk.vm.ci.aarch64 to - jdk.internal.vm.compiler; - exports jdk.vm.ci.amd64 to - jdk.aot, - jdk.internal.vm.compiler; - exports jdk.vm.ci.code to - jdk.aot, - jdk.internal.vm.compiler; - exports jdk.vm.ci.code.site to - jdk.aot, - jdk.internal.vm.compiler; - exports jdk.vm.ci.code.stack to - jdk.internal.vm.compiler; - exports jdk.vm.ci.common to - jdk.internal.vm.compiler; - exports jdk.vm.ci.hotspot to - jdk.aot, - jdk.internal.vm.compiler; - exports jdk.vm.ci.hotspot.aarch64 to - jdk.internal.vm.compiler; - exports jdk.vm.ci.hotspot.amd64 to - jdk.internal.vm.compiler; - exports jdk.vm.ci.hotspot.sparc to - jdk.internal.vm.compiler; - exports jdk.vm.ci.meta to - jdk.aot, - jdk.internal.vm.compiler; - exports jdk.vm.ci.runtime to - jdk.aot, - jdk.internal.vm.compiler; - exports jdk.vm.ci.sparc to - jdk.internal.vm.compiler; }
--- a/hotspot/src/jdk.internal.vm.compiler/.mx.graal/.pydevproject Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/.mx.graal/.pydevproject Wed Jul 05 23:21:33 2017 +0200 @@ -3,9 +3,9 @@ <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> -<path>/mx.graal</path> -<path>/mx.graal</path> -<path>/mx.graal</path> +<path>/.mx.graal</path> +<path>/.mx.graal</path> +<path>/.mx.graal</path> </pydev_pathproperty> </pydev_project>
--- a/hotspot/src/jdk.internal.vm.compiler/.mx.graal/suite.py Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/.mx.graal/suite.py Wed Jul 05 23:21:33 2017 +0200 @@ -8,6 +8,36 @@ # (e.g., macosx-x86_64-normal-server-release). "outputRoot" : "../../../build/mx/hotspot", + "jdklibraries" : { + "JVMCI_SERVICES" : { + "path" : "lib/jvmci-services.jar", + "sourcePath" : "lib/jvmci-services.src.zip", + "optional" : False, + "jdkStandardizedSince" : "9", + "module" : "jdk.internal.vm.ci" + }, + "JVMCI_API" : { + "path" : "lib/jvmci/jvmci-api.jar", + "sourcePath" : "lib/jvmci/jvmci-api.src.zip", + "dependencies" : [ + "JVMCI_SERVICES", + ], + "optional" : False, + "jdkStandardizedSince" : "9", + "module" : "jdk.internal.vm.ci" + }, + "JVMCI_HOTSPOT" : { + "path" : "lib/jvmci/jvmci-hotspot.jar", + "sourcePath" : "lib/jvmci/jvmci-hotspot.src.zip", + "dependencies" : [ + "JVMCI_API", + ], + "optional" : False, + "jdkStandardizedSince" : "9", + "module" : "jdk.internal.vm.ci" + }, + }, + "libraries" : { # ------------- Libraries ------------- @@ -17,6 +47,16 @@ "sha1" : "476d9a44cd19d6b55f81571077dfa972a4f8a083", "bootClassPathAgent" : "true", }, + "ASM5" : { + "sha1" : "0da08b8cce7bbf903602a25a3a163ae252435795", + "urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/asm-5.0.4.jar"], + }, + + "ASM_TREE5" : { + "sha1" : "396ce0c07ba2b481f25a70195c7c94922f0d1b0b", + "urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/asm-tree-5.0.4.jar"], + "dependencies" : ["ASM5"], + }, }, "projects" : { @@ -32,6 +72,7 @@ "org.graalvm.compiler.serviceprovider" : { "subDir" : "share/classes", + "dependencies" : ["JVMCI_SERVICES"], "sourceDirs" : ["src"], "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "1.8", @@ -49,6 +90,7 @@ "org.graalvm.compiler.options" : { "subDir" : "share/classes", + "dependencies" : ["JVMCI_SERVICES", "JVMCI_API"], "sourceDirs" : ["src"], "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "1.8", @@ -83,6 +125,7 @@ "sourceDirs" : ["src"], "checkstyle" : "org.graalvm.compiler.graph", "dependencies" : [ + "JVMCI_API", "org.graalvm.compiler.serviceprovider", "org.graalvm.compiler.options" ], @@ -137,6 +180,7 @@ "sourceDirs" : ["src"], "checkstyle" : "org.graalvm.compiler.graph", "dependencies" : [ + "JVMCI_HOTSPOT", "org.graalvm.compiler.core.test", ], "javaCompliance" : "1.8", @@ -146,6 +190,9 @@ "org.graalvm.compiler.api.runtime" : { "subDir" : "share/classes", "sourceDirs" : ["src"], + "dependencies" : [ + "JVMCI_API", + ], "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "1.8", "workingSets" : "API,Graal", @@ -156,6 +203,7 @@ "sourceDirs" : ["src"], "dependencies" : [ "mx:JUNIT", + "JVMCI_SERVICES", "org.graalvm.compiler.api.runtime", ], "checkstyle" : "org.graalvm.compiler.graph", @@ -166,6 +214,7 @@ "org.graalvm.compiler.api.replacements" : { "subDir" : "share/classes", "sourceDirs" : ["src"], + "dependencies" : ["JVMCI_API"], "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "1.8", "workingSets" : "API,Graal,Replacements", @@ -175,6 +224,7 @@ "subDir" : "share/classes", "sourceDirs" : ["src"], "dependencies" : [ + "JVMCI_HOTSPOT", "org.graalvm.compiler.api.runtime", "org.graalvm.compiler.replacements", "org.graalvm.compiler.runtime", @@ -261,6 +311,8 @@ "org.graalvm.compiler.hotspot", "org.graalvm.compiler.lir.jtt", "org.graalvm.compiler.lir.test", + "JVMCI_API", + "JVMCI_HOTSPOT", ], "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "1.8", @@ -347,6 +399,9 @@ "org.graalvm.compiler.asm" : { "subDir" : "share/classes", "sourceDirs" : ["src"], + "dependencies" : [ + "JVMCI_API", + ], "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "1.8", "workingSets" : "Graal,Assembler", @@ -403,6 +458,7 @@ "org.graalvm.compiler.bytecode" : { "subDir" : "share/classes", "sourceDirs" : ["src"], + "dependencies" : ["JVMCI_API"], "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "1.8", "workingSets" : "Graal,Java", @@ -774,6 +830,7 @@ "dependencies" : [ "org.graalvm.compiler.lir.jtt", "org.graalvm.compiler.lir.aarch64", + "JVMCI_HOTSPOT" ], "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "1.8", @@ -803,6 +860,7 @@ "dependencies" : [ "org.graalvm.compiler.lir.jtt", "org.graalvm.compiler.lir.amd64", + "JVMCI_HOTSPOT" ], "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "1.8", @@ -831,6 +889,7 @@ "sourceDirs" : ["src"], "dependencies" : [ "org.graalvm.compiler.lir.jtt", + "JVMCI_HOTSPOT" ], "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "1.8", @@ -908,6 +967,7 @@ "org.graalvm.compiler.graph.test", "org.graalvm.compiler.printer", "JAVA_ALLOCATION_INSTRUMENTER", + "ASM_TREE5", ], "annotationProcessors" : ["GRAAL_NODEINFO_PROCESSOR"], "checkstyle" : "org.graalvm.compiler.graph",
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.test/src/org/graalvm/compiler/api/test/Graal.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.test/src/org/graalvm/compiler/api/test/Graal.java Wed Jul 05 23:21:33 2017 +0200 @@ -40,7 +40,7 @@ private static final GraalRuntime runtime = initializeRuntime(); private static GraalRuntime initializeRuntime() { - Services.exportJVMCITo(Graal.class); + Services.initializeJVMCI(); JVMCICompiler compiler = JVMCI.getRuntime().getCompiler(); if (compiler instanceof GraalJVMCICompiler) { GraalJVMCICompiler graal = (GraalJVMCICompiler) compiler;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java Wed Jul 05 23:21:33 2017 +0200 @@ -53,11 +53,6 @@ public static final ModuleAPI getModule; /** - * {@code jdk.internal.module.Modules.addExports(Module, String, Module)}. - */ - public static final ModuleAPI addExports; - - /** * {@code java.lang.Module.getResourceAsStream(String)}. */ public static final ModuleAPI getResourceAsStream; @@ -116,13 +111,11 @@ try { getModule = new ModuleAPI(Class.class.getMethod("getModule")); Class<?> moduleClass = getModule.method.getReturnType(); - Class<?> modulesClass = Class.forName("jdk.internal.module.Modules"); getResourceAsStream = new ModuleAPI(moduleClass.getMethod("getResourceAsStream", String.class)); canRead = new ModuleAPI(moduleClass.getMethod("canRead", moduleClass)); isExported = new ModuleAPI(moduleClass.getMethod("isExported", String.class)); isExportedTo = new ModuleAPI(moduleClass.getMethod("isExported", String.class, moduleClass)); - addExports = new ModuleAPI(modulesClass.getDeclaredMethod("addExports", moduleClass, String.class, moduleClass)); - } catch (NoSuchMethodException | SecurityException | ClassNotFoundException e) { + } catch (NoSuchMethodException | SecurityException e) { throw new InternalError(e); } } else { @@ -132,8 +125,6 @@ canRead = unavailable; isExported = unavailable; isExportedTo = unavailable; - addExports = unavailable; } - } }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java Wed Jul 05 23:21:33 2017 +0200 @@ -127,7 +127,7 @@ MetaAccessProvider metaAccess = providers.getMetaAccess(); PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>(); - Plugins plugins = new Plugins(new InvocationPlugins(metaAccess)); + Plugins plugins = new Plugins(new InvocationPlugins()); GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true); graphBuilderSuite.appendPhase(new GraphBuilderPhase(config)); HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/InterfaceMethodHandleTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/InterfaceMethodHandleTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -26,15 +26,14 @@ import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; -import org.junit.Test; - import org.graalvm.compiler.code.CompilationResult; import org.graalvm.compiler.test.ExportingClassLoader; +import org.junit.Test; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.Label; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import jdk.internal.org.objectweb.asm.Opcodes; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.meta.ResolvedJavaMethod;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/OptionsVerifierTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/OptionsVerifierTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -44,19 +44,17 @@ import java.util.ServiceLoader; import java.util.Set; -import org.junit.Test; - import org.graalvm.compiler.options.OptionDescriptor; import org.graalvm.compiler.options.OptionDescriptors; import org.graalvm.compiler.options.OptionValue; import org.graalvm.compiler.test.GraalTest; - -import jdk.internal.org.objectweb.asm.ClassReader; -import jdk.internal.org.objectweb.asm.ClassVisitor; -import jdk.internal.org.objectweb.asm.Label; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import jdk.internal.org.objectweb.asm.Opcodes; -import jdk.internal.org.objectweb.asm.Type; +import org.junit.Test; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; /** * Verifies a class declaring one or more {@linkplain OptionValue options} has a class initializer
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/StaticInterfaceFieldTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/StaticInterfaceFieldTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -83,7 +83,7 @@ MetaAccessProvider metaAccess = providers.getMetaAccess(); PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>(); - Plugins plugins = new Plugins(new InvocationPlugins(metaAccess)); + Plugins plugins = new Plugins(new InvocationPlugins()); GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true); graphBuilderSuite.appendPhase(new GraphBuilderPhase(config)); HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnbalancedMonitorsTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/UnbalancedMonitorsTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -24,10 +24,10 @@ import jdk.vm.ci.code.BailoutException; import jdk.vm.ci.meta.ResolvedJavaMethod; -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.Label; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import jdk.internal.org.objectweb.asm.Opcodes; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; import static org.graalvm.compiler.core.common.CompilationIdentifier.INVALID_COMPILATION_ID; @@ -86,7 +86,7 @@ ResolvedJavaMethod method = getResolvedJavaMethod(LOADER.findClass(INNER_CLASS_NAME), name); try { StructuredGraph graph = new StructuredGraph(method, AllowAssumptions.NO, INVALID_COMPILATION_ID); - Plugins plugins = new Plugins(new InvocationPlugins(getMetaAccess())); + Plugins plugins = new Plugins(new InvocationPlugins()); GraphBuilderConfiguration graphBuilderConfig = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true); OptimisticOptimizations optimisticOpts = OptimisticOptimizations.NONE;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyBailoutUsageTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyBailoutUsageTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -122,7 +122,7 @@ Providers providers = rt.getHostBackend().getProviders(); MetaAccessProvider metaAccess = providers.getMetaAccess(); PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>(); - Plugins plugins = new Plugins(new InvocationPlugins(metaAccess)); + Plugins plugins = new Plugins(new InvocationPlugins()); GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true); graphBuilderSuite.appendPhase(new GraphBuilderPhase(config)); HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyDebugUsageTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyDebugUsageTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -300,7 +300,7 @@ Providers providers = rt.getHostBackend().getProviders(); MetaAccessProvider metaAccess = providers.getMetaAccess(); PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>(); - Plugins plugins = new Plugins(new InvocationPlugins(metaAccess)); + Plugins plugins = new Plugins(new InvocationPlugins()); GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true); graphBuilderSuite.appendPhase(new GraphBuilderPhase(config)); HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyVirtualizableTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyVirtualizableTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -267,7 +267,7 @@ Providers providers = rt.getHostBackend().getProviders(); MetaAccessProvider metaAccess = providers.getMetaAccess(); PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>(); - Plugins plugins = new Plugins(new InvocationPlugins(metaAccess)); + Plugins plugins = new Plugins(new InvocationPlugins()); GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true); graphBuilderSuite.appendPhase(new GraphBuilderPhase(config)); HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/debug/VerifyMethodMetricsTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/debug/VerifyMethodMetricsTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -249,7 +249,7 @@ Providers providers = rt.getHostBackend().getProviders(); MetaAccessProvider metaAccess = providers.getMetaAccess(); PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>(); - Plugins plugins = new Plugins(new InvocationPlugins(metaAccess)); + Plugins plugins = new Plugins(new InvocationPlugins()); GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true); graphBuilderSuite.appendPhase(new GraphBuilderPhase(config)); HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysis.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysis.java Wed Jul 05 23:21:33 2017 +0200 @@ -253,7 +253,7 @@ * the code before static analysis, the classes would otherwise be not loaded * yet and the bytecode parser would only create a graph. */ - Plugins plugins = new Plugins(new InvocationPlugins(metaAccess)); + Plugins plugins = new Plugins(new InvocationPlugins()); GraphBuilderConfiguration graphBuilderConfig = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true); /* * For simplicity, we ignore all exception handling during the static analysis.
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java Wed Jul 05 23:21:33 2017 +0200 @@ -29,15 +29,12 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.stream.Collectors; -import org.junit.Test; - import org.graalvm.compiler.api.test.Graal; import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; @@ -45,12 +42,15 @@ import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin; import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins; +import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Binding; import org.graalvm.compiler.runtime.RuntimeProvider; import org.graalvm.compiler.test.GraalTest; +import org.junit.Test; import jdk.vm.ci.hotspot.HotSpotVMConfigStore; import jdk.vm.ci.hotspot.VMIntrinsicMethod; import jdk.vm.ci.meta.MetaAccessProvider; +import jdk.vm.ci.meta.MetaUtil; import jdk.vm.ci.meta.MethodHandleAccessProvider.IntrinsicMethod; import jdk.vm.ci.meta.ResolvedJavaMethod; @@ -63,11 +63,10 @@ */ public class CheckGraalIntrinsics extends GraalTest { - public static boolean match(ResolvedJavaMethod method, VMIntrinsicMethod intrinsic) { - if (intrinsic.name.equals(method.getName())) { - if (intrinsic.descriptor.equals(method.getSignature().toMethodDescriptor())) { - String declaringClass = method.getDeclaringClass().toClassName().replace('.', '/'); - if (declaringClass.equals(intrinsic.declaringClass)) { + public static boolean match(String type, Binding binding, VMIntrinsicMethod intrinsic) { + if (intrinsic.name.equals(binding.name)) { + if (intrinsic.descriptor.startsWith(binding.argumentsDescriptor)) { + if (type.equals(intrinsic.declaringClass)) { return true; } } @@ -75,16 +74,20 @@ return false; } - private static ResolvedJavaMethod findMethod(Set<ResolvedJavaMethod> methods, VMIntrinsicMethod intrinsic) { - for (ResolvedJavaMethod method : methods) { - if (match(method, intrinsic)) { - return method; + public static InvocationPlugin findPlugin(Map<String, List<Binding>> bindings, VMIntrinsicMethod intrinsic) { + for (Map.Entry<String, List<Binding>> e : bindings.entrySet()) { + // Match format of VMIntrinsicMethod.declaringClass + String type = MetaUtil.internalNameToJava(e.getKey(), true, false).replace('.', '/'); + for (Binding binding : e.getValue()) { + if (match(type, binding, intrinsic)) { + return binding.plugin; + } } } return null; } - private static ResolvedJavaMethod resolveIntrinsic(MetaAccessProvider metaAccess, VMIntrinsicMethod intrinsic) throws ClassNotFoundException { + public static ResolvedJavaMethod resolveIntrinsic(MetaAccessProvider metaAccess, VMIntrinsicMethod intrinsic) throws ClassNotFoundException { Class<?> c = Class.forName(intrinsic.declaringClass.replace('/', '.'), false, CheckGraalIntrinsics.class.getClassLoader()); for (Method javaMethod : c.getDeclaredMethods()) { if (javaMethod.getName().equals(intrinsic.name)) { @@ -425,28 +428,20 @@ public void test() throws ClassNotFoundException { HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class); HotSpotProviders providers = rt.getHostBackend().getProviders(); - Map<ResolvedJavaMethod, Object> impl = new HashMap<>(); Plugins graphBuilderPlugins = providers.getGraphBuilderPlugins(); InvocationPlugins invocationPlugins = graphBuilderPlugins.getInvocationPlugins(); - for (ResolvedJavaMethod method : invocationPlugins.getMethods()) { - InvocationPlugin plugin = invocationPlugins.lookupInvocation(method); - assert plugin != null; - impl.put(method, plugin); - } - Set<ResolvedJavaMethod> methods = invocationPlugins.getMethods(); HotSpotVMConfigStore store = rt.getVMConfig().getStore(); List<VMIntrinsicMethod> intrinsics = store.getIntrinsics(); List<String> missing = new ArrayList<>(); + Map<String, List<Binding>> bindings = invocationPlugins.getBindings(true); for (VMIntrinsicMethod intrinsic : intrinsics) { - ResolvedJavaMethod method = findMethod(methods, intrinsic); - if (method == null) { - method = resolveIntrinsic(providers.getMetaAccess(), intrinsic); - - IntrinsicMethod intrinsicMethod = null; + InvocationPlugin plugin = findPlugin(bindings, intrinsic); + if (plugin == null) { + ResolvedJavaMethod method = resolveIntrinsic(providers.getMetaAccess(), intrinsic); if (method != null) { - intrinsicMethod = providers.getConstantReflection().getMethodHandleAccess().lookupMethodHandleIntrinsic(method); + IntrinsicMethod intrinsicMethod = providers.getConstantReflection().getMethodHandleAccess().lookupMethodHandleIntrinsic(method); if (intrinsicMethod != null) { continue; }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ConstantPoolSubstitutionsTests.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ConstantPoolSubstitutionsTests.java Wed Jul 05 23:21:33 2017 +0200 @@ -39,9 +39,9 @@ import org.junit.BeforeClass; import org.junit.Test; -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import jdk.internal.org.objectweb.asm.Opcodes; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; import jdk.vm.ci.meta.ResolvedJavaMethod; public class ConstantPoolSubstitutionsTests extends GraalCompilerTest implements Opcodes {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/TestIntrinsicCompiles.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/TestIntrinsicCompiles.java Wed Jul 05 23:21:33 2017 +0200 @@ -22,13 +22,12 @@ */ package org.graalvm.compiler.hotspot.test; +import static org.graalvm.compiler.core.common.CompilationIdentifier.INVALID_COMPILATION_ID; + import java.util.List; -import java.util.Set; - -import org.junit.Test; +import java.util.Map; import org.graalvm.compiler.api.test.Graal; -import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.core.test.GraalCompilerTest; import org.graalvm.compiler.hotspot.HotSpotGraalCompiler; import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; @@ -37,8 +36,10 @@ import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin; import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins; +import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Binding; import org.graalvm.compiler.nodes.graphbuilderconf.MethodSubstitutionPlugin; import org.graalvm.compiler.runtime.RuntimeProvider; +import org.junit.Test; import jdk.vm.ci.hotspot.HotSpotVMConfigStore; import jdk.vm.ci.hotspot.VMIntrinsicMethod; @@ -50,46 +51,27 @@ */ public class TestIntrinsicCompiles extends GraalCompilerTest { - private static boolean match(ResolvedJavaMethod method, VMIntrinsicMethod intrinsic) { - if (intrinsic.name.equals(method.getName())) { - if (intrinsic.descriptor.equals(method.getSignature().toMethodDescriptor())) { - String declaringClass = method.getDeclaringClass().toClassName().replace('.', '/'); - if (declaringClass.equals(intrinsic.declaringClass)) { - return true; - } - } - } - return false; - } - - private static ResolvedJavaMethod findMethod(Set<ResolvedJavaMethod> methods, VMIntrinsicMethod intrinsic) { - for (ResolvedJavaMethod method : methods) { - if (match(method, intrinsic)) { - return method; - } - } - return null; - } - @Test @SuppressWarnings("try") - public void test() { + public void test() throws ClassNotFoundException { HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) JVMCI.getRuntime().getCompiler(); HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class); HotSpotProviders providers = rt.getHostBackend().getProviders(); Plugins graphBuilderPlugins = providers.getGraphBuilderPlugins(); InvocationPlugins invocationPlugins = graphBuilderPlugins.getInvocationPlugins(); - Set<ResolvedJavaMethod> pluginMethods = invocationPlugins.getMethods(); + Map<String, List<Binding>> bindings = invocationPlugins.getBindings(true); HotSpotVMConfigStore store = rt.getVMConfig().getStore(); List<VMIntrinsicMethod> intrinsics = store.getIntrinsics(); for (VMIntrinsicMethod intrinsic : intrinsics) { - ResolvedJavaMethod method = findMethod(pluginMethods, intrinsic); - if (method != null) { - InvocationPlugin plugin = invocationPlugins.lookupInvocation(method); - if (plugin instanceof MethodSubstitutionPlugin && !method.isNative()) { - StructuredGraph graph = compiler.getIntrinsicGraph(method, providers, CompilationIdentifier.INVALID_COMPILATION_ID); - getCode(method, graph); + InvocationPlugin plugin = CheckGraalIntrinsics.findPlugin(bindings, intrinsic); + if (plugin != null) { + if (plugin instanceof MethodSubstitutionPlugin) { + ResolvedJavaMethod method = CheckGraalIntrinsics.resolveIntrinsic(getMetaAccess(), intrinsic); + if (!method.isNative()) { + StructuredGraph graph = compiler.getIntrinsicGraph(method, providers, INVALID_COMPILATION_ID); + getCode(method, graph); + } } } }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompileTheWorld.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompileTheWorld.java Wed Jul 05 23:21:33 2017 +0200 @@ -102,7 +102,6 @@ import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.runtime.JVMCI; import jdk.vm.ci.runtime.JVMCICompiler; -import jdk.vm.ci.services.Services; /** * This class implements compile-the-world functionality with JVMCI. @@ -785,7 +784,6 @@ } public static void main(String[] args) throws Throwable { - Services.exportJVMCITo(CompileTheWorld.class); HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) HotSpotJVMCIRuntime.runtime().getCompiler(); compiler.compileTheWorld(); }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompilerFactory.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompilerFactory.java Wed Jul 05 23:21:33 2017 +0200 @@ -22,21 +22,19 @@ */ package org.graalvm.compiler.hotspot; -import static org.graalvm.compiler.core.common.util.Util.Java8OrEarlier; +import static jdk.vm.ci.common.InitTimer.timer; import static org.graalvm.compiler.options.OptionValue.PROFILE_OPTIONVALUE_PROPERTY_NAME; -import static jdk.vm.ci.common.InitTimer.timer; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintStream; -import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; +import java.util.Map.Entry; import java.util.Properties; import java.util.ServiceLoader; -import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.debug.MethodFilter; import org.graalvm.compiler.options.Option; import org.graalvm.compiler.options.OptionDescriptors; @@ -46,10 +44,11 @@ import org.graalvm.compiler.phases.tiers.CompilerConfiguration; import jdk.vm.ci.common.InitTimer; +import jdk.vm.ci.hotspot.HotSpotJVMCICompilerFactory; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.vm.ci.hotspot.HotSpotSignature; -import jdk.vm.ci.hotspot.HotSpotJVMCICompilerFactory; import jdk.vm.ci.runtime.JVMCIRuntime; +import jdk.vm.ci.services.Services; public final class HotSpotGraalCompilerFactory extends HotSpotJVMCICompilerFactory { @@ -135,8 +134,8 @@ if (allOptionsSettings == null) { try (InitTimer t = timer("InitializeOptions")) { ServiceLoader<OptionDescriptors> loader = ServiceLoader.load(OptionDescriptors.class, OptionDescriptors.class.getClassLoader()); - Properties savedProps = getSavedProperties(Java8OrEarlier); - String optionsFile = savedProps.getProperty(GRAAL_OPTIONS_FILE_PROPERTY_NAME); + Map<String, String> savedProps = Services.getSavedProperties(); + String optionsFile = savedProps.get(GRAAL_OPTIONS_FILE_PROPERTY_NAME); if (optionsFile != null) { File graalOptions = new File(optionsFile); @@ -165,15 +164,15 @@ } Map<String, String> optionSettings = new HashMap<>(); - for (Map.Entry<Object, Object> e : savedProps.entrySet()) { - String name = (String) e.getKey(); + for (Entry<String, String> e : savedProps.entrySet()) { + String name = e.getKey(); if (name.startsWith(GRAAL_OPTION_PROPERTY_PREFIX)) { if (name.equals("graal.PrintFlags") || name.equals("graal.ShowFlags")) { System.err.println("The " + name + " option has been removed and will be ignored. Use -XX:+JVMCIPrintProperties instead."); } else if (name.equals(GRAAL_OPTIONS_FILE_PROPERTY_NAME) || name.equals(GRAAL_VERSION_PROPERTY_NAME) || name.equals(PROFILE_OPTIONVALUE_PROPERTY_NAME)) { // Ignore well known properties that do not denote an option } else { - String value = (String) e.getValue(); + String value = e.getValue(); optionSettings.put(name.substring(GRAAL_OPTION_PROPERTY_PREFIX.length()), value); } } @@ -206,18 +205,6 @@ } } - private static Properties getSavedProperties(boolean jdk8OrEarlier) { - try { - String vmClassName = jdk8OrEarlier ? "sun.misc.VM" : "jdk.internal.misc.VM"; - Class<?> vmClass = Class.forName(vmClassName); - Field savedPropsField = vmClass.getDeclaredField("savedProps"); - savedPropsField.setAccessible(true); - return (Properties) savedPropsField.get(null); - } catch (Exception e) { - throw new GraalError(e); - } - } - @Override public HotSpotGraalCompiler createCompiler(JVMCIRuntime runtime) { HotSpotGraalCompiler compiler = createCompiler(runtime, CompilerConfigurationFactory.selectFactory(null));
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalJVMCIServiceLocator.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalJVMCIServiceLocator.java Wed Jul 05 23:21:33 2017 +0200 @@ -22,10 +22,6 @@ */ package org.graalvm.compiler.hotspot; -import static org.graalvm.compiler.core.common.util.ModuleAPI.addExports; -import static org.graalvm.compiler.core.common.util.ModuleAPI.getModule; -import static org.graalvm.compiler.core.common.util.Util.JAVA_SPECIFICATION_VERSION; - import org.graalvm.compiler.serviceprovider.ServiceProvider; import jdk.vm.ci.hotspot.HotSpotVMEventListener; @@ -35,43 +31,45 @@ @ServiceProvider(JVMCIServiceLocator.class) public final class HotSpotGraalJVMCIServiceLocator extends JVMCIServiceLocator { - private boolean exportsAdded; - /** - * Dynamically exports various internal JDK packages to the Graal module. This requires only - * {@code --add-exports=java.base/jdk.internal.module=org.graalvm.compiler.graal_core} on the VM - * command line instead of a {@code --add-exports} instance for each JDK internal package used - * by Graal. + * Holds the state shared between all {@link HotSpotGraalJVMCIServiceLocator} instances. This is + * necessary as a service provider instance is created each time the service is loaded. */ - private void addExports() { - if (JAVA_SPECIFICATION_VERSION >= 9 && !exportsAdded) { - Object javaBaseModule = getModule.invoke(String.class); - Object graalModule = getModule.invoke(getClass()); - addExports.invokeStatic(javaBaseModule, "jdk.internal.misc", graalModule); - addExports.invokeStatic(javaBaseModule, "jdk.internal.jimage", graalModule); - addExports.invokeStatic(javaBaseModule, "com.sun.crypto.provider", graalModule); - exportsAdded = true; + private static final class Shared { + static final Shared SINGLETON = new Shared(); + + <T> T getProvider(Class<T> service, HotSpotGraalJVMCIServiceLocator locator) { + if (service == JVMCICompilerFactory.class) { + return service.cast(new HotSpotGraalCompilerFactory(locator)); + } else if (service == HotSpotVMEventListener.class) { + if (graalRuntime != null) { + return service.cast(new HotSpotGraalVMEventListener(graalRuntime)); + } + } + return null; + } + + private HotSpotGraalRuntime graalRuntime; + + /** + * Notifies this object of the compiler created via {@link HotSpotGraalJVMCIServiceLocator}. + */ + void onCompilerCreation(HotSpotGraalCompiler compiler) { + assert this.graalRuntime == null : "only expect a single JVMCICompiler to be created"; + this.graalRuntime = (HotSpotGraalRuntime) compiler.getGraalRuntime(); } } - private HotSpotGraalRuntime graalRuntime; - @Override public <T> T getProvider(Class<T> service) { - if (service == JVMCICompilerFactory.class) { - addExports(); - return service.cast(new HotSpotGraalCompilerFactory(this)); - } else if (service == HotSpotVMEventListener.class) { - if (graalRuntime != null) { - addExports(); - return service.cast(new HotSpotGraalVMEventListener(graalRuntime)); - } - } - return null; + return Shared.SINGLETON.getProvider(service, this); } - public void onCompilerCreation(HotSpotGraalCompiler compiler) { - assert this.graalRuntime == null : "only expect a single JVMCICompiler to be created"; - this.graalRuntime = (HotSpotGraalRuntime) compiler.getGraalRuntime(); + /** + * Notifies this object of the compiler created via {@link HotSpotGraalJVMCIServiceLocator}. + */ + @SuppressWarnings("static-method") + void onCompilerCreation(HotSpotGraalCompiler compiler) { + Shared.SINGLETON.onCompilerCreation(compiler); } }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java Wed Jul 05 23:21:33 2017 +0200 @@ -128,7 +128,7 @@ */ public static Plugins create(GraalHotSpotVMConfig config, HotSpotWordTypes wordTypes, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, SnippetReflectionProvider snippetReflection, ForeignCallsProvider foreignCalls, StampProvider stampProvider, ReplacementsImpl replacements) { - InvocationPlugins invocationPlugins = new HotSpotInvocationPlugins(config, metaAccess); + InvocationPlugins invocationPlugins = new HotSpotInvocationPlugins(config); Plugins plugins = new Plugins(invocationPlugins); NodeIntrinsificationProvider nodeIntrinsificationProvider = new NodeIntrinsificationProvider(metaAccess, snippetReflection, foreignCalls, wordTypes);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotInvocationPlugins.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotInvocationPlugins.java Wed Jul 05 23:21:33 2017 +0200 @@ -38,7 +38,6 @@ import org.graalvm.compiler.replacements.nodes.MacroNode; import jdk.vm.ci.meta.JavaKind; -import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaType; /** @@ -47,8 +46,7 @@ final class HotSpotInvocationPlugins extends InvocationPlugins { final GraalHotSpotVMConfig config; - HotSpotInvocationPlugins(GraalHotSpotVMConfig config, MetaAccessProvider metaAccess) { - super(metaAccess); + HotSpotInvocationPlugins(GraalHotSpotVMConfig config) { this.config = config; }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/AESCryptSubstitutions.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/AESCryptSubstitutions.java Wed Jul 05 23:21:33 2017 +0200 @@ -29,8 +29,6 @@ import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset; -import java.lang.reflect.Field; - import org.graalvm.compiler.api.replacements.ClassSubstitution; import org.graalvm.compiler.api.replacements.MethodSubstitution; import org.graalvm.compiler.core.common.LocationIdentity; @@ -61,7 +59,7 @@ static final long kOffset; static final long lastKeyOffset; static final Class<?> AESCryptClass; - static final int AES_BLOCK_SIZE; + static final int AES_BLOCK_SIZE_IN_BYTES; static { try { @@ -72,9 +70,9 @@ AESCryptClass = Class.forName("com.sun.crypto.provider.AESCrypt", true, cl); kOffset = UnsafeAccess.UNSAFE.objectFieldOffset(AESCryptClass.getDeclaredField("K")); lastKeyOffset = UnsafeAccess.UNSAFE.objectFieldOffset(AESCryptClass.getDeclaredField("lastKey")); - Field aesBlockSizeField = Class.forName("com.sun.crypto.provider.AESConstants", true, cl).getDeclaredField("AES_BLOCK_SIZE"); - aesBlockSizeField.setAccessible(true); - AES_BLOCK_SIZE = aesBlockSizeField.getInt(null); + // Thankfully the AES block size is a constant (128 bits) and so we don't need to + // reflect on com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE. + AES_BLOCK_SIZE_IN_BYTES = 16; } catch (Exception ex) { throw new GraalError(ex); } @@ -141,7 +139,7 @@ * Perform null and array bounds checks for arguments to a cipher operation. */ static void checkArgs(byte[] in, int inOffset, byte[] out, int outOffset) { - if (probability(VERY_SLOW_PATH_PROBABILITY, inOffset < 0 || in.length - AES_BLOCK_SIZE < inOffset || outOffset < 0 || out.length - AES_BLOCK_SIZE < outOffset)) { + if (probability(VERY_SLOW_PATH_PROBABILITY, inOffset < 0 || in.length - AES_BLOCK_SIZE_IN_BYTES < inOffset || outOffset < 0 || out.length - AES_BLOCK_SIZE_IN_BYTES < outOffset)) { DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint); } }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CRC32Substitutions.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CRC32Substitutions.java Wed Jul 05 23:21:33 2017 +0200 @@ -57,7 +57,7 @@ return config.crcTableAddress; } - @MethodSubstitution + @MethodSubstitution(optional = true) static int update(int crc, int b) { final long crcTableRawAddress = GraalHotSpotVMConfigNode.crcTableAddress(); @@ -69,7 +69,7 @@ return ~result; } - @MethodSubstitution + @MethodSubstitution(optional = true) static int updateBytes(int crc, byte[] buf, int off, int len) { Word bufAddr = Word.unsigned(ComputeObjectAddressNode.get(buf, arrayBaseOffset(JavaKind.Byte) + off)); return updateBytesCRC32(UPDATE_BYTES_CRC32, crc, bufAddr, len); @@ -84,7 +84,7 @@ return updateBytesCRC32(UPDATE_BYTES_CRC32, crc, bufAddr, len); } - @MethodSubstitution + @MethodSubstitution(optional = true) static int updateByteBuffer(int crc, long addr, int off, int len) { Word bufAddr = Word.unsigned(addr).add(off); return updateBytesCRC32(UPDATE_BYTES_CRC32, crc, bufAddr, len);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/ThreadSubstitutions.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/ThreadSubstitutions.java Wed Jul 05 23:21:33 2017 +0200 @@ -45,7 +45,7 @@ @ClassSubstitution(Thread.class) public class ThreadSubstitutions { - @MethodSubstitution(isStatic = false) + @MethodSubstitution(isStatic = false, optional = true) public static boolean isInterrupted(final Thread thisObject, boolean clearInterrupted) { Word javaThread = CurrentJavaThreadNode.get(); Object thread = javaThread.readObject(threadObjectOffset(INJECTED_VMCONFIG), JAVA_THREAD_THREAD_OBJECT_LOCATION);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/InvocationPlugin.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/InvocationPlugin.java Wed Jul 05 23:21:33 2017 +0200 @@ -40,8 +40,7 @@ /** * The receiver in a non-static method. The class literal for this interface must be used with - * {@link InvocationPlugins#put(InvocationPlugin, boolean, boolean, boolean, Class, String, Class...)} - * to denote the receiver argument for such a non-static method. + * {@link InvocationPlugins#put} to denote the receiver argument for such a non-static method. */ public interface Receiver { /**
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/InvocationPlugins.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/InvocationPlugins.java Wed Jul 05 23:21:33 2017 +0200 @@ -23,8 +23,9 @@ package org.graalvm.compiler.nodes.graphbuilderconf; import static java.lang.String.format; +import static org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.LateClassPlugins.CLOSED_LATE_CLASS_PLUGIN; -import java.lang.reflect.Executable; +import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Type; @@ -32,10 +33,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import org.graalvm.compiler.api.replacements.MethodSubstitution; import org.graalvm.compiler.api.replacements.MethodSubstitutionRegistry; @@ -46,12 +45,24 @@ import org.graalvm.compiler.nodes.ValueNode; import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver; -import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.MetaUtil; import jdk.vm.ci.meta.ResolvedJavaMethod; +import jdk.vm.ci.meta.ResolvedJavaType; +import jdk.vm.ci.meta.Signature; /** * Manages a set of {@link InvocationPlugin}s. + * + * Most plugins are registered during initialization (i.e., before + * {@link #lookupInvocation(ResolvedJavaMethod)} or {@link #getBindings} is called). These + * registrations can be made with {@link Registration}, + * {@link #register(InvocationPlugin, String, String, Type...)}, + * {@link #register(InvocationPlugin, Type, String, Type...)} or + * {@link #registerOptional(InvocationPlugin, Type, String, Type...)}. Initialization is not + * thread-safe and so must only be performed by a single thread. + * + * Plugins that are not guaranteed to be made during initialization must use + * {@link LateRegistration}. */ public class InvocationPlugins { @@ -260,6 +271,26 @@ } /** + * Registers a plugin for a method with 6 arguments. + * + * @param name the name of the method + * @param plugin the plugin to be registered + */ + public void register6(String name, Type arg1, Type arg2, Type arg3, Type arg4, Type arg5, Type arg6, InvocationPlugin plugin) { + plugins.register(plugin, false, allowOverwrite, declaringType, name, arg1, arg2, arg3, arg4, arg5, arg6); + } + + /** + * Registers a plugin for a method with 7 arguments. + * + * @param name the name of the method + * @param plugin the plugin to be registered + */ + public void register7(String name, Type arg1, Type arg2, Type arg3, Type arg4, Type arg5, Type arg6, Type arg7, InvocationPlugin plugin) { + plugins.register(plugin, false, allowOverwrite, declaringType, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7); + } + + /** * Registers a plugin for an optional method with no arguments. * * @param name the name of the method @@ -337,168 +368,151 @@ */ @Override public void registerMethodSubstitution(Class<?> substituteDeclaringClass, String name, String substituteName, Type... argumentTypes) { + MethodSubstitutionPlugin plugin = createMethodSubstitution(substituteDeclaringClass, substituteName, argumentTypes); + plugins.register(plugin, false, allowOverwrite, declaringType, name, argumentTypes); + } + + public MethodSubstitutionPlugin createMethodSubstitution(Class<?> substituteDeclaringClass, String substituteName, Type... argumentTypes) { assert methodSubstitutionBytecodeProvider != null : "Registration used for method substitutions requires a non-null methodSubstitutionBytecodeProvider"; MethodSubstitutionPlugin plugin = new MethodSubstitutionPlugin(methodSubstitutionBytecodeProvider, substituteDeclaringClass, substituteName, argumentTypes); - plugins.register(plugin, false, allowOverwrite, declaringType, name, argumentTypes); + return plugin; } + } /** - * Key for a {@linkplain ClassPlugins#entries resolved} plugin registration. Due to the - * possibility of class redefinition, we cannot directly use {@link ResolvedJavaMethod}s as - * keys. A {@link ResolvedJavaMethod} implementation might implement {@code equals()} and - * {@code hashCode()} based on internal representation subject to change by class redefinition. + * Utility for registering plugins after Graal may have been initialized. Registrations made via + * this class are not finalized until {@link #close} is called. */ - static final class ResolvedJavaMethodKey { - private final ResolvedJavaMethod method; + public static class LateRegistration implements AutoCloseable { + + private InvocationPlugins plugins; + private final List<Binding> bindings = new ArrayList<>(); + private final Type declaringType; + + /** + * Creates an object for registering {@link InvocationPlugin}s for methods declared by a + * given class. + * + * @param plugins where to register the plugins + * @param declaringType the class declaring the methods for which plugins will be registered + * via this object + */ + public LateRegistration(InvocationPlugins plugins, Type declaringType) { + this.plugins = plugins; + this.declaringType = declaringType; + } - ResolvedJavaMethodKey(ResolvedJavaMethod method) { - this.method = method; + /** + * Registers an invocation plugin for a given method. There must be no plugin currently + * registered for {@code method}. + * + * @param argumentTypes the argument types of the method. Element 0 of this array must be + * the {@link Class} value for {@link InvocationPlugin.Receiver} iff the method + * is non-static. Upon returning, element 0 will have been rewritten to + * {@code declaringClass} + */ + public void register(InvocationPlugin plugin, String name, Type... argumentTypes) { + boolean isStatic = argumentTypes.length == 0 || argumentTypes[0] != InvocationPlugin.Receiver.class; + if (!isStatic) { + argumentTypes[0] = declaringType; + } + + assert isStatic || argumentTypes[0] == declaringType; + Binding binding = new Binding(plugin, isStatic, name, argumentTypes); + bindings.add(binding); + + assert Checks.check(this.plugins, declaringType, binding); + assert Checks.checkResolvable(false, declaringType, binding); } @Override - public boolean equals(Object obj) { - if (obj instanceof ResolvedJavaMethodKey) { - ResolvedJavaMethodKey that = (ResolvedJavaMethodKey) obj; - if (this.method.isStatic() == that.method.isStatic()) { - if (this.method.getDeclaringClass().equals(that.method.getDeclaringClass())) { - if (this.method.getName().equals(that.method.getName())) { - if (this.method.getSignature().equals(that.method.getSignature())) { - return true; - } - } - } - } - } - return false; - } - - @Override - public int hashCode() { - return this.method.getName().hashCode(); - } - - @Override - public String toString() { - return "ResolvedJavaMethodKey<" + method + ">"; + public void close() { + assert plugins != null : String.format("Late registrations of invocation plugins for %s is already closed", declaringType); + plugins.registerLate(declaringType, bindings); + plugins = null; } } /** - * Key for {@linkplain ClassPlugins#registrations registering} an {@link InvocationPlugin} for a - * specific method. + * Associates an {@link InvocationPlugin} with the details of a method it substitutes. */ - static class MethodKey { - final boolean isStatic; + public static class Binding { + /** + * The plugin this binding is for. + */ + public final InvocationPlugin plugin; /** - * This method is optional. This is used for new API methods not present in previous JDK - * versions. + * Specifies if the associated method is static. */ - final boolean isOptional; + public final boolean isStatic; - final String name; - final Type[] argumentTypes; - final InvocationPlugin value; + /** + * The name of the associated method. + */ + public final String name; /** - * Used to lazily initialize {@link #resolved}. + * A partial + * <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method + * descriptor</a> for the associated method. The descriptor includes enclosing {@code '('} + * and {@code ')'} characters but omits the return type suffix. */ - private final MetaAccessProvider metaAccess; - - private volatile ResolvedJavaMethod resolved; + public final String argumentsDescriptor; - MethodKey(MetaAccessProvider metaAccess, InvocationPlugin data, boolean isStatic, boolean isOptional, String name, Type... argumentTypes) { - this.metaAccess = metaAccess; - this.value = data; + /** + * Link in a list of bindings. + */ + private Binding next; + + Binding(InvocationPlugin data, boolean isStatic, String name, Type... argumentTypes) { + this.plugin = data; this.isStatic = isStatic; - this.isOptional = isOptional; this.name = name; - this.argumentTypes = argumentTypes; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof MethodKey) { - MethodKey that = (MethodKey) obj; - boolean res = this.name.equals(that.name) && areEqual(this.argumentTypes, that.argumentTypes); - assert !res || this.isStatic == that.isStatic; - return res; + StringBuilder buf = new StringBuilder(); + buf.append('('); + for (int i = isStatic ? 0 : 1; i < argumentTypes.length; i++) { + buf.append(MetaUtil.toInternalName(argumentTypes[i].getTypeName())); } - return false; + buf.append(')'); + this.argumentsDescriptor = buf.toString(); + assert !name.equals("<init>") || !isStatic : this; } - private static boolean areEqual(Type[] args1, Type[] args2) { - if (args1.length == args2.length) { - for (int i = 0; i < args1.length; i++) { - if (!args1[i].getTypeName().equals(args2[i].getTypeName())) { - return false; - } - } - return true; - } - return false; - } - - public int getDeclaredParameterCount() { - return isStatic ? argumentTypes.length : argumentTypes.length - 1; - } - - @Override - public int hashCode() { - return name.hashCode(); - } - - private ResolvedJavaMethod resolve(Class<?> declaringClass) { - if (resolved == null) { - Executable method = resolveJava(declaringClass); - if (method == null) { - return null; - } - resolved = metaAccess.lookupJavaMethod(method); - } - return resolved; - } - - private Executable resolveJava(Class<?> declaringClass) { - try { - Executable res; - Class<?>[] parameterTypes = resolveTypes(argumentTypes, isStatic ? 0 : 1, argumentTypes.length); - if (name.equals("<init>")) { - res = declaringClass.getDeclaredConstructor(parameterTypes); - } else { - res = declaringClass.getDeclaredMethod(name, parameterTypes); - } - assert Modifier.isStatic(res.getModifiers()) == isStatic : res; - return res; - } catch (NoSuchMethodException | SecurityException e) { - if (isOptional) { - return null; - } - throw new InternalError(e); - } + Binding(ResolvedJavaMethod resolved, InvocationPlugin data) { + this.plugin = data; + this.isStatic = resolved.isStatic(); + this.name = resolved.getName(); + Signature sig = resolved.getSignature(); + String desc = sig.toMethodDescriptor(); + assert desc.indexOf(')') != -1 : desc; + this.argumentsDescriptor = desc.substring(0, desc.indexOf(')') + 1); + assert !name.equals("<init>") || !isStatic : this; } @Override public String toString() { - StringBuilder sb = new StringBuilder(name).append('('); - for (Type p : argumentTypes) { - if (sb.charAt(sb.length() - 1) != '(') { - sb.append(", "); - } - sb.append(p.getTypeName()); - } - return sb.append(')').toString(); + return name + argumentsDescriptor; } } - private final MetaAccessProvider metaAccess; - - private final Map<String, ClassPlugins> registrations = new HashMap<>(); + /** + * Plugin registrations for already resolved methods. If non-null, then {@link #registrations} + * is null and no further registrations can be made. + */ + private final Map<ResolvedJavaMethod, InvocationPlugin> resolvedRegistrations; /** - * Deferred registrations as well as guard for initialization. The guard uses double-checked - * locking which is why this field is {@code volatile}. + * Map from class names in {@linkplain MetaUtil#toInternalName(String) internal} form to the + * invocation plugin bindings for the class. Tf non-null, then {@link #resolvedRegistrations} + * will be null. + */ + private final Map<String, ClassPlugins> registrations; + + /** + * Deferred registrations as well as the guard for delimiting the initial registration phase. + * The guard uses double-checked locking which is why this field is {@code volatile}. */ private volatile List<Runnable> deferredRegistrations = new ArrayList<>(); @@ -512,119 +526,159 @@ } /** - * Per-class invocation plugins. + * Support for registering plugins once this object may be accessed by multiple threads. + */ + private volatile LateClassPlugins lateRegistrations; + + /** + * Per-class bindings. */ - protected static class ClassPlugins { - private final Type declaringType; + static class ClassPlugins { + + /** + * Maps method names to binding lists. + */ + private final Map<String, Binding> bindings = new HashMap<>(); - private final List<MethodKey> registrations = new ArrayList<>(); + /** + * Gets the invocation plugin for a given method. + * + * @return the invocation plugin for {@code method} or {@code null} + */ + InvocationPlugin get(ResolvedJavaMethod method) { + assert !method.isBridge(); + Binding binding = bindings.get(method.getName()); + while (binding != null) { + if (method.isStatic() == binding.isStatic) { + if (method.getSignature().toMethodDescriptor().startsWith(binding.argumentsDescriptor)) { + return binding.plugin; + } + } + binding = binding.next; + } + return null; + } - public ClassPlugins(Type declaringClass) { - this.declaringType = declaringClass; + public void register(Binding binding, boolean allowOverwrite) { + if (allowOverwrite) { + if (lookup(binding) != null) { + register(binding); + return; + } + } else { + assert lookup(binding) == null : "a value is already registered for " + binding; + } + register(binding); + } + + InvocationPlugin lookup(Binding binding) { + Binding b = bindings.get(binding.name); + while (b != null) { + if (b.isStatic == binding.isStatic && b.argumentsDescriptor.equals(binding.argumentsDescriptor)) { + return b.plugin; + } + b = b.next; + } + return null; } /** - * Entry map that is initialized upon first call to {@link #get(ResolvedJavaMethod)}. - * - * Note: this must be volatile as threads may race to initialize it. + * Registers {@code binding}. */ - private volatile Map<ResolvedJavaMethodKey, InvocationPlugin> entries; + void register(Binding binding) { + Binding head = bindings.get(binding.name); + assert binding.next == null; + binding.next = head; + bindings.put(binding.name, binding); + } + } - void initializeMap() { - if (!isClosed()) { - if (registrations.isEmpty()) { - entries = Collections.emptyMap(); - } else { - Class<?> declaringClass = resolveType(declaringType, true); - if (declaringClass == null) { - // An optional type that could not be resolved - entries = Collections.emptyMap(); - } else { - Map<ResolvedJavaMethodKey, InvocationPlugin> newEntries = new HashMap<>(); - for (MethodKey methodKey : registrations) { - ResolvedJavaMethod m = methodKey.resolve(declaringClass); - if (m != null) { - newEntries.put(new ResolvedJavaMethodKey(m), methodKey.value); - if (entries != null) { - // Another thread finished initializing entries first - return; - } - } - } - entries = newEntries; - } - } - } - } + static class LateClassPlugins extends ClassPlugins { + static final String CLOSED_LATE_CLASS_PLUGIN = "-----"; + private final String className; + private final LateClassPlugins next; - public InvocationPlugin get(ResolvedJavaMethod method) { - if (!isClosed()) { - initializeMap(); - } - return entries.get(new ResolvedJavaMethodKey(method)); - } - - public void register(MethodKey methodKey, boolean allowOverwrite) { - assert !isClosed() : "registration is closed: " + methodKey + " " + Arrays.toString(entries.keySet().toArray()); - if (allowOverwrite) { - int index = registrations.indexOf(methodKey); - if (index >= 0) { - registrations.set(index, methodKey); - return; - } - } else { - assert !registrations.contains(methodKey) : "a value is already registered for " + declaringType + "." + methodKey; - } - registrations.add(methodKey); - } - - public boolean isClosed() { - return entries != null; + LateClassPlugins(LateClassPlugins next, String className) { + assert next == null || next.className != CLOSED_LATE_CLASS_PLUGIN : "Late registration of invocation plugins is closed"; + this.next = next; + this.className = className; } } /** - * Adds an entry to this map for a specified method. + * Registers a binding of a method to an invocation plugin. * - * @param value value to be associated with the specified method + * @param plugin invocation plugin to be associated with the specified method * @param isStatic specifies if the method is static - * @param isOptional specifies if the method is optional * @param declaringClass the class declaring the method * @param name the name of the method * @param argumentTypes the argument types of the method. Element 0 of this array must be * {@code declaringClass} iff the method is non-static. * @return an object representing the method */ - MethodKey put(InvocationPlugin value, boolean isStatic, boolean isOptional, boolean allowOverwrite, Type declaringClass, String name, Type... argumentTypes) { + Binding put(InvocationPlugin plugin, boolean isStatic, boolean allowOverwrite, Type declaringClass, String name, Type... argumentTypes) { + assert resolvedRegistrations == null : "registration is closed"; + String internalName = MetaUtil.toInternalName(declaringClass.getTypeName()); assert isStatic || argumentTypes[0] == declaringClass; + assert deferredRegistrations != null : "initial registration is closed - use " + LateRegistration.class.getName() + " for late registrations"; - String internalName = MetaUtil.toInternalName(declaringClass.getTypeName()); ClassPlugins classPlugins = registrations.get(internalName); if (classPlugins == null) { - classPlugins = new ClassPlugins(declaringClass); + classPlugins = new ClassPlugins(); registrations.put(internalName, classPlugins); } - assert isStatic || argumentTypes[0] == declaringClass; - MethodKey methodKey = new MethodKey(metaAccess, value, isStatic, isOptional, name, argumentTypes); - classPlugins.register(methodKey, allowOverwrite); - return methodKey; + Binding binding = new Binding(plugin, isStatic, name, argumentTypes); + classPlugins.register(binding, allowOverwrite); + return binding; + } + + InvocationPlugin get(ResolvedJavaMethod method) { + if (resolvedRegistrations != null) { + return resolvedRegistrations.get(method); + } else { + if (!method.isBridge()) { + ResolvedJavaType declaringClass = method.getDeclaringClass(); + flushDeferrables(); + String internalName = declaringClass.getName(); + ClassPlugins classPlugins = registrations.get(internalName); + InvocationPlugin res = null; + if (classPlugins != null) { + res = classPlugins.get(method); + } + if (res == null) { + LateClassPlugins lcp = findLateClassPlugins(internalName); + if (lcp != null) { + res = lcp.get(method); + } + } + if (res != null) { + if (canBeIntrinsified(declaringClass)) { + return res; + } + } + } else { + // Supporting plugins for bridge methods would require including + // the return type in the registered signature. Until needed, + // this extra complexity is best avoided. + } + } + return null; } /** - * Determines if a method denoted by a given {@link MethodKey} is in this map. + * Determines if methods in a given class can have invocation plugins. + * + * @param declaringClass the class to test */ - boolean containsKey(Type declaringType, MethodKey key) { - String internalName = MetaUtil.toInternalName(declaringType.getTypeName()); - ClassPlugins classPlugins = registrations.get(internalName); - return classPlugins != null && classPlugins.registrations.contains(key); + protected boolean canBeIntrinsified(ResolvedJavaType declaringClass) { + return true; } - InvocationPlugin get(ResolvedJavaMethod method) { - flushDeferrables(); - String internalName = method.getDeclaringClass().getName(); - ClassPlugins classPlugins = registrations.get(internalName); - if (classPlugins != null) { - return classPlugins.get(method); + LateClassPlugins findLateClassPlugins(String internalClassName) { + for (LateClassPlugins lcp = lateRegistrations; lcp != null; lcp = lcp.next) { + if (lcp.className.equals(internalClassName)) { + return lcp; + } } return null; } @@ -639,25 +693,39 @@ deferredRegistrations = null; } } - for (Map.Entry<String, ClassPlugins> e : registrations.entrySet()) { - e.getValue().initializeMap(); - } } } + synchronized void registerLate(Type declaringType, List<Binding> bindings) { + String internalName = MetaUtil.toInternalName(declaringType.getTypeName()); + assert findLateClassPlugins(internalName) == null : "Cannot have more than one late registration of invocation plugins for " + internalName; + LateClassPlugins lateClassPlugins = new LateClassPlugins(lateRegistrations, internalName); + for (Binding b : bindings) { + lateClassPlugins.register(b); + } + lateRegistrations = lateClassPlugins; + } + + private synchronized boolean closeLateRegistrations() { + if (lateRegistrations == null || lateRegistrations.className != CLOSED_LATE_CLASS_PLUGIN) { + lateRegistrations = new LateClassPlugins(lateRegistrations, CLOSED_LATE_CLASS_PLUGIN); + } + return true; + } + /** - * Disallows new registrations of new plugins, and creates the internal tables for method - * lookup. + * Processes deferred registrations and then closes this object for future registration. */ public void closeRegistration() { + assert closeLateRegistrations(); flushDeferrables(); - for (Map.Entry<String, ClassPlugins> e : registrations.entrySet()) { - e.getValue().initializeMap(); - } } - public int size() { - return registrations.size(); + public boolean isEmpty() { + if (resolvedRegistrations != null) { + return resolvedRegistrations.isEmpty(); + } + return registrations.size() == 0 && lateRegistrations == null; } /** @@ -666,47 +734,39 @@ */ protected final InvocationPlugins parent; - private InvocationPlugins(InvocationPlugins parent, MetaAccessProvider metaAccess) { - this.metaAccess = metaAccess; - InvocationPlugins p = parent; - this.parent = p; + /** + * Creates a set of invocation plugins with no parent. + */ + public InvocationPlugins() { + this(null); } /** - * Creates a set of invocation plugins with a non-null {@linkplain #getParent() parent}. + * Creates a set of invocation plugins. + * + * @param parent if non-null, this object will be searched first when looking up plugins */ public InvocationPlugins(InvocationPlugins parent) { - this(parent, parent.getMetaAccess()); + InvocationPlugins p = parent; + this.parent = p; + this.registrations = new HashMap<>(); + this.resolvedRegistrations = null; } - public InvocationPlugins(Map<ResolvedJavaMethod, InvocationPlugin> plugins, InvocationPlugins parent, MetaAccessProvider metaAccess) { - this.metaAccess = metaAccess; + /** + * Creates a closed set of invocation plugins for a set of resolved methods. Such an object + * cannot have further plugins registered. + */ + public InvocationPlugins(Map<ResolvedJavaMethod, InvocationPlugin> plugins, InvocationPlugins parent) { this.parent = parent; - + this.registrations = null; this.deferredRegistrations = null; + Map<ResolvedJavaMethod, InvocationPlugin> map = new HashMap<>(plugins.size()); for (Map.Entry<ResolvedJavaMethod, InvocationPlugin> entry : plugins.entrySet()) { - ResolvedJavaMethod method = entry.getKey(); - InvocationPlugin plugin = entry.getValue(); - - String internalName = method.getDeclaringClass().getName(); - ClassPlugins classPlugins = registrations.get(internalName); - if (classPlugins == null) { - classPlugins = new ClassPlugins(null); - registrations.put(internalName, classPlugins); - classPlugins.entries = new HashMap<>(); - } - - classPlugins.entries.put(new ResolvedJavaMethodKey(method), plugin); + map.put(entry.getKey(), entry.getValue()); } - } - - public MetaAccessProvider getMetaAccess() { - return metaAccess; - } - - public InvocationPlugins(MetaAccessProvider metaAccess) { - this(null, metaAccess); + this.resolvedRegistrations = map; } protected void register(InvocationPlugin plugin, boolean isOptional, boolean allowOverwrite, Type declaringClass, String name, Type... argumentTypes) { @@ -714,8 +774,9 @@ if (!isStatic) { argumentTypes[0] = declaringClass; } - MethodKey methodKey = put(plugin, isStatic, isOptional, allowOverwrite, declaringClass, name, argumentTypes); - assert Checker.check(this, declaringClass, methodKey, plugin); + Binding binding = put(plugin, isStatic, allowOverwrite, declaringClass, name, argumentTypes); + assert Checks.check(this, declaringClass, binding); + assert Checks.checkResolvable(isOptional, declaringClass, binding); } /** @@ -765,23 +826,56 @@ } /** - * Gets the set of methods for which invocation plugins have been registered. Once this method - * is called, no further registrations can be made. + * Gets the set of registered invocation plugins. + * + * @return a map from class names in {@linkplain MetaUtil#toInternalName(String) internal} form + * to the invocation plugin bindings for methods in the class */ - public Set<ResolvedJavaMethod> getMethods() { - Set<ResolvedJavaMethod> res = new HashSet<>(); - if (parent != null) { - res.addAll(parent.getMethods()); + public Map<String, List<Binding>> getBindings(boolean includeParents) { + Map<String, List<Binding>> res = new HashMap<>(); + if (parent != null && includeParents) { + res.putAll(parent.getBindings(true)); } - flushDeferrables(); - for (ClassPlugins cp : registrations.values()) { - for (ResolvedJavaMethodKey key : cp.entries.keySet()) { - res.add(key.method); + if (resolvedRegistrations != null) { + for (Map.Entry<ResolvedJavaMethod, InvocationPlugin> e : resolvedRegistrations.entrySet()) { + ResolvedJavaMethod method = e.getKey(); + InvocationPlugin plugin = e.getValue(); + String type = method.getDeclaringClass().getName(); + List<Binding> bindings = res.get(type); + if (bindings == null) { + bindings = new ArrayList<>(); + res.put(type, bindings); + } + bindings.add(new Binding(method, plugin)); + } + } else { + flushDeferrables(); + for (Map.Entry<String, ClassPlugins> e : registrations.entrySet()) { + String type = e.getKey(); + ClassPlugins cp = e.getValue(); + collectBindingsTo(res, type, cp); + } + for (LateClassPlugins lcp = lateRegistrations; lcp != null; lcp = lcp.next) { + String type = lcp.className; + collectBindingsTo(res, type, lcp); } } return res; } + private static void collectBindingsTo(Map<String, List<Binding>> res, String type, ClassPlugins cp) { + for (Map.Entry<String, Binding> e : cp.bindings.entrySet()) { + List<Binding> bindings = res.get(type); + if (bindings == null) { + bindings = new ArrayList<>(); + res.put(type, bindings); + } + for (Binding b = e.getValue(); b != null; b = b.next) { + bindings.add(b); + } + } + } + /** * Gets the invocation plugins {@linkplain #lookupInvocation(ResolvedJavaMethod) searched} * before searching in this object. @@ -792,17 +886,36 @@ @Override public String toString() { + List<String> all = new ArrayList<>(); + for (Map.Entry<String, List<Binding>> e : getBindings(false).entrySet()) { + String c = MetaUtil.internalNameToJava(e.getKey(), true, false); + for (Binding b : e.getValue()) { + all.add(c + '.' + b); + } + } + Collections.sort(all); StringBuilder buf = new StringBuilder(); - registrations.forEach((name, cp) -> buf.append(name).append('.').append(cp).append(", ")); - String s = buf.toString(); - if (buf.length() != 0) { - s = s.substring(buf.length() - ", ".length()); + String nl = String.format("%n"); + for (String s : all) { + if (buf.length() != 0) { + buf.append(nl); + } + buf.append(s); } - return s + " / parent: " + this.parent; + if (parent != null) { + if (buf.length() != 0) { + buf.append(nl); + } + buf.append("// parent").append(nl).append(parent); + } + return buf.toString(); } - private static class Checker { - private static final int MAX_ARITY = 5; + /** + * Code only used in assertions. Putting this in a separate class reduces class load time. + */ + private static class Checks { + private static final int MAX_ARITY = 7; /** * The set of all {@link InvocationPlugin#apply} method signatures. */ @@ -828,10 +941,17 @@ SIGS = sigs.toArray(new Class<?>[sigs.size()][]); } - public static boolean check(InvocationPlugins plugins, Type declaringType, MethodKey method, InvocationPlugin plugin) { + static boolean containsBinding(InvocationPlugins p, Type declaringType, Binding key) { + String internalName = MetaUtil.toInternalName(declaringType.getTypeName()); + ClassPlugins classPlugins = p.registrations.get(internalName); + return classPlugins != null && classPlugins.lookup(key) != null; + } + + public static boolean check(InvocationPlugins plugins, Type declaringType, Binding binding) { + InvocationPlugin plugin = binding.plugin; InvocationPlugins p = plugins.parent; while (p != null) { - assert !p.containsKey(declaringType, method) : "a plugin is already registered for " + method; + assert !containsBinding(p, declaringType, binding) : "a plugin is already registered for " + binding; p = p.parent; } if (plugin instanceof ForeignCallPlugin || plugin instanceof GeneratedInvocationPlugin) { @@ -843,8 +963,8 @@ assert substitute.getAnnotation(MethodSubstitution.class) != null : format("Substitute method must be annotated with @%s: %s", MethodSubstitution.class.getSimpleName(), substitute); return true; } - int arguments = method.getDeclaredParameterCount(); - assert arguments < SIGS.length : format("need to extend %s to support method with %d arguments: %s", InvocationPlugin.class.getSimpleName(), arguments, method); + int arguments = parseParameters(binding.argumentsDescriptor).size(); + assert arguments < SIGS.length : format("need to extend %s to support method with %d arguments: %s", InvocationPlugin.class.getSimpleName(), arguments, binding); for (Method m : plugin.getClass().getDeclaredMethods()) { if (m.getName().equals("apply")) { Class<?>[] parameterTypes = m.getParameterTypes(); @@ -853,7 +973,24 @@ } } } - throw new AssertionError(format("graph builder plugin for %s not found", method)); + throw new AssertionError(format("graph builder plugin for %s not found", binding)); + } + + static boolean checkResolvable(boolean isOptional, Type declaringType, Binding binding) { + Class<?> declaringClass = InvocationPlugins.resolveType(declaringType, isOptional); + if (declaringClass == null) { + return true; + } + if (binding.name.equals("<init>")) { + if (resolveConstructor(declaringClass, binding) == null && !isOptional) { + throw new AssertionError(String.format("Constructor not found: %s%s", declaringClass.getName(), binding.argumentsDescriptor)); + } + } else { + if (resolveMethod(declaringClass, binding) == null && !isOptional) { + throw new AssertionError(String.format("Method not found: %s.%s%s", declaringClass.getName(), binding.name, binding.argumentsDescriptor)); + } + } + return true; } } @@ -904,31 +1041,119 @@ if (type instanceof Class) { return (Class<?>) type; } - if (optional && type instanceof OptionalLazySymbol) { + if (type instanceof OptionalLazySymbol) { return ((OptionalLazySymbol) type).resolve(); } return resolveClass(type.getTypeName(), optional); } - private static final Class<?>[] NO_CLASSES = {}; + private static List<String> toInternalTypeNames(Class<?>[] types) { + String[] res = new String[types.length]; + for (int i = 0; i < types.length; i++) { + res[i] = MetaUtil.toInternalName(types[i].getTypeName()); + } + return Arrays.asList(res); + } + + /** + * Resolves a given binding to a method in a given class. If more than one method with the + * parameter types matching {@code binding} is found and the return types of all the matching + * methods form an inheritance chain, the one with the most specific type is returned; otherwise + * {@link NoSuchMethodError} is thrown. + * + * @param declaringClass the class to search for a method matching {@code binding} + * @return the method (if any) in {@code declaringClass} matching binding + */ + public static Method resolveMethod(Class<?> declaringClass, Binding binding) { + if (binding.name.equals("<init>")) { + return null; + } + Method[] methods = declaringClass.getDeclaredMethods(); + List<String> parameterTypeNames = parseParameters(binding.argumentsDescriptor); + for (int i = 0; i < methods.length; ++i) { + Method m = methods[i]; + if (binding.isStatic == Modifier.isStatic(m.getModifiers()) && m.getName().equals(binding.name)) { + if (parameterTypeNames.equals(toInternalTypeNames(m.getParameterTypes()))) { + for (int j = i + 1; j < methods.length; ++j) { + Method other = methods[j]; + if (binding.isStatic == Modifier.isStatic(other.getModifiers()) && other.getName().equals(binding.name)) { + if (parameterTypeNames.equals(toInternalTypeNames(other.getParameterTypes()))) { + if (m.getReturnType().isAssignableFrom(other.getReturnType())) { + // `other` has a more specific return type - choose it + // (m is most likely a bridge method) + m = other; + } else { + if (!other.getReturnType().isAssignableFrom(m.getReturnType())) { + throw new NoSuchMethodError(String.format( + "Found 2 methods with same name and parameter types but unrelated return types:%n %s%n %s", m, other)); + } + } + } + } + } + return m; + } + } + } + return null; + } /** - * Resolves an array of {@link Type}s to an array of {@link Class}es. + * Resolves a given binding to a constructor in a given class. * - * @param types the types to resolve - * @param from the initial index of the range to be resolved, inclusive - * @param to the final index of the range to be resolved, exclusive - * @return the resolved class or null if resolution fails and {@code optional} is true + * @param declaringClass the class to search for a constructor matching {@code binding} + * @return the constructor (if any) in {@code declaringClass} matching binding */ - public static Class<?>[] resolveTypes(Type[] types, int from, int to) { - int length = to - from; - if (length <= 0) { - return NO_CLASSES; + public static Constructor<?> resolveConstructor(Class<?> declaringClass, Binding binding) { + if (!binding.name.equals("<init>")) { + return null; + } + Constructor<?>[] constructors = declaringClass.getDeclaredConstructors(); + List<String> parameterTypeNames = parseParameters(binding.argumentsDescriptor); + for (int i = 0; i < constructors.length; ++i) { + Constructor<?> c = constructors[i]; + if (parameterTypeNames.equals(toInternalTypeNames(c.getParameterTypes()))) { + return c; + } } - Class<?>[] classes = new Class<?>[length]; - for (int i = 0; i < length; i++) { - classes[i] = resolveType(types[i + from], false); + return null; + } + + private static List<String> parseParameters(String argumentsDescriptor) { + assert argumentsDescriptor.startsWith("(") && argumentsDescriptor.endsWith(")") : argumentsDescriptor; + List<String> res = new ArrayList<>(); + int cur = 1; + int end = argumentsDescriptor.length() - 1; + while (cur != end) { + char first; + int start = cur; + do { + first = argumentsDescriptor.charAt(cur++); + } while (first == '['); + + switch (first) { + case 'L': + int endObject = argumentsDescriptor.indexOf(';', cur); + if (endObject == -1) { + throw new GraalError("Invalid object type at index %d in signature: %s", cur, argumentsDescriptor); + } + cur = endObject + 1; + break; + case 'V': + case 'I': + case 'B': + case 'C': + case 'D': + case 'F': + case 'J': + case 'S': + case 'Z': + break; + default: + throw new GraalError("Invalid character at index %d in signature: %s", cur, argumentsDescriptor); + } + res.add(argumentsDescriptor.substring(start, cur)); } - return classes; + return res; } }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java Wed Jul 05 23:21:33 2017 +0200 @@ -69,8 +69,7 @@ void close(); /** - * A JVMCI package {@linkplain Services#exportJVMCITo(Class) dynamically exported} to trusted - * modules. + * A JVMCI package dynamically exported to trusted modules. */ String JVMCI_RUNTIME_PACKAGE = JVMCI.class.getPackage().getName();
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/DeoptimizeOnExceptionTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/DeoptimizeOnExceptionTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -30,10 +30,10 @@ import org.junit.Assert; import org.junit.Test; -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.Label; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import jdk.internal.org.objectweb.asm.Opcodes; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; import jdk.vm.ci.meta.ResolvedJavaMethod; /**
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java Wed Jul 05 23:21:33 2017 +0200 @@ -22,9 +22,17 @@ */ package org.graalvm.compiler.serviceprovider; +import static org.graalvm.compiler.serviceprovider.JDK9Method.Java8OrEarlier; +import static org.graalvm.compiler.serviceprovider.JDK9Method.addOpens; +import static org.graalvm.compiler.serviceprovider.JDK9Method.getModule; +import static org.graalvm.compiler.serviceprovider.JDK9Method.getPackages; +import static org.graalvm.compiler.serviceprovider.JDK9Method.isOpenTo; + +import java.lang.reflect.Method; import java.util.Iterator; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; +import java.util.Set; import jdk.vm.ci.services.JVMCIPermission; import jdk.vm.ci.services.Services; @@ -32,14 +40,32 @@ /** * A mechanism for accessing service providers that abstracts over whether Graal is running on * JVMCI-8 or JVMCI-9. In JVMCI-8, a JVMCI specific mechanism is used to lookup services via the - * hidden JVMCI class loader. in JVMCI-9, the standard {@link ServiceLoader} mechanism is used. + * hidden JVMCI class loader. In JVMCI-9, the standard {@link ServiceLoader} mechanism is used. */ public final class GraalServices { private GraalServices() { } - public static final boolean Java8OrEarlier = System.getProperty("java.specification.version").compareTo("1.9") < 0; + /** + * Opens all JVMCI packages to the module of a given class. This relies on JVMCI already having + * opened all its packages to the module defining {@link GraalServices}. + * + * @param other all JVMCI packages will be opened to the module defining this class + */ + public static void openJVMCITo(Class<?> other) { + Object jvmci = getModule.invoke(Services.class); + Object otherModule = getModule.invoke(other); + if (jvmci != otherModule) { + Set<String> packages = getPackages.invoke(jvmci); + for (String pkg : packages) { + boolean opened = isOpenTo.invoke(jvmci, pkg, otherModule); + if (!opened) { + addOpens.invoke(jvmci, pkg, otherModule); + } + } + } + } /** * Gets an {@link Iterable} of the providers available for a given service. @@ -50,9 +76,9 @@ public static <S> Iterable<S> load(Class<S> service) { assert !service.getName().startsWith("jdk.vm.ci") : "JVMCI services must be loaded via " + Services.class.getName(); if (Java8OrEarlier) { - return Services.load(service); + return load8(service); } - ServiceLoader<S> iterable = ServiceLoader.load(service); + Iterable<S> iterable = ServiceLoader.load(service); return new Iterable<S>() { @Override public Iterator<S> iterator() { @@ -66,8 +92,8 @@ @Override public S next() { S provider = iterator.next(); - // Allow Graal extensions to access JVMCI assuming they have JVMCIPermission - Services.exportJVMCITo(provider.getClass()); + // Allow Graal extensions to access JVMCI + openJVMCITo(provider.getClass()); return provider; } @@ -81,6 +107,23 @@ } /** + * {@code Services.load(Class)} is only defined in JVMCI-8. + */ + private static volatile Method loadMethod; + + @SuppressWarnings("unchecked") + private static <S> Iterable<S> load8(Class<S> service) throws InternalError { + try { + if (loadMethod == null) { + loadMethod = Services.class.getMethod("load", Class.class); + } + return (Iterable<S>) loadMethod.invoke(null, service); + } catch (Exception e) { + throw new InternalError(e); + } + } + + /** * Gets the provider for a given service for which at most one provider must be available. * * @param service the service whose provider is being requested @@ -92,16 +135,14 @@ */ public static <S> S loadSingle(Class<S> service, boolean required) { assert !service.getName().startsWith("jdk.vm.ci") : "JVMCI services must be loaded via " + Services.class.getName(); - if (Java8OrEarlier) { - return Services.loadSingle(service, required); - } - Iterable<S> providers = ServiceLoader.load(service); + Iterable<S> providers = load(service); S singleProvider = null; try { for (Iterator<S> it = providers.iterator(); it.hasNext();) { singleProvider = it.next(); if (it.hasNext()) { - throw new InternalError(String.format("Multiple %s providers found", service.getName())); + S other = it.next(); + throw new InternalError(String.format("Multiple %s providers found: %s, %s", service.getName(), singleProvider.getClass().getName(), other.getClass().getName())); } } } catch (ServiceConfigurationError e) { @@ -111,9 +152,6 @@ if (required) { throw new InternalError(String.format("No provider for %s found", service.getName())); } - } else { - // Allow Graal extensions to access JVMCI assuming they have JVMCIPermission - Services.exportJVMCITo(singleProvider.getClass()); } return singleProvider; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/JDK9Method.java Wed Jul 05 23:21:33 2017 +0200 @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package org.graalvm.compiler.serviceprovider; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +/** + * Reflection based access to API introduced by JDK 9. This allows the API to be used in code that + * must be compiled on a JDK prior to 9. + */ +public final class JDK9Method { + + private static int getJavaSpecificationVersion() { + String value = System.getProperty("java.specification.version"); + if (value.startsWith("1.")) { + value = value.substring(2); + } + return Integer.parseInt(value); + } + + /** + * The integer value corresponding to the value of the {@code java.specification.version} system + * property after any leading {@code "1."} has been stripped. + */ + public static final int JAVA_SPECIFICATION_VERSION = getJavaSpecificationVersion(); + + public JDK9Method(Class<?> declaringClass, String name, Class<?>... parameterTypes) { + try { + this.method = declaringClass.getMethod(name, parameterTypes); + } catch (Exception e) { + throw new InternalError(e); + } + } + + /** + * Determines if the Java runtime is version 8 or earlier. + */ + public static final boolean Java8OrEarlier = JAVA_SPECIFICATION_VERSION <= 8; + + public final Method method; + + public Class<?> getReturnType() { + return method.getReturnType(); + } + + /** + * {@code Class.getModule()}. + */ + public static final JDK9Method getModule; + + /** + * {@code java.lang.Module.getPackages()}. + */ + public static final JDK9Method getPackages; + + /** + * {@code java.lang.Module.getResourceAsStream(String)}. + */ + public static final JDK9Method getResourceAsStream; + + /** + * {@code java.lang.Module.addOpens(String, Module)}. + */ + public static final JDK9Method addOpens; + + /** + * {@code java.lang.Module.isOpen(String, Module)}. + */ + public static final JDK9Method isOpenTo; + + /** + * Invokes the static Module API method represented by this object. + */ + @SuppressWarnings("unchecked") + public <T> T invokeStatic(Object... args) { + checkAvailability(); + assert Modifier.isStatic(method.getModifiers()); + try { + return (T) method.invoke(null, args); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + throw new InternalError(e); + } + } + + /** + * Invokes the non-static Module API method represented by this object. + */ + @SuppressWarnings("unchecked") + public <T> T invoke(Object receiver, Object... args) { + checkAvailability(); + assert !Modifier.isStatic(method.getModifiers()); + try { + return (T) method.invoke(receiver, args); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + throw new InternalError(e); + } + } + + private void checkAvailability() throws InternalError { + if (method == null) { + throw new InternalError("Cannot use Module API on JDK " + JAVA_SPECIFICATION_VERSION); + } + } + + static { + if (JAVA_SPECIFICATION_VERSION >= 9) { + getModule = new JDK9Method(Class.class, "getModule"); + Class<?> moduleClass = getModule.getReturnType(); + getPackages = new JDK9Method(moduleClass, "getPackages"); + addOpens = new JDK9Method(moduleClass, "addOpens", String.class, moduleClass); + getResourceAsStream = new JDK9Method(moduleClass, "getResourceAsStream", String.class); + isOpenTo = new JDK9Method(moduleClass, "isOpen", String.class, moduleClass); + } else { + JDK9Method unavailable = new JDK9Method(); + getModule = unavailable; + getPackages = unavailable; + addOpens = unavailable; + getResourceAsStream = unavailable; + isOpenTo = unavailable; + } + } + + private JDK9Method() { + method = null; + } +}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLModule.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLModule.java Wed Jul 05 23:21:33 2017 +0200 @@ -96,6 +96,7 @@ } } + @SuppressWarnings("unchecked") public Set<String> getPackages() { try { return (Set<String>) getPackagesMethod.invoke(realModule);
--- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp Wed Jul 05 23:21:33 2017 +0200 @@ -58,6 +58,7 @@ virtual bool is_exception_throw_stub() const { return false; } virtual bool is_range_check_stub() const { return false; } virtual bool is_divbyzero_stub() const { return false; } + virtual bool is_simple_exception_stub() const { return false; } #ifndef PRODUCT virtual void print_name(outputStream* out) const = 0; #endif @@ -483,6 +484,7 @@ virtual void emit_code(LIR_Assembler* e); virtual CodeEmitInfo* info() const { return _info; } virtual bool is_exception_throw_stub() const { return true; } + virtual bool is_simple_exception_stub() const { return true; } virtual void visit(LIR_OpVisitState* visitor) { if (_obj->is_valid()) visitor->do_input(_obj); visitor->do_slow_case(_info);
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -1829,6 +1829,20 @@ log->identify(target), Bytecodes::name(code)); + // invoke-special-super + if (bc_raw == Bytecodes::_invokespecial && !target->is_object_initializer()) { + ciInstanceKlass* sender_klass = + calling_klass->is_anonymous() ? calling_klass->host_klass() : + calling_klass; + if (sender_klass->is_interface()) { + int index = state()->stack_size() - (target->arg_size_no_receiver() + 1); + Value receiver = state()->stack_at(index); + CheckCast* c = new CheckCast(sender_klass, receiver, copy_state_before()); + c->set_invokespecial_receiver_check(); + state()->stack_at_put(index, append_split(c)); + } + } + // Some methods are obviously bindable without any type checks so // convert them directly to an invokespecial or invokestatic. if (target->is_loaded() && !target->is_abstract() && target->can_be_statically_bound()) {
--- a/hotspot/src/share/vm/c1/c1_Instruction.hpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp Wed Jul 05 23:21:33 2017 +0200 @@ -372,6 +372,7 @@ UnorderedIsTrueFlag, NeedsPatchingFlag, ThrowIncompatibleClassChangeErrorFlag, + InvokeSpecialReceiverCheckFlag, ProfileMDOFlag, IsLinkedInBlockFlag, NeedsRangeCheckFlag, @@ -1454,6 +1455,16 @@ bool is_incompatible_class_change_check() const { return check_flag(ThrowIncompatibleClassChangeErrorFlag); } + void set_invokespecial_receiver_check() { + set_flag(InvokeSpecialReceiverCheckFlag, true); + } + bool is_invokespecial_receiver_check() const { + return check_flag(InvokeSpecialReceiverCheckFlag); + } + + virtual bool needs_exception_state() const { + return !is_invokespecial_receiver_check(); + } ciType* declared_type() const; };
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -595,6 +595,16 @@ return impl; } +ciInstanceKlass* ciInstanceKlass::host_klass() { + assert(is_loaded(), "must be loaded"); + if (is_anonymous()) { + VM_ENTRY_MARK + Klass* host_klass = get_instanceKlass()->host_klass(); + return CURRENT_ENV->get_instance_klass(host_klass); + } + return NULL; +} + // Utility class for printing of the contents of the static fields for // use by compilation replay. It only prints out the information that // could be consumed by the compiler, so for primitive types it prints
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp Wed Jul 05 23:21:33 2017 +0200 @@ -260,6 +260,8 @@ return NULL; } + ciInstanceKlass* host_klass(); + bool can_be_instantiated() { assert(is_loaded(), "must be loaded"); return !is_interface() && !is_abstract();
--- a/hotspot/src/share/vm/ci/ciMethod.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/ci/ciMethod.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -952,6 +952,13 @@ } // ------------------------------------------------------------------ +// ciMethod::is_object_initializer +// +bool ciMethod::is_object_initializer() const { + return name() == ciSymbol::object_initializer_name(); +} + +// ------------------------------------------------------------------ // ciMethod::has_member_arg // // Return true if the method is a linker intrinsic like _linkToVirtual.
--- a/hotspot/src/share/vm/ci/ciMethod.hpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/ci/ciMethod.hpp Wed Jul 05 23:21:33 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -337,6 +337,7 @@ bool has_reserved_stack_access() const { return _has_reserved_stack_access; } bool is_boxing_method() const; bool is_unboxing_method() const; + bool is_object_initializer() const; // Replay data methods void dump_name_as_ascii(outputStream* st);
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -720,7 +720,8 @@ Thread* THREAD = thread; // extract receiver from the outgoing argument list if necessary Handle receiver(thread, NULL); - if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface) { + if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface || + bytecode == Bytecodes::_invokespecial) { ResourceMark rm(thread); methodHandle m (thread, method(thread)); Bytecode_invoke call(m, bci(thread)); @@ -783,16 +784,25 @@ int index = info.resolved_method()->itable_index(); assert(info.itable_index() == index, ""); } + } else if (bytecode == Bytecodes::_invokespecial) { + assert(info.call_kind() == CallInfo::direct_call, "must be direct call"); } else { assert(info.call_kind() == CallInfo::direct_call || info.call_kind() == CallInfo::vtable_call, ""); } #endif + // Get sender or sender's host_klass, and only set cpCache entry to resolved if + // it is not an interface. The receiver for invokespecial calls within interface + // methods must be checked for every call. + InstanceKlass* sender = pool->pool_holder(); + sender = sender->is_anonymous() ? sender->host_klass() : sender; + switch (info.call_kind()) { case CallInfo::direct_call: cp_cache_entry->set_direct_call( bytecode, - info.resolved_method()); + info.resolved_method(), + sender->is_interface()); break; case CallInfo::vtable_call: cp_cache_entry->set_vtable_call(
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -1057,12 +1057,14 @@ void LinkResolver::resolve_special_call(CallInfo& result, + Handle recv, const LinkInfo& link_info, TRAPS) { methodHandle resolved_method = linktime_resolve_special_method(link_info, CHECK); runtime_resolve_special_method(result, resolved_method, link_info.resolved_klass(), link_info.current_klass(), + recv, link_info.check_access(), CHECK); } @@ -1149,6 +1151,7 @@ const methodHandle& resolved_method, KlassHandle resolved_klass, KlassHandle current_klass, + Handle recv, bool check_access, TRAPS) { // resolved method is selected method unless we have an old-style lookup @@ -1157,21 +1160,19 @@ // no checks for shadowing methodHandle sel_method(THREAD, resolved_method()); - // check if this is an old-style super call and do a new lookup if so - { KlassHandle method_klass = KlassHandle(THREAD, - resolved_method->method_holder()); + if (check_access && + // check if the method is not <init> + resolved_method->name() != vmSymbols::object_initializer_name()) { - if (check_access && + // check if this is an old-style super call and do a new lookup if so // a) check if ACC_SUPER flag is set for the current class - (current_klass->is_super() || !AllowNonVirtualCalls) && + if ((current_klass->is_super() || !AllowNonVirtualCalls) && // b) check if the class of the resolved_klass is a superclass // (not supertype in order to exclude interface classes) of the current class. // This check is not performed for super.invoke for interface methods // in super interfaces. current_klass->is_subclass_of(resolved_klass()) && - current_klass() != resolved_klass() && - // c) check if the method is not <init> - resolved_method->name() != vmSymbols::object_initializer_name()) { + current_klass() != resolved_klass()) { // Lookup super method KlassHandle super_klass(THREAD, current_klass->super()); sel_method = lookup_instance_method_in_klasses(super_klass, @@ -1186,6 +1187,27 @@ resolved_method->signature())); } } + + // Check that the class of objectref (the receiver) is the current class or interface, + // or a subtype of the current class or interface (the sender), otherwise invokespecial + // throws IllegalAccessError. + // The verifier checks that the sender is a subtype of the class in the I/MR operand. + // The verifier also checks that the receiver is a subtype of the sender, if the sender is + // a class. If the sender is an interface, the check has to be performed at runtime. + InstanceKlass* sender = InstanceKlass::cast(current_klass()); + sender = sender->is_anonymous() ? sender->host_klass() : sender; + if (sender->is_interface() && recv.not_null()) { + Klass* receiver_klass = recv->klass(); + if (!receiver_klass->is_subtype_of(sender)) { + ResourceMark rm(THREAD); + char buf[500]; + jio_snprintf(buf, sizeof(buf), + "Receiver class %s must be the current class or a subtype of interface %s", + receiver_klass->name()->as_C_string(), + sender->name()->as_C_string()); + THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), buf); + } + } } // check if not static @@ -1518,7 +1540,7 @@ methodHandle LinkResolver::resolve_special_call_or_null(const LinkInfo& link_info) { EXCEPTION_MARK; CallInfo info; - resolve_special_call(info, link_info, THREAD); + resolve_special_call(info, Handle(), link_info, THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return methodHandle(); @@ -1534,7 +1556,7 @@ void LinkResolver::resolve_invoke(CallInfo& result, Handle recv, const constantPoolHandle& pool, int index, Bytecodes::Code byte, TRAPS) { switch (byte) { case Bytecodes::_invokestatic : resolve_invokestatic (result, pool, index, CHECK); break; - case Bytecodes::_invokespecial : resolve_invokespecial (result, pool, index, CHECK); break; + case Bytecodes::_invokespecial : resolve_invokespecial (result, recv, pool, index, CHECK); break; case Bytecodes::_invokevirtual : resolve_invokevirtual (result, recv, pool, index, CHECK); break; case Bytecodes::_invokehandle : resolve_invokehandle (result, pool, index, CHECK); break; case Bytecodes::_invokedynamic : resolve_invokedynamic (result, pool, index, CHECK); break; @@ -1563,7 +1585,7 @@ resolve_static_call(result, link_info, /*initialize_class=*/false, CHECK); break; case Bytecodes::_invokespecial: - resolve_special_call(result, link_info, CHECK); + resolve_special_call(result, recv, link_info, CHECK); break; default: fatal("bad call: %s", Bytecodes::name(byte)); @@ -1576,9 +1598,10 @@ } -void LinkResolver::resolve_invokespecial(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) { +void LinkResolver::resolve_invokespecial(CallInfo& result, Handle recv, + const constantPoolHandle& pool, int index, TRAPS) { LinkInfo link_info(pool, index, CHECK); - resolve_special_call(result, link_info, CHECK); + resolve_special_call(result, recv, link_info, CHECK); }
--- a/hotspot/src/share/vm/interpreter/linkResolver.hpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp Wed Jul 05 23:21:33 2017 +0200 @@ -230,6 +230,7 @@ const methodHandle& resolved_method, KlassHandle resolved_klass, KlassHandle current_klass, + Handle recv, bool check_access, TRAPS); static void runtime_resolve_virtual_method (CallInfo& result, const methodHandle& resolved_method, @@ -256,7 +257,7 @@ // runtime resolving from constant pool static void resolve_invokestatic (CallInfo& result, const constantPoolHandle& pool, int index, TRAPS); - static void resolve_invokespecial (CallInfo& result, + static void resolve_invokespecial (CallInfo& result, Handle recv, const constantPoolHandle& pool, int index, TRAPS); static void resolve_invokevirtual (CallInfo& result, Handle recv, const constantPoolHandle& pool, int index, TRAPS); @@ -289,6 +290,7 @@ const LinkInfo& link_info, bool initialize_klass, TRAPS); static void resolve_special_call (CallInfo& result, + Handle recv, const LinkInfo& link_info, TRAPS); static void resolve_virtual_call (CallInfo& result, Handle recv, KlassHandle recv_klass,
--- a/hotspot/src/share/vm/oops/cpCache.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/oops/cpCache.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -140,7 +140,8 @@ void ConstantPoolCacheEntry::set_direct_or_vtable_call(Bytecodes::Code invoke_code, methodHandle method, - int vtable_index) { + int vtable_index, + bool sender_is_interface) { bool is_vtable_call = (vtable_index >= 0); // FIXME: split this method on this boolean assert(method->interpreter_entry() != NULL, "should have been set at this point"); assert(!method->is_obsolete(), "attempt to write obsolete method to cpCache"); @@ -204,7 +205,13 @@ if (byte_no == 1) { assert(invoke_code != Bytecodes::_invokevirtual && invoke_code != Bytecodes::_invokeinterface, ""); + // Don't mark invokespecial to method as resolved if sender is an interface. The receiver + // has to be checked that it is a subclass of the current class every time this bytecode + // is executed. + if (invoke_code != Bytecodes::_invokespecial || !sender_is_interface || + method->name() == vmSymbols::object_initializer_name()) { set_bytecode_1(invoke_code); + } } else if (byte_no == 2) { if (change_to_virtual) { assert(invoke_code == Bytecodes::_invokeinterface, ""); @@ -234,17 +241,18 @@ NOT_PRODUCT(verify(tty)); } -void ConstantPoolCacheEntry::set_direct_call(Bytecodes::Code invoke_code, methodHandle method) { +void ConstantPoolCacheEntry::set_direct_call(Bytecodes::Code invoke_code, methodHandle method, + bool sender_is_interface) { int index = Method::nonvirtual_vtable_index; // index < 0; FIXME: inline and customize set_direct_or_vtable_call - set_direct_or_vtable_call(invoke_code, method, index); + set_direct_or_vtable_call(invoke_code, method, index, sender_is_interface); } void ConstantPoolCacheEntry::set_vtable_call(Bytecodes::Code invoke_code, methodHandle method, int index) { // either the method is a miranda or its holder should accept the given index assert(method->method_holder()->is_interface() || method->method_holder()->verify_vtable_index(index), ""); // index >= 0; FIXME: inline and customize set_direct_or_vtable_call - set_direct_or_vtable_call(invoke_code, method, index); + set_direct_or_vtable_call(invoke_code, method, index, false); } void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code, const methodHandle& method, int index) {
--- a/hotspot/src/share/vm/oops/cpCache.hpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/oops/cpCache.hpp Wed Jul 05 23:21:33 2017 +0200 @@ -230,13 +230,15 @@ void set_direct_or_vtable_call( Bytecodes::Code invoke_code, // the bytecode used for invoking the method methodHandle method, // the method/prototype if any (NULL, otherwise) - int vtable_index // the vtable index if any, else negative + int vtable_index, // the vtable index if any, else negative + bool sender_is_interface ); public: void set_direct_call( // sets entry to exact concrete method entry Bytecodes::Code invoke_code, // the bytecode used for invoking the method - methodHandle method // the method to call + methodHandle method, // the method to call + bool sender_is_interface ); void set_vtable_call( // sets entry to vtable index
--- a/hotspot/src/share/vm/opto/doCall.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/opto/doCall.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -505,6 +505,30 @@ speculative_receiver_type = receiver_type != NULL ? receiver_type->speculative_type() : NULL; } + // invoke-super-special + if (iter().cur_bc_raw() == Bytecodes::_invokespecial && !orig_callee->is_object_initializer()) { + ciInstanceKlass* calling_klass = method()->holder(); + ciInstanceKlass* sender_klass = + calling_klass->is_anonymous() ? calling_klass->host_klass() : + calling_klass; + if (sender_klass->is_interface()) { + Node* receiver_node = stack(sp() - nargs); + Node* cls_node = makecon(TypeKlassPtr::make(sender_klass)); + Node* bad_type_ctrl = NULL; + Node* casted_receiver = gen_checkcast(receiver_node, cls_node, &bad_type_ctrl); + if (bad_type_ctrl != NULL) { + PreserveJVMState pjvms(this); + set_control(bad_type_ctrl); + uncommon_trap(Deoptimization::Reason_class_check, + Deoptimization::Action_none); + } + if (stopped()) { + return; // MUST uncommon-trap? + } + set_stack(sp() - nargs, casted_receiver); + } + } + // Note: It's OK to try to inline a virtual call. // The call generator will not attempt to inline a polymorphic call // unless it knows how to optimize the receiver dispatch.
--- a/hotspot/src/share/vm/opto/memnode.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/opto/memnode.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -61,6 +61,15 @@ return calculate_adr_type(adr->bottom_type(), cross_check); } +bool MemNode::check_if_adr_maybe_raw(Node* adr) { + if (adr != NULL) { + if (adr->bottom_type()->base() == Type::RawPtr || adr->bottom_type()->base() == Type::AnyPtr) { + return true; + } + } + return false; +} + #ifndef PRODUCT void MemNode::dump_spec(outputStream *st) const { if (in(Address) == NULL) return; // node is dead @@ -560,6 +569,7 @@ if (offset == Type::OffsetBot) return NULL; // cannot unalias unless there are precise offsets + const bool adr_maybe_raw = check_if_adr_maybe_raw(adr); const TypeOopPtr *addr_t = adr->bottom_type()->isa_oopptr(); intptr_t size_in_bytes = memory_size(); @@ -577,6 +587,13 @@ Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_offset); if (st_base == NULL) break; // inscrutable pointer + + // For raw accesses it's not enough to prove that constant offsets don't intersect. + // We need the bases to be the equal in order for the offset check to make sense. + if ((adr_maybe_raw || check_if_adr_maybe_raw(st_adr)) && st_base != base) { + break; + } + if (st_offset != offset && st_offset != Type::OffsetBot) { const int MAX_STORE = BytesPerLong; if (st_offset >= offset + size_in_bytes ||
--- a/hotspot/src/share/vm/opto/memnode.hpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/opto/memnode.hpp Wed Jul 05 23:21:33 2017 +0200 @@ -78,6 +78,7 @@ } virtual Node* find_previous_arraycopy(PhaseTransform* phase, Node* ld_alloc, Node*& mem, bool can_see_stored_value) const { return NULL; } + static bool check_if_adr_maybe_raw(Node* adr); public: // Helpers for the optimizer. Documented in memnode.cpp.
--- a/hotspot/src/share/vm/prims/methodHandles.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/prims/methodHandles.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -727,7 +727,7 @@ assert(!is_signature_polymorphic_static(mh_invoke_id), ""); LinkResolver::resolve_handle_call(result, link_info, THREAD); } else if (ref_kind == JVM_REF_invokeSpecial) { - LinkResolver::resolve_special_call(result, + LinkResolver::resolve_special_call(result, Handle(), link_info, THREAD); } else if (ref_kind == JVM_REF_invokeVirtual) { LinkResolver::resolve_virtual_call(result, Handle(), defc, @@ -755,7 +755,7 @@ { assert(!HAS_PENDING_EXCEPTION, ""); if (name == vmSymbols::object_initializer_name()) { - LinkResolver::resolve_special_call(result, link_info, THREAD); + LinkResolver::resolve_special_call(result, Handle(), link_info, THREAD); } else { break; // will throw after end of switch }
--- a/hotspot/src/share/vm/runtime/arguments.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -375,6 +375,7 @@ // -------------- Deprecated Flags -------------- // --- Non-alias flags - sorted by obsolete_in then expired_in: { "MaxGCMinorPauseMillis", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() }, + { "UseConcMarkSweepGC", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() }, // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in: { "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() }, @@ -2240,8 +2241,6 @@ if (FLAG_SET_CMDLINE(bool, UseParallelGC, true) != Flag::SUCCESS) { return JNI_EINVAL; } - FLAG_SET_DEFAULT(ParallelGCThreads, - Abstract_VM_Version::parallel_worker_threads()); // Encourage steady state memory management if (FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100) != Flag::SUCCESS) { @@ -2440,6 +2439,9 @@ status = status && check_jvmci_args_consistency(); if (EnableJVMCI) { + PropertyList_unique_add(&_system_properties, "jdk.internal.vm.ci.enabled", "true", + AddProperty, UnwriteableProperty, InternalProperty); + if (!ScavengeRootsInCode) { warning("forcing ScavengeRootsInCode non-zero because JVMCI is enabled"); ScavengeRootsInCode = 1;
--- a/hotspot/src/share/vm/runtime/javaCalls.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/runtime/javaCalls.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -221,7 +221,7 @@ void JavaCalls::call_special(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { CallInfo callinfo; LinkInfo link_info(klass, name, signature); - LinkResolver::resolve_special_call(callinfo, link_info, CHECK); + LinkResolver::resolve_special_call(callinfo, args->receiver(), link_info, CHECK); methodHandle method = callinfo.selected_method(); assert(method.not_null(), "should have thrown exception");
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Wed Jul 05 23:21:33 2017 +0200 @@ -199,6 +199,7 @@ typedef HashtableEntry<Klass*, mtClass> KlassHashtableEntry; typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable; typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable; +typedef RehashableHashtable<Symbol*, mtSymbol> RehashableSymbolHashtable; //-------------------------------------------------------------------------------- // VM_STRUCTS @@ -584,6 +585,7 @@ \ static_field(SymbolTable, _the_table, SymbolTable*) \ static_field(SymbolTable, _shared_table, SymbolCompactHashTable) \ + static_field(RehashableSymbolHashtable, _seed, juint) \ \ /***************/ \ /* StringTable */ \ @@ -1602,6 +1604,8 @@ \ declare_toplevel_type(BasicHashtable<mtInternal>) \ declare_type(IntptrHashtable, BasicHashtable<mtInternal>) \ + declare_toplevel_type(BasicHashtable<mtSymbol>) \ + declare_type(RehashableSymbolHashtable, BasicHashtable<mtSymbol>) \ declare_type(SymbolTable, SymbolHashtable) \ declare_type(StringTable, StringHashtable) \ declare_type(LoaderConstraintTable, KlassHashtable) \
--- a/hotspot/src/share/vm/utilities/hashtable.hpp Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/src/share/vm/utilities/hashtable.hpp Wed Jul 05 23:21:33 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -294,6 +294,7 @@ }; template <class T, MEMFLAGS F> class RehashableHashtable : public Hashtable<T, F> { + friend class VMStructs; protected: enum {
--- a/hotspot/test/TEST.ROOT Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/TEST.ROOT Wed Jul 05 23:21:33 2017 +0200 @@ -59,3 +59,6 @@ # Use new module options useNewOptions=true + +# Use --patch-module instead of -Xmodule: +useNewPatchModule=true
--- a/hotspot/test/compiler/intrinsics/zip/TestCRC32.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/intrinsics/zip/TestCRC32.java Wed Jul 05 23:21:33 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,22 @@ import java.util.zip.Checksum; public class TestCRC32 { - public static void main(String[] args) { + // standard CRC32 polynomial + // coefficients in different forms + // normal: polyBits = 0x04c11db7 = 0b0000 0100 1100 0001 0001 1101 1011 0111 + // reversed: polybits = 0xedb88320 = 0b1110 1101 1011 1000 1000 0011 0010 0000 + // reversed reciprocal polybits = 0x82608edb = 0b1000 0010 0110 0000 1000 1110 1101 1011 + // + // 0 5 9 13 17 21 25 29 + // | | | | | | | | + // reversed shiftL 1 polyBits = 0x1db710641L = 0b1 1101 1011 0111 0001 0000 0110 0100 0001 + final static long polyBits = (1L<<(32-32)) + (1L<<(32-26)) + (1L<<(32-23)) + (1L<<(32-22)) + + (1L<<(32-16)) + (1L<<(32-12)) + (1L<<(32-11)) + (1L<<(32-10)) + + (1L<<(32-8)) + (1L<<(32-7)) + (1L<<(32-5)) + (1L<<(32-4)) + + (1L<<(32-2)) + (1L<<(32-1)) + (1L<<(32-0)); + final static long polyBitsShifted = polyBits>>1; + + public static void main(String[] args) throws Exception { int offset = Integer.getInteger("offset", 0); int msgSize = Integer.getInteger("msgSize", 512); boolean multi = false; @@ -65,11 +80,14 @@ byte[] b = initializedBytes(msgSize, offset); + final long crcReference = update_byteLoop(0, b, offset); + CRC32 crc0 = new CRC32(); CRC32 crc1 = new CRC32(); CRC32 crc2 = new CRC32(); crc0.update(b, offset, msgSize); + check(crc0, crcReference); System.out.println("-------------------------------------------------------"); @@ -77,27 +95,35 @@ for (int i = 0; i < warmupIters; i++) { crc1.reset(); crc1.update(b, offset, msgSize); + check(crc1, crcReference); } - /* measure performance */ + /* check correctness + * Do that before measuring performance + * to even better heat up involved methods. + */ + for (int i = 0; i < iters; i++) { + crc1.reset(); + crc1.update(b, offset, msgSize); + check(crc1, crcReference); + } + report("CRCs", crc1, crcReference); + + /* measure performance + * Don't spoil times with error checking. + */ long start = System.nanoTime(); for (int i = 0; i < iters; i++) { crc1.reset(); crc1.update(b, offset, msgSize); } long end = System.nanoTime(); + double total = (double)(end - start)/1e9; // in seconds double thruput = (double)msgSize*iters/1e6/total; // in MB/s System.out.println("CRC32.update(byte[]) runtime = " + total + " seconds"); System.out.println("CRC32.update(byte[]) throughput = " + thruput + " MB/s"); - - /* check correctness */ - for (int i = 0; i < iters; i++) { - crc1.reset(); - crc1.update(b, offset, msgSize); - if (!check(crc0, crc1)) break; - } - report("CRCs", crc0, crc1); + report("CRCs", crc1, crcReference); System.out.println("-------------------------------------------------------"); @@ -110,9 +136,24 @@ crc2.reset(); crc2.update(buf); buf.rewind(); + check(crc2, crcReference); } - /* measure performance */ + /* check correctness + * Do that before measuring performance + * to even better heat up involved methods. + */ + for (int i = 0; i < iters; i++) { + crc2.reset(); + crc2.update(buf); + buf.rewind(); + check(crc2, crcReference); + } + report("CRCs", crc2, crcReference); + + /* measure performance + * Don't spoil times with error checking. + */ start = System.nanoTime(); for (int i = 0; i < iters; i++) { crc2.reset(); @@ -124,31 +165,57 @@ thruput = (double)msgSize*iters/1e6/total; // in MB/s System.out.println("CRC32.update(ByteBuffer) runtime = " + total + " seconds"); System.out.println("CRC32.update(ByteBuffer) throughput = " + thruput + " MB/s"); - - /* check correctness */ - for (int i = 0; i < iters; i++) { - crc2.reset(); - crc2.update(buf); - buf.rewind(); - if (!check(crc0, crc2)) break; - } - report("CRCs", crc0, crc2); + report("CRCs", crc2, crcReference); System.out.println("-------------------------------------------------------"); } - private static void report(String s, Checksum crc0, Checksum crc1) { - System.out.printf("%s: crc0 = %08x, crc1 = %08x\n", - s, crc0.getValue(), crc1.getValue()); + // Just a loop over a byte array, updating the CRC byte by byte. + public static long update_byteLoop(long crc, byte[] buf, int offset) { + return update_byteLoop(crc, buf, offset, buf.length-offset); + } + + // Just a loop over a byte array, with given length, updating the CRC byte by byte. + public static long update_byteLoop(long crc, byte[] buf, int offset, int length) { + int end = length+offset; + for (int i = offset; i < end; i++) { + crc = update_singlebyte(crc, polyBitsShifted, buf[i]); + } + return crc; } - private static boolean check(Checksum crc0, Checksum crc1) { - if (crc0.getValue() != crc1.getValue()) { - System.err.printf("ERROR: crc0 = %08x, crc1 = %08x\n", - crc0.getValue(), crc1.getValue()); - return false; + // Straight-forward implementation of CRC update by one byte. + // We use this very basic implementation to calculate reference + // results. It is necessary to have full control over how the + // reference results are calculated. It is not sufficient to rely + // on the interpreter (or c1, or c2) to do the right thing. + public static long update_singlebyte(long crc, long polynomial, int val) { + crc = (crc ^ -1L) & 0x00000000ffffffffL; // use 1's complement of crc + crc = crc ^ (val&0xff); // XOR in next byte from stream + for (int i = 0; i < 8; i++) { + boolean bitset = (crc & 0x01L) != 0; + + crc = crc>>1; + if (bitset) { + crc = crc ^ polynomial; + crc = crc & 0x00000000ffffffffL; + } } - return true; + crc = (crc ^ -1L) & 0x00000000ffffffffL; // revert taking 1's complement + return crc; + } + + private static void report(String s, Checksum crc, long crcReference) { + System.out.printf("%s: crc = %08x, crcReference = %08x\n", + s, crc.getValue(), crcReference); + } + + private static void check(Checksum crc, long crcReference) throws Exception { + if (crc.getValue() != crcReference) { + System.err.printf("ERROR: crc = %08x, crcReference = %08x\n", + crc.getValue(), crcReference); + throw new Exception("TestCRC32 Error"); + } } private static byte[] initializedBytes(int M, int offset) { @@ -162,7 +229,7 @@ return bytes; } - private static void test_multi(int iters) { + private static void test_multi(int iters) throws Exception { int len1 = 8; // the 8B/iteration loop int len2 = 32; // the 32B/iteration loop int len3 = 4096; // the 4KB/iteration loop @@ -185,37 +252,31 @@ (len1+len2+len3)*2+5, (len1+len2+len3)*2+7, (len1+len2+len3)*3, (len1+len2+len3)*3-1, (len1+len2+len3)*3-3, (len1+len2+len3)*3-5, (len1+len2+len3)*3-7 }; - CRC32[] crc0 = new CRC32[offsets.length*sizes.length]; CRC32[] crc1 = new CRC32[offsets.length*sizes.length]; + long[] crcReference = new long[offsets.length*sizes.length]; int i, j, k; System.out.printf("testing %d cases ...\n", offsets.length*sizes.length); - /* set the result from interpreter as reference */ + // Initialize CRC32 result arrays, CRC32 reference array. + // Reference is calculated using a very basic Java implementation. for (i = 0; i < offsets.length; i++) { for (j = 0; j < sizes.length; j++) { - crc0[i*sizes.length + j] = new CRC32(); crc1[i*sizes.length + j] = new CRC32(); - crc0[i*sizes.length + j].update(b, offsets[i], sizes[j]); + crcReference[i*sizes.length + j] = update_byteLoop(0, b, offsets[i], sizes[j]); } } - /* warm up the JIT compiler and get result */ + // Warm up the JIT compiler. Over time, all methods involved will + // be executed by the interpreter, then get compiled by c1 and + // finally by c2. Each calculated CRC value must, in each iteration, + // be equal to the precalculated reference value for the test to pass. for (k = 0; k < iters; k++) { for (i = 0; i < offsets.length; i++) { for (j = 0; j < sizes.length; j++) { crc1[i*sizes.length + j].reset(); crc1[i*sizes.length + j].update(b, offsets[i], sizes[j]); - } - } - } - - /* check correctness */ - for (i = 0; i < offsets.length; i++) { - for (j = 0; j < sizes.length; j++) { - if (!check(crc0[i*sizes.length + j], crc1[i*sizes.length + j])) { - System.out.printf("offsets[%d] = %d", i, offsets[i]); - System.out.printf("\tsizes[%d] = %d\n", j, sizes[j]); + check(crc1[i*sizes.length + j], crcReference[i*sizes.length + j]); } } }
--- a/hotspot/test/compiler/intrinsics/zip/TestCRC32C.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/intrinsics/zip/TestCRC32C.java Wed Jul 05 23:21:33 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,23 @@ import java.util.zip.Checksum; public class TestCRC32C { - public static void main(String[] args) { + // CRC32C (Castagnoli) polynomial + // coefficients in different forms + // normal: polyBits = 0x1edc6f41 = 0b0001 1110 1101 1100 0110 1111 0100 0001 + // reversed: polybits = 0x82f63b78 = 0b1000 0010 1111 0110 0011 1011 0111 1000 + // reversed reciprocal polybits = 0x8f6e37a0 = 0b1000 1111 0110 1110 0011 0111 1010 0000 + // + // 0 5 9 13 17 21 25 29 + // | | | | | | | | + // reversed shiftL 1 polyBits = 0x105ec76f1L = 0b1 0000 0101 1110 1100 0111 0110 1111 0001 + final static long polyBits = (1L<<(32-32)) + (1L<<(32-28)) + (1L<<(32-27)) + + (1L<<(32-26)) + (1L<<(32-25)) + (1L<<(32-23)) + (1L<<(32-22)) + + (1L<<(32-20)) + (1L<<(32-19)) + (1L<<(32-18)) + (1L<<(32-14)) + + (1L<<(32-13)) + (1L<<(32-11)) + (1L<<(32-10)) + (1L<<(32-9)) + + (1L<<(32-8)) + (1L<<(32-6)) + (1L<<(32-0)); + final static long polyBitsShifted = polyBits>>1; + + public static void main(String[] args) throws Exception { int offset = Integer.getInteger("offset", 0); int msgSize = Integer.getInteger("msgSize", 512); boolean multi = false; @@ -65,11 +81,14 @@ byte[] b = initializedBytes(msgSize, offset); + final long crcReference = update_byteLoop(0, b, offset); + CRC32C crc0 = new CRC32C(); CRC32C crc1 = new CRC32C(); CRC32C crc2 = new CRC32C(); crc0.update(b, offset, msgSize); + check(crc0, crcReference); System.out.println("-------------------------------------------------------"); @@ -77,27 +96,35 @@ for (int i = 0; i < warmupIters; i++) { crc1.reset(); crc1.update(b, offset, msgSize); + check(crc1, crcReference); } - /* measure performance */ + /* check correctness + * Do that before measuring performance + * to even better heat up involved methods. + */ + for (int i = 0; i < iters; i++) { + crc1.reset(); + crc1.update(b, offset, msgSize); + check(crc1, crcReference); + } + report("CRCs", crc1, crcReference); + + /* measure performance + * Don't spoil times with error checking. + */ long start = System.nanoTime(); for (int i = 0; i < iters; i++) { crc1.reset(); crc1.update(b, offset, msgSize); } long end = System.nanoTime(); + double total = (double)(end - start)/1e9; // in seconds double thruput = (double)msgSize*iters/1e6/total; // in MB/s System.out.println("CRC32C.update(byte[]) runtime = " + total + " seconds"); System.out.println("CRC32C.update(byte[]) throughput = " + thruput + " MB/s"); - - /* check correctness */ - for (int i = 0; i < iters; i++) { - crc1.reset(); - crc1.update(b, offset, msgSize); - if (!check(crc0, crc1)) break; - } - report("CRCs", crc0, crc1); + report("CRCs", crc1, crcReference); System.out.println("-------------------------------------------------------"); @@ -110,9 +137,24 @@ crc2.reset(); crc2.update(buf); buf.rewind(); + check(crc2, crcReference); } - /* measure performance */ + /* check correctness + * Do that before measuring performance + * to even better heat up involved methods. + */ + for (int i = 0; i < iters; i++) { + crc2.reset(); + crc2.update(buf); + buf.rewind(); + check(crc2, crcReference); + } + report("CRCs", crc2, crcReference); + + /* measure performance + * Don't spoil times with error checking. + */ start = System.nanoTime(); for (int i = 0; i < iters; i++) { crc2.reset(); @@ -124,31 +166,57 @@ thruput = (double)msgSize*iters/1e6/total; // in MB/s System.out.println("CRC32C.update(ByteBuffer) runtime = " + total + " seconds"); System.out.println("CRC32C.update(ByteBuffer) throughput = " + thruput + " MB/s"); - - /* check correctness */ - for (int i = 0; i < iters; i++) { - crc2.reset(); - crc2.update(buf); - buf.rewind(); - if (!check(crc0, crc2)) break; - } - report("CRCs", crc0, crc2); + report("CRCs", crc2, crcReference); System.out.println("-------------------------------------------------------"); } - private static void report(String s, Checksum crc0, Checksum crc1) { - System.out.printf("%s: crc0 = %08x, crc1 = %08x\n", - s, crc0.getValue(), crc1.getValue()); + // Just a loop over a byte array, updating the CRC byte by byte. + public static long update_byteLoop(long crc, byte[] buf, int offset) { + return update_byteLoop(crc, buf, offset, buf.length-offset); + } + + // Just a loop over a byte array, with given length, updating the CRC byte by byte. + public static long update_byteLoop(long crc, byte[] buf, int offset, int length) { + int end = length+offset; + for (int i = offset; i < end; i++) { + crc = update_singlebyte(crc, polyBitsShifted, buf[i]); + } + return crc; } - private static boolean check(Checksum crc0, Checksum crc1) { - if (crc0.getValue() != crc1.getValue()) { - System.err.printf("ERROR: crc0 = %08x, crc1 = %08x\n", - crc0.getValue(), crc1.getValue()); - return false; + // Straight-forward implementation of CRC update by one byte. + // We use this very basic implementation to calculate reference + // results. It is necessary to have full control over how the + // reference results are calculated. It is not sufficient to rely + // on the interpreter (or c1, or c2) to do the right thing. + public static long update_singlebyte(long crc, long polynomial, int val) { + crc = (crc ^ -1L) & 0x00000000ffffffffL; // use 1's complement of crc + crc = crc ^ (val&0xff); // XOR in next byte from stream + for (int i = 0; i < 8; i++) { + boolean bitset = (crc & 0x01L) != 0; + + crc = crc>>1; + if (bitset) { + crc = crc ^ polynomial; + crc = crc & 0x00000000ffffffffL; + } } - return true; + crc = (crc ^ -1L) & 0x00000000ffffffffL; // revert taking 1's complement + return crc; + } + + private static void report(String s, Checksum crc, long crcReference) { + System.out.printf("%s: crc = %08x, crcReference = %08x\n", + s, crc.getValue(), crcReference); + } + + private static void check(Checksum crc, long crcReference) throws Exception { + if (crc.getValue() != crcReference) { + System.err.printf("ERROR: crc = %08x, crcReference = %08x\n", + crc.getValue(), crcReference); + throw new Exception("TestCRC32C Error"); + } } private static byte[] initializedBytes(int M, int offset) { @@ -162,7 +230,7 @@ return bytes; } - private static void test_multi(int iters) { + private static void test_multi(int iters) throws Exception { int len1 = 8; // the 8B/iteration loop int len2 = 32; // the 32B/iteration loop int len3 = 4096; // the 4KB/iteration loop @@ -185,37 +253,31 @@ (len1+len2+len3)*2+5, (len1+len2+len3)*2+7, (len1+len2+len3)*3, (len1+len2+len3)*3-1, (len1+len2+len3)*3-3, (len1+len2+len3)*3-5, (len1+len2+len3)*3-7 }; - CRC32C[] crc0 = new CRC32C[offsets.length*sizes.length]; CRC32C[] crc1 = new CRC32C[offsets.length*sizes.length]; + long[] crcReference = new long[offsets.length*sizes.length]; int i, j, k; System.out.printf("testing %d cases ...\n", offsets.length*sizes.length); - /* set the result from interpreter as reference */ + // Initialize CRC32C result arrays, CRC32C reference array. + // Reference is calculated using a very basic Java implementation. for (i = 0; i < offsets.length; i++) { for (j = 0; j < sizes.length; j++) { - crc0[i*sizes.length + j] = new CRC32C(); crc1[i*sizes.length + j] = new CRC32C(); - crc0[i*sizes.length + j].update(b, offsets[i], sizes[j]); + crcReference[i*sizes.length + j] = update_byteLoop(0, b, offsets[i], sizes[j]); } } - /* warm up the JIT compiler and get result */ + // Warm up the JIT compiler. Over time, all methods involved will + // be executed by the interpreter, then get compiled by c1 and + // finally by c2. Each calculated CRC value must, in each iteration, + // be equal to the precalculated reference value for the test to pass. for (k = 0; k < iters; k++) { for (i = 0; i < offsets.length; i++) { for (j = 0; j < sizes.length; j++) { crc1[i*sizes.length + j].reset(); crc1[i*sizes.length + j].update(b, offsets[i], sizes[j]); - } - } - } - - /* check correctness */ - for (i = 0; i < offsets.length; i++) { - for (j = 0; j < sizes.length; j++) { - if (!check(crc0[i*sizes.length + j], crc1[i*sizes.length + j])) { - System.out.printf("offsets[%d] = %d", i, offsets[i]); - System.out.printf("\tsizes[%d] = %d\n", j, sizes[j]); + check(crc1[i*sizes.length + j], crcReference[i*sizes.length + j]); } } }
--- a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -30,7 +30,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.runtime * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=true - * -XX:+EnableJVMCI + * -XX:+EnableJVMCI -Djvmci.Compiler=null * compiler.jvmci.JVM_GetJVMCIRuntimeTest * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=false @@ -39,7 +39,7 @@ * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=true * -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.threaded=true - * -XX:+EnableJVMCI + * -XX:+EnableJVMCI -Djvmci.Compiler=null * compiler.jvmci.JVM_GetJVMCIRuntimeTest * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=false
--- a/hotspot/test/compiler/jvmci/TestJVMCIPrintProperties.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/TestJVMCIPrintProperties.java Wed Jul 05 23:21:33 2017 +0200 @@ -36,11 +36,11 @@ public static void main(String[] args) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", - "-XX:+EnableJVMCI", + "-XX:+EnableJVMCI", "-Djvmci.Compiler=null", "-XX:+JVMCIPrintProperties"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("[JVMCI properties]"); // expected message - output.shouldContain("jvmci.Compiler = null"); // expected message + output.shouldContain("jvmci.Compiler := \"null\""); // expected message output.shouldContain("jvmci.InitTimer = false"); // expected message output.shouldContain("jvmci.PrintConfig = false"); // expected message output.shouldContain("jvmci.TraceMethodDataFilter = null"); // expected message
--- a/hotspot/test/compiler/jvmci/compilerToVM/AsResolvedJavaMethodTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/AsResolvedJavaMethodTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -34,7 +34,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.code * jdk.internal.vm.ci/jdk.vm.ci.meta * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.AsResolvedJavaMethodTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -39,6 +39,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.DoNotInlineOrCompileTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -36,6 +36,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.FindUniqueConcreteMethodTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -34,6 +34,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.code * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetBytecodeTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -31,6 +31,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetClassInitializerTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -38,6 +38,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetConstantPoolTest */ package compiler.jvmci.compilerToVM;
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -34,6 +34,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.code * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetExceptionTableTest */ @@ -137,4 +138,3 @@ } } } -
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -31,6 +31,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetImplementorTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -35,6 +35,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.code * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetLineNumberTableTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -38,6 +38,7 @@ * @compile -g DummyClass.java * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetLocalVariableTableTest * @clean compiler.jvmci.compilerToVM.* */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -35,6 +35,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.meta * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetNextStackFrameTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -38,6 +38,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetResolvedJavaMethodTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -44,7 +44,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI - * -XX:-UseCompressedOops + * -XX:-UseCompressedOops -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetResolvedJavaTypeTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -34,6 +34,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.code * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetStackTraceElementTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -35,6 +35,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.meta * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetSymbolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -34,6 +34,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.code * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.GetVtableIndexForInterfaceTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -39,7 +39,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI - * -XX:-BackgroundCompilation + * -XX:-BackgroundCompilation -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.HasCompiledCodeForOSRTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -31,7 +31,8 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI - * compiler.jvmci.compilerToVM.HasFinalizableSubclassTest + * -Djvmci.Compiler=null + * compiler.jvmci.compilerToVM.HasFinalizableSubclassTest */ package compiler.jvmci.compilerToVM;
--- a/hotspot/test/compiler/jvmci/compilerToVM/HasNeverInlineDirectiveTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/HasNeverInlineDirectiveTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -39,6 +39,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.HasNeverInlineDirectiveTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -42,6 +42,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/IsCompilableTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/IsCompilableTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -39,10 +39,12 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.IsCompilableTest * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.IsCompilableTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureVsReprofileTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureVsReprofileTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -38,6 +38,7 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Xbatch + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.IsMatureVsReprofileTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -42,6 +42,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.LookupKlassInPoolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -40,6 +40,7 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.LookupKlassRefIndexInPoolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -40,6 +40,7 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.LookupMethodInPoolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -40,6 +40,7 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.LookupNameAndTypeRefIndexInPoolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -41,6 +41,7 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.LookupNameInPoolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -41,6 +41,7 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.LookupSignatureInPoolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -31,6 +31,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.LookupTypeTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -49,6 +49,7 @@ * -XX:+DoEscapeAnalysis -XX:-UseCounterDecay * -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.materializeFirst=true * -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest * @run main/othervm -Xmixed -Xbatch -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI @@ -60,6 +61,7 @@ * -XX:+DoEscapeAnalysis -XX:-UseCounterDecay * -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.materializeFirst=false * -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest * @run main/othervm -Xmixed -Xbatch -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI @@ -71,6 +73,7 @@ * -XX:+DoEscapeAnalysis -XX:-UseCounterDecay * -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.materializeFirst=true * -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=true + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest * @run main/othervm -Xmixed -Xbatch -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI @@ -82,6 +85,7 @@ * -XX:+DoEscapeAnalysis -XX:-UseCounterDecay * -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.materializeFirst=false * -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=true + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -35,6 +35,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.code * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.MethodIsIgnoredBySecurityStackWalkTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/ReadConfigurationTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/ReadConfigurationTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -32,6 +32,7 @@ * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.ReadConfigurationTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.ReadConfigurationTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -40,7 +40,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI - * -Xmixed -Xbatch + * -Xmixed -Xbatch -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.ReprofileTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -40,6 +40,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.ResolveConstantInPoolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -40,6 +40,7 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.ResolveFieldInPoolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -34,6 +34,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.code * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.ResolveMethodTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -40,6 +40,7 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.ResolvePossiblyCachedConstantInPoolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -41,6 +41,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.ResolveTypeInPoolTest */
--- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -39,6 +39,7 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null * compiler.jvmci.compilerToVM.ShouldInlineMethodTest */
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java Wed Jul 05 23:21:33 2017 +0200 @@ -31,7 +31,8 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.internal.vm.ci/jdk.vm.ci.common * @compile CodeInstallerTest.java - * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidCompilationResult + * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null compiler.jvmci.errors.TestInvalidCompilationResult */ package compiler.jvmci.errors;
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java Wed Jul 05 23:21:33 2017 +0200 @@ -31,7 +31,8 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.internal.vm.ci/jdk.vm.ci.common * @compile CodeInstallerTest.java - * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidDebugInfo + * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null compiler.jvmci.errors.TestInvalidDebugInfo */ package compiler.jvmci.errors;
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java Wed Jul 05 23:21:33 2017 +0200 @@ -31,7 +31,8 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.internal.vm.ci/jdk.vm.ci.common * @compile CodeInstallerTest.java - * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidOopMap + * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * -Djvmci.Compiler=null compiler.jvmci.errors.TestInvalidOopMap */ package compiler.jvmci.errors;
--- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -49,21 +49,14 @@ * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Xbootclasspath/a:. -Xmixed * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI - * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false - * compiler.jvmci.events.JvmciNotifyInstallEventTest - * @run main/othervm -XX:+UnlockExperimentalVMOptions - * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed - * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI - * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false * compiler.jvmci.events.JvmciNotifyInstallEventTest * @run main/othervm -XX:+UnlockExperimentalVMOptions - * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed - * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:JVMCINMethodSizeLimit=0 - * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false + * -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed + * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI * compiler.jvmci.events.JvmciNotifyInstallEventTest - * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-EnableJVMCI - * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed - * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=true + * @run main/othervm -XX:+UnlockExperimentalVMOptions + * -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed + * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:JVMCINMethodSizeLimit=0 * compiler.jvmci.events.JvmciNotifyInstallEventTest */ @@ -91,8 +84,6 @@ public class JvmciNotifyInstallEventTest extends JVMCIServiceLocator implements HotSpotVMEventListener { private static final String METHOD_NAME = "testMethod"; - private static final boolean FAIL_ON_INIT = !Boolean.getBoolean( - "compiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit"); private static volatile int gotInstallNotification = 0; public static void main(String args[]) { @@ -116,16 +107,9 @@ codeCache = (HotSpotCodeCacheProvider) HotSpotJVMCIRuntime.runtime() .getHostJVMCIBackend().getCodeCache(); } catch (InternalError ie) { - if (FAIL_ON_INIT) { - throw new AssertionError( - "Got unexpected InternalError trying to get code cache", - ie); - } // passed return; } - Asserts.assertTrue(FAIL_ON_INIT, - "Haven't caught InternalError in negative case"); Method testMethod; try { testMethod = SimpleClass.class.getDeclaredMethod(METHOD_NAME);
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -33,7 +33,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.amd64 * jdk.internal.vm.ci/jdk.vm.ci.sparc * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.DataPatchTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.code.test.DataPatchTest */ package jdk.vm.ci.code.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -33,7 +33,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.amd64 * jdk.internal.vm.ci/jdk.vm.ci.sparc * @compile CodeInstallationTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.InterpreterFrameSizeTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.code.test.InterpreterFrameSizeTest */ package jdk.vm.ci.code.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -34,7 +34,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.amd64 * jdk.internal.vm.ci/jdk.vm.ci.sparc * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.MaxOopMapStackOffsetTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.code.test.MaxOopMapStackOffsetTest */ package jdk.vm.ci.code.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -33,7 +33,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.amd64 * jdk.internal.vm.ci/jdk.vm.ci.sparc * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.SimpleCodeInstallationTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.code.test.SimpleCodeInstallationTest */ package jdk.vm.ci.code.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -33,7 +33,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.amd64 * jdk.internal.vm.ci/jdk.vm.ci.sparc * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.SimpleDebugInfoTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.code.test.SimpleDebugInfoTest */ package jdk.vm.ci.code.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -33,7 +33,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.amd64 * jdk.internal.vm.ci/jdk.vm.ci.sparc * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.VirtualObjectDebugInfoTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.code.test.VirtualObjectDebugInfoTest */ package jdk.vm.ci.code.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -34,7 +34,7 @@ * @run driver ClassFileInstaller jdk.vm.ci.hotspot.test.DummyClass * @run testng/othervm/timeout=300 -Xbootclasspath/a:. * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI - * jdk.vm.ci.hotspot.test.HotSpotConstantReflectionProviderTest + * -Djvmci.Compiler=null jdk.vm.ci.hotspot.test.HotSpotConstantReflectionProviderTest */ package jdk.vm.ci.hotspot.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -37,7 +37,7 @@ * @run testng/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI - * jdk.vm.ci.hotspot.test.MemoryAccessProviderTest + * -Djvmci.Compiler=null jdk.vm.ci.hotspot.test.MemoryAccessProviderTest */ package jdk.vm.ci.hotspot.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -32,7 +32,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot:+open * @run testng/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI - * jdk.vm.ci.hotspot.test.MethodHandleAccessProviderTest + * -Djvmci.Compiler=null jdk.vm.ci.hotspot.test.MethodHandleAccessProviderTest */ package jdk.vm.ci.hotspot.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -28,7 +28,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ConstantTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.ConstantTest */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -29,7 +29,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.attach * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.RedefineClassTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.RedefineClassTest */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -26,7 +26,7 @@ * @requires vm.jvmci * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ResolvedJavaTypeResolveConcreteMethodTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.ResolvedJavaTypeResolveConcreteMethodTest */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -26,7 +26,7 @@ * @requires vm.jvmci * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ResolvedJavaTypeResolveMethodTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.ResolvedJavaTypeResolveMethodTest */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java Wed Jul 05 23:21:33 2017 +0200 @@ -28,7 +28,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestConstantReflectionProvider + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.TestConstantReflectionProvider */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java Wed Jul 05 23:21:33 2017 +0200 @@ -28,7 +28,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestJavaField + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.TestJavaField */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java Wed Jul 05 23:21:33 2017 +0200 @@ -28,7 +28,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestJavaMethod + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.TestJavaMethod */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java Wed Jul 05 23:21:33 2017 +0200 @@ -28,7 +28,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestJavaType + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.TestJavaType */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java Wed Jul 05 23:21:33 2017 +0200 @@ -28,7 +28,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestMetaAccessProvider + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.TestMetaAccessProvider */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java Wed Jul 05 23:21:33 2017 +0200 @@ -28,7 +28,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestResolvedJavaField + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.TestResolvedJavaField */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java Wed Jul 05 23:21:33 2017 +0200 @@ -28,7 +28,7 @@ * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestResolvedJavaMethod + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.TestResolvedJavaMethod */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Wed Jul 05 23:21:33 2017 +0200 @@ -30,7 +30,7 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.internal.vm.ci/jdk.vm.ci.common * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestResolvedJavaType + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.TestResolvedJavaType */ package jdk.vm.ci.runtime.test;
--- a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java Wed Jul 05 23:21:33 2017 +0200 @@ -34,7 +34,7 @@ * * @compile StableFieldTest.java * @run driver ClassFileInstaller compiler.jvmci.meta.StableFieldTest - * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Xbootclasspath/a:. compiler.jvmci.meta.StableFieldTest + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null -Xbootclasspath/a:. compiler.jvmci.meta.StableFieldTest */ package compiler.jvmci.meta;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/unsafe/TestRawAliasing.java Wed Jul 05 23:21:33 2017 +0200 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2017, 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 8178047 + * @run main/othervm -XX:CompileCommand=exclude,*.main -XX:-TieredCompilation -XX:-BackgroundCompilation compiler.unsafe.TestRawAliasing + * @modules java.base/jdk.internal.misc:+open + */ + +package compiler.unsafe; + +import java.lang.reflect.Field; + +public class TestRawAliasing { + static private final jdk.internal.misc.Unsafe UNSAFE; + static { + try { + Field f = jdk.internal.misc.Unsafe.class.getDeclaredField("theUnsafe"); + f.setAccessible(true); + UNSAFE = (jdk.internal.misc.Unsafe) f.get(null); + } catch (Exception e) { + throw new RuntimeException("Unable to get Unsafe instance.", e); + } + } + + static private final int OFFSET_X = 50; + static private final int OFFSET_Y = 100; + + private static int test(long base_plus_offset_x, long base_plus_offset_y, int magic_value) { + // write 0 to a location + UNSAFE.putByte(base_plus_offset_x - OFFSET_X, (byte)0); + // write unfoldable value to really the same location with another base + UNSAFE.putByte(base_plus_offset_y - OFFSET_Y, (byte)magic_value); + // read the value back, should be equal to "unfoldable_value" + return UNSAFE.getByte(base_plus_offset_x - OFFSET_X); + } + + private static final int OFF_HEAP_AREA_SIZE = 128; + private static final byte MAGIC = 123; + + // main is excluded from compilation since we don't want the test method to inline and make base values fold + public static void main(String... args) { + long base = UNSAFE.allocateMemory(OFF_HEAP_AREA_SIZE); + for (int i = 0; i < 100_000; i++) { + if (test(base + OFFSET_X, base + OFFSET_Y, MAGIC) != MAGIC) { + throw new RuntimeException("Unexpected magic value"); + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/gc/arguments/TestAggressiveHeap.java Wed Jul 05 23:21:33 2017 +0200 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2017, 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 TestAggressiveHeap + * @key gc + * @bug 8179084 + * @requires vm.gc.Parallel + * @summary Test argument processing for -XX:+AggressiveHeap. + * @library /test/lib + * @modules java.base java.management + * @run driver TestAggressiveHeap + */ + +import java.lang.management.ManagementFactory; +import javax.management.MBeanServer; +import javax.management.ObjectName; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class TestAggressiveHeap { + + public static void main(String args[]) throws Exception { + if (canUseAggressiveHeapOption()) { + testFlag(); + } + } + + // Note: Not a normal boolean flag; -XX:-AggressiveHeap is invalid. + private static final String option = "-XX:+AggressiveHeap"; + + // Option requires at least 256M, else error during option processing. + private static final long minMemory = 256 * 1024 * 1024; + + // bool UseParallelGC = true {product} {command line} + private static final String parallelGCPattern = + " *bool +UseParallelGC *= *true +\\{product\\} *\\{command line\\}"; + + private static void testFlag() throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + option, "-XX:+PrintFlagsFinal", "-version"); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + output.shouldHaveExitValue(0); + + String value = output.firstMatch(parallelGCPattern); + if (value == null) { + throw new RuntimeException( + option + " didn't set UseParallelGC as if from command line"); + } + } + + private static boolean haveRequiredMemory() throws Exception { + MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + ObjectName os = new ObjectName("java.lang", "type", "OperatingSystem"); + Object attr = server.getAttribute(os, "TotalPhysicalMemorySize"); + String value = attr.toString(); + long memory = Long.parseLong(value); + return memory >= minMemory; + } + + private static boolean canUseAggressiveHeapOption() throws Exception { + if (!haveRequiredMemory()) { + System.out.println( + "Skipping test of " + option + " : insufficient memory"); + return false; + } + return true; + } +} +
--- a/hotspot/test/gc/startup_warnings/TestCMS.java Mon May 08 14:04:27 2017 +0100 +++ b/hotspot/test/gc/startup_warnings/TestCMS.java Wed Jul 05 23:21:33 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ /* * @test TestCMS * @key gc -* @bug 8006398 8155948 -* @summary Test that CMS prints a warning message only for a commercial build +* @bug 8006398 8155948 8179013 +* @summary Test that CMS prints a warning message * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -33,19 +33,13 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.BuildHelper; public class TestCMS { public static void runTest(String[] args) throws Exception { - boolean isCommercial = BuildHelper.isCommercialBuild(); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - if (isCommercial) { - output.shouldContain("deprecated"); - } else { - output.shouldNotContain("deprecated"); - } + output.shouldContain("deprecated"); output.shouldNotContain("error"); output.shouldHaveExitValue(0); }
--- a/make/Bundles.gmk Mon May 08 14:04:27 2017 +0100 +++ b/make/Bundles.gmk Wed Jul 05 23:21:33 2017 +0200 @@ -183,29 +183,16 @@ $(JDK_SYMBOLS_EXCLUDE_PATTERN) \ $(JDK_EXTRA_EXCLUDES) \ $(SYMBOLS_EXCLUDE_PATTERN) \ - $(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \ , \ $(ALL_JDK_FILES) \ ) - DEMOS_BUNDLE_FILES := \ - $(filter-out \ - $(JDK_SYMBOLS_EXCLUDE_PATTERN) \ - $(SYMBOLS_EXCLUDE_PATTERN) \ - , \ - $(filter \ - $(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \ - $(JDK_IMAGE_HOMEDIR)/release \ - , \ - $(ALL_JDK_FILES) \ - ) \ - ) JDK_SYMBOLS_BUNDLE_FILES := \ $(filter \ $(JDK_SYMBOLS_EXCLUDE_PATTERN) \ $(SYMBOLS_EXCLUDE_PATTERN) \ , \ $(filter-out \ - $(JDK_IMAGE_HOMEDIR)/demo/% $(JDK_IMAGE_HOMEDIR)/sample/% \ + $(JDK_IMAGE_HOMEDIR)/demo/% \ , \ $(ALL_JDK_FILES) \ ) \ @@ -271,14 +258,6 @@ PRODUCT_TARGETS += $(BUILD_JRE_SYMBOLS_BUNDLE) - $(eval $(call SetupBundleFile, BUILD_DEMOS_BUNDLE, \ - BUNDLE_NAME := $(DEMOS_BUNDLE_NAME), \ - FILES := $(DEMOS_BUNDLE_FILES), \ - BASE_DIRS := $(JDK_IMAGE_DIR), \ - SUBDIR := $(JDK_BUNDLE_SUBDIR), \ - )) - - PRODUCT_TARGETS += $(BUILD_DEMOS_BUNDLE) endif ################################################################################
--- a/make/CompileJavaModules.gmk Mon May 08 14:04:27 2017 +0100 +++ b/make/CompileJavaModules.gmk Wed Jul 05 23:21:33 2017 +0200 @@ -461,12 +461,28 @@ # -parameters provides method's parameters information in class file, # JVMCI compilers make use of that information for various sanity checks. # Don't use Indy strings concatenation to have good JVMCI startup performance. +# The exports are needed since JVMCI is dynamically exported (see +# jdk.vm.ci.services.internal.ReflectionAccessJDK::openJVMCITo). jdk.internal.vm.ci_ADD_JAVAC_FLAGS := -parameters -Xlint:-exports -XDstringConcat=inline ################################################################################ -jdk.internal.vm.compiler_ADD_JAVAC_FLAGS := -parameters -XDstringConcat=inline +jdk.internal.vm.compiler_ADD_JAVAC_FLAGS := -parameters -XDstringConcat=inline \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.aarch64=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.amd64=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.code=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.code.site=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.code.stack=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.common=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.aarch64=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.amd64=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.sparc=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.meta=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.runtime=jdk.internal.vm.compiler \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.sparc=jdk.internal.vm.compiler \ + # jdk.internal.vm.compiler_EXCLUDES += \ org.graalvm.compiler.core.match.processor \ @@ -502,7 +518,27 @@ ################################################################################ -jdk.aot_ADD_JAVAC_FLAGS := -parameters -XDstringConcat=inline +# -parameters provides method's parameters information in class file, +# JVMCI compilers make use of that information for various sanity checks. +# Don't use Indy strings concatenation to have good JAOTC startup performance. +# The exports are needed since JVMCI is dynamically exported (see +# jdk.vm.ci.services.internal.ReflectionAccessJDK::openJVMCITo). + +jdk.aot_ADD_JAVAC_FLAGS := -parameters -XDstringConcat=inline \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.aarch64=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.amd64=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.code=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.code.site=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.code.stack=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.common=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.aarch64=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.amd64=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.sparc=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.meta=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.runtime=jdk.internal.vm.compiler,jdk.aot \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.sparc=jdk.internal.vm.compiler,jdk.aot \ + # ################################################################################
--- a/make/CreateJmods.gmk Mon May 08 14:04:27 2017 +0100 +++ b/make/CreateJmods.gmk Wed Jul 05 23:21:33 2017 +0200 @@ -135,8 +135,8 @@ $(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@) $(JMOD) create \ --module-version $(VERSION_SHORT) \ - --os-name '$(REQUIRED_OS_NAME)' \ - --os-arch '$(REQUIRED_OS_ARCH)' \ + --os-name '$(OPENJDK_MODULE_TARGET_OS_NAME)' \ + --os-arch '$(OPENJDK_MODULE_TARGET_OS_ARCH)' \ --module-path $(JMODS_DIR) \ --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \ $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@)
--- a/make/Help.gmk Mon May 08 14:04:27 2017 +0100 +++ b/make/Help.gmk Wed Jul 05 23:21:33 2017 +0200 @@ -47,7 +47,7 @@ $(info $(_) # dependencies for the target. This is faster but may) $(info $(_) # result in incorrect build results!) $(info $(_) make docs # Create all docs) - $(info $(_) make docs-javadoc # Create just javadocs, depends on less than full docs) + $(info $(_) make docs-jdk-api # Create just JDK javadocs) $(info $(_) make profiles # Create complete jre compact profile images) $(info $(_) make bootcycle-images # Build images twice, second time with newly built JDK) $(info $(_) make install # Install the generated images locally)
--- a/make/Images.gmk Mon May 08 14:04:27 2017 +0100 +++ b/make/Images.gmk Wed Jul 05 23:21:33 2017 +0200 @@ -119,7 +119,6 @@ --module-path $(IMAGES_OUTPUTDIR)/jmods \ --endian $(OPENJDK_BUILD_CPU_ENDIAN) \ --release-info $(BASE_RELEASE_FILE) \ - --release-info add:OS_VERSION=\"$(REQUIRED_OS_VERSION)\" \ --order-resources=$(call CommaList, $(JLINK_ORDER_RESOURCES)) \ --dedup-legal-notices=error-if-not-same-content \ $(JLINK_JLI_CLASSES) \ @@ -349,17 +348,6 @@ endif ################################################################################ -# /sample dir - -$(eval $(call SetupCopyFiles, COPY_SAMPLES, \ - SRC := $(SUPPORT_OUTPUTDIR)/sample/image, \ - DEST := $(JDK_IMAGE_DIR)/sample, \ - FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample/image), \ - $(call CacheFind,$(SUPPORT_OUTPUTDIR)/sample/image)))) - -JDK_TARGETS += $(COPY_SAMPLES) - -################################################################################ # Code coverage data files ifeq ($(GCOV_ENABLED), true)
--- a/make/Javadoc.gmk Mon May 08 14:04:27 2017 +0100 +++ b/make/Javadoc.gmk Wed Jul 05 23:21:33 2017 +0200 @@ -26,142 +26,38 @@ include $(SPEC) include MakeBase.gmk +include Modules.gmk +include ZipArchive.gmk include $(JDK_TOPDIR)/make/Tools.gmk include $(JDK_TOPDIR)/make/ModuleTools.gmk +# This is needed to properly setup DOCS_MODULES. +$(eval $(call ReadImportMetaData)) + ################################################################################ -# List of all possible directories for javadoc to look for sources -# Allow custom to overwrite. -JAVADOC_SOURCE_DIRS = \ - $(SUPPORT_OUTPUTDIR)/gensrc/* \ - $(addsuffix /*, $(IMPORT_MODULES_SRC)) \ - $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \ - $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \ - $(JDK_TOPDIR)/src/*/share/classes \ - $(HOTSPOT_TOPDIR)/src/*/share/classes \ - $(LANGTOOLS_TOPDIR)/src/*/share/classes \ - $(NASHORN_TOPDIR)/src/*/share/classes \ - $(CORBA_TOPDIR)/src/*/share/classes \ - $(JAXP_TOPDIR)/src/*/share/classes \ - $(JAXWS_TOPDIR)/src/*/share/classes \ - $(SUPPORT_OUTPUTDIR)/rmic/* \ - $(JDK_TOPDIR)/src/*/share/doc/stub \ - # +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, , Javadoc.gmk)) + +################################################################################ +# Javadoc settings + +# On top of the sources that was used to compile the JDK, we need some +# extra java.rmi sources that are used just for javadoc. +MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) \ + $(SUPPORT_OUTPUTDIR)/rmic/* $(JDK_TOPDIR)/src/*/share/doc/stub) # Should we use -Xdocrootparent? Allow custom to overwrite. -DOCROOTPARENT_FLAG = TRUE +DOCROOTPARENT_FLAG ?= TRUE # URLs JAVADOC_BASE_URL := http://docs.oracle.com/javase/$(VERSION_SPECIFICATION)/docs BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/ - -################################################################################ -# Text snippets - -FULL_COMPANY_NAME := Oracle and/or its affiliates -COMPANY_ADDRESS := 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA -BUG_SUBMIT_LINE := <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a> - -COMMON_BOTTOM_TEXT := $(BUG_SUBMIT_LINE)<br> Java is a trademark or registered \ - trademark of $(FULL_COMPANY_NAME) in the US and other countries. - -CORE_BOTTOM_COPYRIGHT_URL := {@docroot}/../legal/cpyr.html -CORE_BOTTOM_TEXT := \ - $(BUG_SUBMIT_LINE) \ - <br>For further API reference and developer documentation, see \ - <a href="$(JAVADOC_BASE_URL)/index.html" target="_blank">Java SE \ - Documentation</a>. That documentation contains more detailed, \ - developer-targeted descriptions, with conceptual overviews, definitions of \ - terms, workarounds, and working code examples. - -ifeq ($(VERSION_IS_GA), true) - DRAFT_MARKER := - DRAFT_WINDOW_TITLE_MARKER := - EARLYACCESS_TOP := -else - # We need a draft format when not building the GA version. - DRAFT_MARKER := <br><strong>DRAFT $(VERSION_STRING)</strong> - ifeq ($(VERSION_BUILD), 0) - DRAFT_WINDOW_TITLE_MARKER := $(SPACE)[ad-hoc build] - else - DRAFT_WINDOW_TITLE_MARKER := $(SPACE)[build $(VERSION_BUILD)] - endif - EARLYACCESS_TOP := \ - <div style="background-color: $(HASH)EEEEEE"><div style="padding: 6px; \ - margin-top: 2px; margin-bottom: 6px; margin-left: 6px; margin-right: \ - 6px; text-align: justify; font-size: 80%; font-family: Helvetica, Arial, \ - sans-serif; font-weight: normal;">Please note that the specifications \ - and other information contained herein are not final and are subject to \ - change. The information is being made available to you solely for \ - purpose of evaluation.</div></div> -endif - -################################################################################ -# Special treatment for the core package list. All separate "small" javadoc -# invocation needs to be able to see the core package list. - -ALL_PKG_DIRS := $(dir $(filter %.java, $(call CacheFind, \ - $(wildcard $(JAVADOC_SOURCE_DIRS))))) -ALL_SRC_PREFIXES := $(addsuffix /%, $(wildcard $(JAVADOC_SOURCE_DIRS))) -ALL_PKG_DIRNAMES := $(foreach prefix, $(ALL_SRC_PREFIXES), \ - $(patsubst $(prefix),%, $(filter $(prefix), $(ALL_PKG_DIRS)))) -ALL_PACKAGES := $(sort $(subst /,., $(patsubst %/, %, $(ALL_PKG_DIRNAMES)))) - -# Core packages are all packages beginning with java, javax or org, except a few -# excludes. -JAVA_PACKAGES := $(filter java.%, $(ALL_PACKAGES)) -JAVAX_PACKAGES := $(filter javax.%, $(ALL_PACKAGES)) -ORG_PACKAGES := $(filter org.%, $(ALL_PACKAGES)) - -# Allow custom makefile to add more excluded packages -CORE_EXCLUDED_PACKAGES += \ - java.awt.dnd.peer \ - java.awt.peer \ - javax.smartcardio \ - org.jcp.xml.dsig.internal% \ - org.w3c.dom.css \ - org.w3c.dom.html \ - org.w3c.dom.stylesheets \ - org.w3c.dom.xpath \ - org.graalvm.compiler.% \ - # - -CORE_PACKAGES := $(filter-out $(CORE_EXCLUDED_PACKAGES), \ - $(JAVA_PACKAGES) $(JAVAX_PACKAGES) $(ORG_PACKAGES)) - -CORE_PACKAGES_LIST_DIR := $(SUPPORT_OUTPUTDIR)/docs/core-packages -CORE_PACKAGES_LIST_FILE := $(CORE_PACKAGES_LIST_DIR)/package-list - -CORE_PACKAGES_VARDEPS_FILE := $(call DependOnVariable, CORE_PACKAGES, \ - $(CORE_PACKAGES_LIST_FILE).vardeps) - -$(CORE_PACKAGES_LIST_FILE): $(CORE_PACKAGES_VARDEPS_FILE) - $(call MakeDir, $(@D)) - $(eval $(call ListPathsSafely, CORE_PACKAGES, $@)) - -################################################################################ -# Support functions for SetupJavadocGeneration - -# Generate the text used in the -bottom argument. -# Note that COPYRIGHT_YEAR is the current year (from spec.gmk) -# Arguments: -# arg 1: first copyright year -# arg 2: copyright url (optional) -# arg 3: free-form text snippet (optional) -define GenerateBottom - <span style="font-size:smaller">$(if $(strip $3), $(strip $3))<br> $(if \ - $(strip $2),<a href="$(strip $2)">Copyright</a>,Copyright) \ - © $(strip $1), $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME). \ - $(COMPANY_ADDRESS). All rights reserved.</span> -endef - -# Speed up finding by filling cache -$(eval $(call FillCacheFind, $(wildcard $(JAVADOC_SOURCE_DIRS)))) +COPYRIGHT_URL := {@docroot}/../legal/cpyr.html # In order to get a specific ordering it's necessary to specify the total # ordering of tags as the tags are otherwise ordered in order of definition. -DEFAULT_JAVADOC_TAGS := \ +JAVADOC_TAGS := \ -tag beaninfo:X \ -tag revised:X \ -tag since.unbundled:X \ @@ -183,596 +79,377 @@ -tag see \ -tag 'jvms:a:See <cite>The Java™ Virtual Machine Specification</cite>:' \ -tag 'jls:a:See <cite>The Java™ Language Specification</cite>:' \ + -taglet build.tools.taglet.ExtLink \ -taglet build.tools.taglet.Incubating \ -tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \ + $(CUSTOM_JAVADOC_TAGS) \ # -DEFAULT_JAVADOC_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \ - -serialwarn -encoding ISO-8859-1 -breakiterator --system none +# Which doclint checks to ignore +JAVADOC_DISABLED_DOCLINT := accessibility html missing syntax reference -# -# TODO: this should be set by the configure option. -# -ifndef ENABLE_MODULE_GRAPH - ENABLE_MODULE_GRAPH=false +# The initial set of options for javadoc +JAVADOC_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \ + -serialwarn -encoding ISO-8859-1 -breakiterator -splitIndex --system none \ + -html5 -javafx --expand-requires transitive + +# Should we add DRAFT stamps to the generated javadoc? +ifeq ($(VERSION_IS_GA), true) + IS_DRAFT := false +else + IS_DRAFT := true endif ################################################################################ -# Setup make rules for running javadoc. -# -# Parameter 1 is the name of the rule. This name is used as variable prefix, -# and the targets generated are listed in a variable by that name. Note that -# the index.html file will work as a "touch file" for all the magnitude of -# files that are generated by javadoc. -# -# Remaining parameters are named arguments. These include: -# MODULES - Modules to include -# PACKAGES - Packages to include -# IS_CORE - Set to TRUE for the Core API package which needs special treatment -# API_ROOT - Where to base the documentation (jre or jdk) -# DEST_DIR - A directory relative to the API root -# OVERVIEW - Path to a html overview file -# TITLE - Default title to use for the more specific versions below -# WINDOW_TITLE - Title to use in -windowtitle. Computed from TITLE if empty. -# HEADER_TITLE - Title to use in -header. Computed from TITLE if empty. -# DOC_TITLE - Title to use in -doctitle. Computed from TITLE if empty. -# FIRST_COPYRIGHT_YEAR - First year this bundle was introduced -# DISABLED_DOCLINT - Doclint warnings to exclude. -# DOCLINT_PACKAGES - Optional -Xdoclint/package value -# SPLIT_INDEX - Enable -splitIndex (split index-all.html if it is too large) -# BOTTOM_COPYRIGHT_URL - Copyright URL to use in -bottom -# BOTTOM_TEXT - Extra text to use in -bottom -# EXTRA_TOP - Additional -top data -# -SetupJavadocGeneration = $(NamedParamsMacroTemplate) -define SetupJavadocGenerationBody - ifeq ($$($1_IS_CORE), TRUE) - $1_JAVA := $$(JAVA) - $1_OUTPUT_DIRNAME := api +# General text snippets + +FULL_COMPANY_NAME := Oracle and/or its affiliates +COMPANY_ADDRESS := 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA + +ifeq ($(IS_DRAFT), true) + DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong> + ifeq ($(VERSION_BUILD), 0) + DRAFT_MARKER_TITLE := [ad-hoc build] else - $1_JAVA := $$(JAVA_SMALL) - $1_OUTPUT_DIRNAME := $$($1_API_ROOT)/api/$$($1_DEST_DIR) + DRAFT_MARKER_TITLE := [build $(VERSION_BUILD)] + endif +endif - # Compute a relative path to core root. - # The non-core api javadocs need to be able to access the root of the core - # api directory, so for jdk/api or jre/api to get to the core api/ - # directory we would use this - $1_RELATIVE_CORE_DIR := $$(call DirToDotDot, $$($1_OUTPUT_DIRNAME))/api +JAVADOC_WINDOW_TITLE := Java Platform SE $(VERSION_SPECIFICATION) \ + $(DRAFT_MARKER_TITLE) - # We need to tell javadoc the directory in which to find the core package-list - $1_OPTIONS += -linkoffline $$($1_RELATIVE_CORE_DIR) $$(CORE_PACKAGES_LIST_DIR) - - $1_DEPS += $(CORE_PACKAGES_LIST_FILE) - endif - - $1_OPTIONS += --add-modules $$(call CommaList, $$($1_MODULES)) +JAVADOC_HEADER_TITLE := $(subst $(SPACE), ,$(strip \ + <strong>Java™ Platform<br>Standard Ed. \ + $(VERSION_SPECIFICATION)</strong>$(DRAFT_MARKER_STR))) - ifneq ($$($1_DISABLED_DOCLINT), ) - # Create a string like ",-syntax,-html" - $1_DOCLINT_EXCEPTIONS := ,$$(call CommaList, $$(addprefix -, $$($1_DISABLED_DOCLINT))) - endif - $1_OPTIONS += -Xdoclint:all$$($1_DOCLINT_EXCEPTIONS) - - ifneq ($$($1_DOCLINT_PACKAGES), ) - $1_OPTIONS += -Xdoclint/package:$$(call CommaList, $$($1_DOCLINT_PACKAGES)) - endif - - ifeq ($$($1_DOC_TITLE), ) - $1_DOC_TITLE := $$($1_TITLE) - endif - $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)' - - ifeq ($$($1_WINDOW_TITLE), ) - $1_WINDOW_TITLE := $$(strip $$(subst ™,, $$($1_TITLE))) - endif - $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)$$(DRAFT_WINDOW_TITLE_MARKER)' +JAVADOC_BOTTOM := \ + <span style="font-size:smaller"> \ + <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a><br> \ + For further API reference and developer documentation, see \ + <a href="$(JAVADOC_BASE_URL)/index.html" target="_blank">Java SE \ + Documentation</a>. That documentation contains more detailed, \ + developer-targeted descriptions, with conceptual overviews, definitions \ + of terms, workarounds, and working code examples.<br> \ + Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \ + the US and other countries.<br> \ + <a href="$(COPYRIGHT_URL)">Copyright</a> \ + © 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME). \ + $(COMPANY_ADDRESS). All rights reserved.$(DRAFT_MARKER_STR)</span> - ifeq ($$($1_HEADER_TITLE), ) - $1_HEADER_TITLE := $$(strip $$(subst ™,, $$($1_TITLE))) - endif - $1_OPTIONS += -header '<strong>$$($1_HEADER_TITLE)</strong>$$(DRAFT_MARKER)' - - ifneq ($$($1_EXTRA_TOP), ) - $1_OPTIONS += -top '$$($1_EXTRA_TOP)' - endif - - ifeq ($$($1_BOTTOM_TEXT), ) - $1_BOTTOM_TEXT := $(COMMON_BOTTOM_TEXT) - endif - $1_BOTTOM := $$(call GenerateBottom, $$($1_FIRST_COPYRIGHT_YEAR), \ - $$($1_BOTTOM_COPYRIGHT_URL), $$($1_BOTTOM_TEXT)) - $1_OPTIONS += -bottom '$$($1_BOTTOM)$$(DRAFT_MARKER)' +JAVADOC_TOP := \ + <div style="background-color: $(HASH)EEEEEE"><div style="padding: 6px; \ + margin-top: 2px; margin-bottom: 6px; margin-left: 6px; margin-right: \ + 6px; text-align: justify; font-size: 80%; font-family: Helvetica, Arial, \ + sans-serif; font-weight: normal;">Please note that the specifications \ + and other information contained herein are not final and are subject to \ + change. The information is being made available to you solely for \ + purpose of evaluation.</div></div> - ifneq ($$($1_OVERVIEW), ) - $1_OPTIONS += -overview $$($1_OVERVIEW) - $1_DEPS += $$($1_OVERVIEW) - endif +################################################################################ +# JDK javadoc titles/text snippets + +JDK_JAVADOC_DOC_TITLE := Java™ Platform, Standard Edition Development Kit \ + (JDK™) $(VERSION_SPECIFICATION)<br>API Specification - ifneq ($$($1_SPLIT_INDEX), ) - $1_OPTIONS += -splitIndex - endif +################################################################################ +# Java SE javadoc titles/text snippets - ifneq ($$($DOCROOTPARENT_FLAG), ) - $1_OPTIONS += -Xdocrootparent $(JAVADOC_BASE_URL) - endif - - $1_VARDEPS := $$($1_OPTIONS) $$($1_PACKAGES) - $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ - $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps) +JAVASE_JAVADOC_DOC_TITLE := Java™ Platform, Standard Edition \ + $(VERSION_SPECIFICATION)<br>API Specification - # Do not store debug level options in VARDEPS. - ifneq ($$(LOG_LEVEL), trace) - $1_OPTIONS += -quiet - else - $1_OPTIONS += -verbose - endif - - $1_PACKAGE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach p, \ - $$(subst .,/,$$(strip $$($1_PACKAGES))), \ - $$(addsuffix /$$p, $$(wildcard $$(JAVADOC_SOURCE_DIRS)))))) - - # If there are many packages, use an @-file... - ifneq ($$(word 17, $$($1_PACKAGES)), ) - $1_PACKAGES_FILE := $$(SUPPORT_OUTPUTDIR)/docs/$1.packages - $1_PACKAGES_ARG := @$$($1_PACKAGES_FILE) - else - $1_PACKAGES_ARG := $$($1_PACKAGES) - endif +################################################################################ +# Functions - # The index.html which is a marker for all the output from javadoc. - $1_INDEX_FILE := $$(JAVADOC_OUTPUTDIR)/$$($1_OUTPUT_DIRNAME)/index.html +# Helper function for creating a png file from a dot file generated by the +# GenGraphs tool. +# param 1: SetupJavadocGeneration namespace ($1) +# param 2: module name +# +define setup_gengraph_dot_to_png + $1_$2_DOT_SRC := $$($1_GENGRAPHS_DIR)/$2.dot + $1_$2_PNG_TARGET := $$($1_TARGET_DIR)/$2-graph.png - # Rule for actually running javadoc - $$($1_INDEX_FILE): $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) $$($1_PACKAGE_DEPS) $$($1_DEPS) - $$(call LogWarn, Generating Javadoc from $$(words $$($1_PACKAGES)) package(s) for $$($1_OUTPUT_DIRNAME)) + # For each module needing a graph, create a png file from the dot file + # generated by the GenGraphs tool and store it in the target dir. + $$($1_$2_PNG_TARGET): $$($1_GENGRAPHS_MARKER) $$(call MakeDir, $$(@D)) - ifneq ($$($1_PACKAGES_FILE), ) - $$(eval $$(call ListPathsSafely, $1_PACKAGES, $$($1_PACKAGES_FILE))) - endif - $$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/docs/$1.javadoc, \ - $$($1_JAVA) -Djava.awt.headless=true -DenableModuleGraph=$(ENABLE_MODULE_GRAPH) \ - $(NEW_JAVADOC) -d $$(@D) \ - $$(DEFAULT_JAVADOC_TAGS) $$(DEFAULT_JAVADOC_OPTIONS) \ - --module-source-path $$(call PathList, $$(JAVADOC_SOURCE_DIRS)) \ - $$($1_OPTIONS) $$($1_PACKAGES_ARG)) + $$(call ExecuteWithLog, $$($1_$2_DOT_SRC), \ + $$(DOT) -Tpng -o $$($1_$2_PNG_TARGET) $$($1_$2_DOT_SRC)) - # The output returned will be the index.html file - $1 := $$($1_INDEX_FILE) + $1_MODULEGRAPH_TARGETS += $$($1_$2_PNG_TARGET) endef ################################################################################ +# Setup make rules for creating the API documentation, using javadoc and other +# tools if needed. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix. +# Targets generated are returned as $1_JAVADOC_TARGETS and +# $1_MODULEGRAPH_TARGETS. Note that the index.html file will work as a "touch +# file" for all the magnitude of files that are generated by javadoc. +# +# Remaining parameters are named arguments. These include: +# MODULES - Modules to generate javadoc for +# NAME - The name of the javadoc compilation, to be presented to the user +# TARGET_DIR - Where to store the output +# OVERVIEW - Path to an html overview file +# DOC_TITLE - Title to use in -doctitle. +# WINDOW_TITLE - Title to use in -windowtitle. +# HEADER_TITLE - Title to use in -header. +# BOTTOM_TEXT - Text to use in -bottom. +# TOP_TEXT - Text to use in -top. +# +SetupApiDocsGeneration = $(NamedParamsMacroTemplate) +define SetupApiDocsGenerationBody -$(eval $(call SetupJavadocGeneration, coredocs, \ - MODULES := java.se.ee, \ - PACKAGES := $(CORE_PACKAGES), \ - IS_CORE := TRUE, \ - OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html, \ - WINDOW_TITLE := Java Platform SE $(VERSION_SPECIFICATION), \ - HEADER_TITLE := Java™ Platform<br>Standard Ed. $(VERSION_SPECIFICATION), \ - DOC_TITLE := Java™ Platform$(COMMA) Standard Edition \ - $(VERSION_SPECIFICATION)<br>API Specification, \ - FIRST_COPYRIGHT_YEAR := 1993, \ - DISABLED_DOCLINT := accessibility html missing syntax, \ - DOCLINT_PACKAGES := -org.omg.* jdk.internal.logging.*, \ - SPLIT_INDEX := TRUE, \ - BOTTOM_COPYRIGHT_URL := $(CORE_BOTTOM_COPYRIGHT_URL), \ - BOTTOM_TEXT := $(CORE_BOTTOM_TEXT), \ - EXTRA_TOP := $(EARLYACCESS_TOP), \ -)) - -TARGETS += $(coredocs) - -################################################################################ - -$(eval $(call SetupJavadocGeneration, docletapi, \ - MODULES := jdk.javadoc, \ - PACKAGES := \ - jdk.javadoc.doclet, \ - API_ROOT := jdk, \ - DEST_DIR := javadoc/doclet, \ - TITLE := Doclet API, \ - FIRST_COPYRIGHT_YEAR := 1993, \ -)) - -TARGETS += $(docletapi) - -################################################################################ + # Figure out all modules, both specified and transitive, that will be processed + # by javadoc. + $1_TRANSITIVE_MODULES := $$(call FindTransitiveDepsForModules, $$($1_MODULES)) + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_TRANSITIVE_MODULES)) -$(eval $(call SetupJavadocGeneration, old-docletapi, \ - MODULES := jdk.javadoc, \ - PACKAGES := com.sun.javadoc, \ - API_ROOT := jdk, \ - DEST_DIR := javadoc/old/doclet, \ - TITLE := Doclet API, \ - FIRST_COPYRIGHT_YEAR := 1993, \ -)) - -TARGETS += $(old-docletapi) - -################################################################################ + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created + # png files with module graphs. + $1_JAVA_ARGS += -DenableModuleGraph=true + endif -$(eval $(call SetupJavadocGeneration, tagletapi, \ - MODULES := jdk.javadoc, \ - PACKAGES := com.sun.tools.doclets, \ - API_ROOT := jdk, \ - DEST_DIR := javadoc/old/taglet, \ - TITLE := Taglet API, \ - FIRST_COPYRIGHT_YEAR := 1993, \ -)) + # Always include tags and basic options + $1_OPTIONS := $$(JAVADOC_TAGS) $$(JAVADOC_OPTIONS) -TARGETS += $(tagletapi) - -################################################################################ + $1_OPTIONS += -overview $$($1_OVERVIEW) + $1_OPTIONS += --module-source-path $$(MODULES_SOURCE_PATH) + $1_OPTIONS += --module $$(call CommaList, $$($1_MODULES)) -$(eval $(call SetupJavadocGeneration, domapi, \ - MODULES := \ - java.xml \ - jdk.xml.dom, \ - PACKAGES := \ - org.w3c.dom \ - org.w3c.dom.bootstrap \ - org.w3c.dom.ls \ - org.w3c.dom.ranges \ - org.w3c.dom.traversal \ - org.w3c.dom.html \ - org.w3c.dom.stylesheets \ - org.w3c.dom.css \ - org.w3c.dom.events \ - org.w3c.dom.views, \ - API_ROOT := jre, \ - DEST_DIR := plugin/dom, \ - TITLE := Common DOM API, \ - FIRST_COPYRIGHT_YEAR := 2005, \ - DISABLED_DOCLINT := accessibility html missing, \ - SPLIT_INDEX := TRUE, \ -)) + # Create a string like "-Xdoclint:all,-syntax,-html,..." + $1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \ + $$(JAVADOC_DISABLED_DOCLINT))) + + ifeq ($$($$DOCROOTPARENT_FLAG), TRUE) + $1_OPTIONS += -Xdocrootparent $$(JAVADOC_BASE_URL) + endif -TARGETS += $(domapi) - -################################################################################ + $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)' + $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)' + $1_OPTIONS += -header '$$($1_HEADER_TITLE)' + $1_OPTIONS += -bottom '$$($1_BOTTOM_TEXT)' + ifeq ($$(IS_DRAFT), true) + $1_OPTIONS += -top '$$($1_TOP_TEXT)' + endif -$(eval $(call SetupJavadocGeneration, jdi, \ - MODULES := jdk.jdi, \ - PACKAGES := \ - com.sun.jdi \ - com.sun.jdi.event \ - com.sun.jdi.request \ - com.sun.jdi.connect \ - com.sun.jdi.connect.spi, \ - API_ROOT := jdk, \ - DEST_DIR := jpda/jdi, \ - OVERVIEW := $(JDK_TOPDIR)/src/jdk.jdi/share/classes/jdi-overview.html, \ - TITLE := Java™ Debug Interface, \ - FIRST_COPYRIGHT_YEAR := 1999, \ - DISABLED_DOCLINT := accessibility missing syntax, \ - SPLIT_INDEX := TRUE, \ -)) + # Do not store debug level options in VARDEPS. + ifneq ($$(LOG_LEVEL), trace) + $1_LOG_OPTION += -quiet + else + $1_LOG_OPTION += -verbose + endif -TARGETS += $(jdi) + $1_VARDEPS := $$($1_JAVA_ARGS) $$($1_OPTIONS) $$(MODULES_SOURCE_PATH) \ + $$($1_ALL_MODULES) + $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ + $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps) -################################################################################ + # Get a list of all files in all the source dirs for all included modules + $1_SOURCE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach module, \ + $$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module))))) -$(eval $(call SetupJavadocGeneration, jaas, \ - MODULES := jdk.security.auth, \ - PACKAGES := \ - com.sun.security.auth \ - com.sun.security.auth.callback \ - com.sun.security.auth.login \ - com.sun.security.auth.module, \ - API_ROOT := jre, \ - DEST_DIR := security/jaas/spec, \ - OVERVIEW := $(JDK_TOPDIR)/src/jdk.security.auth/share/classes/jaas-overview.html, \ - TITLE := Java™ Authentication and Authorization Service, \ - FIRST_COPYRIGHT_YEAR := 1998, \ - DISABLED_DOCLINT := missing, \ -)) + # Javadoc creates a lot of files but use index.html as a marker + $$($1_TARGET_DIR)/index.html: $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) \ + $$($1_SOURCE_DEPS) $$($1_OVERVIEW) + $$(call LogWarn, Generating $$($1_NAME) API javadoc for \ + $$(words $$($1_ALL_MODULES)) modules) + $$(call LogInfo, Javadoc modules: $$($1_ALL_MODULES)) + $$(call MakeDir, $$($1_TARGET_DIR)) + $$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/docs/$1, \ + $$(JAVA) -Djava.awt.headless=true $$($1_JAVA_ARGS) \ + $$(NEW_JAVADOC) -d $$($1_TARGET_DIR) \ + $$(JAVADOC_TAGS) $$($1_OPTIONS) $$($1_LOG_OPTION)) -TARGETS += $(jaas) - -################################################################################ + $1_JAVADOC_TARGETS := $$($1_TARGET_DIR)/index.html -$(eval $(call SetupJavadocGeneration, jgss, \ - MODULES := jdk.security.jgss, \ - PACKAGES := com.sun.security.jgss, \ - API_ROOT := jre, \ - DEST_DIR := security/jgss/spec, \ - OVERVIEW := $(JDK_TOPDIR)/src/java.security.jgss/share/classes/jgss-overview.html, \ - TITLE := Java™ GSS-API Utilities, \ - FIRST_COPYRIGHT_YEAR := 2000, \ -)) - -TARGETS += $(jgss) + ifeq ($$(ENABLE_FULL_DOCS), true) + # We have asked ModuleGraph to generate links to png files. Now we must + # produce the png files. -################################################################################ + # Locate which modules has the @moduleGraph tag in their module-info.java + $1_MODULES_NEEDING_GRAPH := $$(strip $$(foreach m, $$($1_ALL_MODULES), \ + $$(if $$(shell $$(GREP) -e @moduleGraph \ + $$(wildcard $$(addsuffix /module-info.java, \ + $$(call FindModuleSrcDirs, $$m)))), \ + $$m) \ + )) -$(eval $(call SetupJavadocGeneration, smartcardio, \ - MODULES := java.smartcardio, \ - PACKAGES := javax.smartcardio, \ - API_ROOT := jre, \ - DEST_DIR := security/smartcardio/spec, \ - TITLE := Java™ Smart Card I/O, \ - FIRST_COPYRIGHT_YEAR := 2005, \ -)) - -TARGETS += $(smartcardio) - -################################################################################ + # First we run the GenGraph tool. It will query the module structure of the + # running JVM and output .dot files for all existing modules. + GENGRAPHS_PROPS := \ + $$(JDK_TOPDIR)/make/src/classes/build/tools/jigsaw/javadoc-graphs.properties -$(eval $(call SetupJavadocGeneration, httpserver, \ - MODULES := jdk.httpserver, \ - PACKAGES := \ - com.sun.net.httpserver \ - com.sun.net.httpserver.spi, \ - API_ROOT := jre, \ - DEST_DIR := net/httpserver/spec, \ - TITLE := Java™ HTTP Server, \ - FIRST_COPYRIGHT_YEAR := 2005, \ - DISABLED_DOCLINT := accessibility missing syntax, \ -)) - -TARGETS += $(httpserver) + $1_GENGRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-gengraphs + $1_GENGRAPHS_MARKER := $$($1_GENGRAPHS_DIR)/_gengraphs_run.marker -################################################################################ + $$($1_GENGRAPHS_MARKER): $$(BUILD_JIGSAW_TOOLS) $$(GENGRAPHS_PROPS) + $$(call LogInfo, Running gengraphs for $$($1_NAME) API documentation) + $$(call MakeDir, $$($1_GENGRAPHS_DIR)) + $$(call ExecuteWithLog, $$($1_GENGRAPHS_DIR)/gengraphs, \ + $$(TOOL_GENGRAPHS) --spec --output $$($1_GENGRAPHS_DIR) \ + --dot-attributes $$(GENGRAPHS_PROPS) && \ + $$(TOUCH) $$($1_GENGRAPHS_MARKER)) -$(eval $(call SetupJavadocGeneration, httpclient, \ - MODULES := jdk.incubator.httpclient, \ - PACKAGES := \ - jdk.incubator.http, \ - API_ROOT := jre, \ - DEST_DIR := incubator/httpclient/spec, \ - TITLE := Java™ HTTP Client API (incubator module), \ - FIRST_COPYRIGHT_YEAR := 2015, \ - DISABLED_DOCLINT := accessibility missing syntax, \ -)) - -TARGETS += $(httpclient) + # For each module needing a graph, create a png file from the dot file + # generated by the GenGraphs tool and store it in the target dir. + # They will depend on $1_GENGRAPHS_MARKER, and will be added to $1. + $$(foreach m, $$($1_MODULES_NEEDING_GRAPH), \ + $$(eval $$(call setup_gengraph_dot_to_png,$1,$$m)) \ + ) + endif +endef ################################################################################ +# Setup generation of the JDK API documentation (javadoc + modulegraph) -$(eval $(call SetupJavadocGeneration, jsobject, \ - MODULES := jdk.jsobject, \ - PACKAGES := netscape.javascript, \ - API_ROOT := jre, \ - DEST_DIR := plugin/jsobject, \ - FIRST_COPYRIGHT_YEAR := 1993, \ - TITLE := Java™ JSObject Doc, \ +# All modules to have docs generated by docs-jdk-api target +JDK_JAVADOC_MODULES := $(sort $(DOCS_MODULES)) + +JDK_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html + +$(eval $(call SetupApiDocsGeneration, JDK_API, \ + MODULES := $(JDK_JAVADOC_MODULES), \ + NAME := JDK, \ + TARGET_DIR := $(JAVADOC_OUTPUTDIR)/api, \ + OVERVIEW := $(JDK_JAVADOC_OVERVIEW), \ + DOC_TITLE := $(JDK_JAVADOC_DOC_TITLE), \ + WINDOW_TITLE := $(JAVADOC_WINDOW_TITLE), \ + HEADER_TITLE := $(JAVADOC_HEADER_TITLE), \ + BOTTOM_TEXT := $(JAVADOC_BOTTOM), \ + TOP_TEXT := $(JAVADOC_TOP), \ )) -TARGETS += $(jsobject) - -################################################################################ - -$(eval $(call SetupJavadocGeneration, mgmt, \ - MODULES := jdk.management, \ - PACKAGES := com.sun.management, \ - API_ROOT := jre, \ - DEST_DIR := management/extension, \ - OVERVIEW := $(JDK_TOPDIR)/src/java.management/share/classes/mgmt-overview.html, \ - TITLE := Monitoring and Management Interface for the Java™ Platform, \ - FIRST_COPYRIGHT_YEAR := 2003, \ - DISABLED_DOCLINT := accessibility missing reference, \ -)) - -TARGETS += $(mgmt) - -################################################################################ - -$(eval $(call SetupJavadocGeneration, attach, \ - MODULES := jdk.attach, \ - PACKAGES := \ - com.sun.tools.attach \ - com.sun.tools.attach.spi, \ - API_ROOT := jdk, \ - DEST_DIR := attach/spec, \ - TITLE := Attach API, \ - FIRST_COPYRIGHT_YEAR := 2005, \ - DISABLED_DOCLINT := reference, \ -)) - -TARGETS += $(attach) +# Targets generated are returned in JDK_API_JAVADOC_TARGETS and +# JDK_API_MODULEGRAPH_TARGETS. ################################################################################ +# Setup generation of the Java SE API documentation (javadoc + modulegraph) -$(eval $(call SetupJavadocGeneration, jconsole, \ - MODULES := jdk.jconsole, \ - PACKAGES := com.sun.tools.jconsole, \ - API_ROOT := jdk, \ - DEST_DIR := jconsole/spec, \ - TITLE := JConsole API, \ - FIRST_COPYRIGHT_YEAR := 2006, \ +# The Java SE module scope is just java.se.ee and it's transitive modules. +JAVASE_JAVADOC_MODULES := java.se.ee + +JAVASE_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html + +$(eval $(call SetupApiDocsGeneration, JAVASE_API, \ + MODULES := $(JAVASE_JAVADOC_MODULES), \ + NAME := Java SE, \ + TARGET_DIR := $(IMAGES_OUTPUTDIR)/javase-docs/api, \ + OVERVIEW := $(JAVASE_JAVADOC_OVERVIEW), \ + DOC_TITLE := $(JAVASE_JAVADOC_DOC_TITLE), \ + WINDOW_TITLE := $(JAVADOC_WINDOW_TITLE), \ + HEADER_TITLE := $(JAVADOC_HEADER_TITLE), \ + BOTTOM_TEXT := $(JAVADOC_BOTTOM), \ + TOP_TEXT := $(JAVADOC_TOP), \ )) -TARGETS += $(jconsole) - -################################################################################ - -$(eval $(call SetupJavadocGeneration, jshellapi, \ - MODULES := jdk.jshell, \ - PACKAGES := \ - jdk.jshell \ - jdk.jshell.spi \ - jdk.jshell.execution \ - jdk.jshell.tool, \ - API_ROOT := jdk, \ - DEST_DIR := jshell, \ - TITLE := JShell API, \ - FIRST_COPYRIGHT_YEAR := 2015, \ - SPLIT_INDEX := TRUE, \ -)) - -TARGETS += $(jshellapi) - -################################################################################ - -$(eval $(call SetupJavadocGeneration, treeapi, \ - MODULES := jdk.compiler, \ - PACKAGES := \ - com.sun.source.doctree \ - com.sun.source.tree \ - com.sun.source.util, \ - API_ROOT := jdk, \ - DEST_DIR := javac/tree, \ - TITLE := Compiler Tree API, \ - FIRST_COPYRIGHT_YEAR := 2005, \ - SPLIT_INDEX := TRUE, \ -)) - -TARGETS += $(treeapi) +# Targets generated are returned in JAVASE_API_JAVADOC_TARGETS and +# JAVASE_API_MODULEGRAPH_TARGETS. ################################################################################ +# Copy JDK specs files -$(eval $(call SetupJavadocGeneration, nashornapi, \ - MODULES := jdk.scripting.nashorn, \ - PACKAGES := \ - jdk.nashorn.api.scripting \ - jdk.nashorn.api.tree, \ - API_ROOT := jdk, \ - DEST_DIR := nashorn, \ - TITLE := Nashorn API, \ - FIRST_COPYRIGHT_YEAR := 2014, \ - SPLIT_INDEX := TRUE, \ -)) +# For all html documentation in $module/share/specs directories, copy it +# unmodified -TARGETS += $(nashornapi) - -################################################################################ +ALL_MODULES := $(call FindAllModules) +COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib -$(eval $(call SetupJavadocGeneration, dynalinkapi, \ - MODULES := jdk.dynalink, \ - PACKAGES := \ - jdk.dynalink \ - jdk.dynalink.beans \ - jdk.dynalink.linker \ - jdk.dynalink.linker.support \ - jdk.dynalink.support, \ - API_ROOT := jdk, \ - DEST_DIR := dynalink, \ - TITLE := Dynalink API, \ - FIRST_COPYRIGHT_YEAR := 2015, \ -)) +$(foreach m, $(ALL_MODULES), \ + $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ + $(if $(SPECS_$m), \ + $(eval $(call SetupCopyFiles, COPY_$m, \ + SRC := $(SPECS_$m), \ + FILES := $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $(SPECS_$m))), \ + DEST := $(JAVADOC_OUTPUTDIR)/specs/, \ + )) \ + $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \ + ) \ +) -TARGETS += $(dynalinkapi) - -################################################################################ +ifeq ($(ENABLE_FULL_DOCS), true) + # For all markdown files in $module/share/specs directories, convert them to + # html. + MARKDOWN_SPEC_FILTER := %.md -$(eval $(call SetupJavadocGeneration, sctp, \ - MODULES := jdk.sctp, \ - PACKAGES := com.sun.nio.sctp, \ - API_ROOT := jre, \ - DEST_DIR := nio/sctp/spec, \ - TITLE := SCTP API, \ - FIRST_COPYRIGHT_YEAR := 2009, \ -)) - -TARGETS += $(sctp) + # Macro for SetupCopyFiles that converts from markdown to html using pandoc. + define markdown-to-html + $(call MakeDir, $(@D)) + $(RM) $@ + $(PANDOC) -t html -s -o $@ $< + endef -################################################################################ - -$(eval $(call SetupJavadocGeneration, jaccess, \ - MODULES := jdk.accessibility, \ - PACKAGES := com.sun.java.accessibility.util, \ - API_ROOT := jre, \ - DEST_DIR := accessibility/jaccess/spec, \ - TITLE := JACCESS API, \ - FIRST_COPYRIGHT_YEAR := 2002, \ -)) - -TARGETS += $(jaccess) - -################################################################################ + rename-md-to-html = \ + $(patsubst %.md,%.html,$1) -$(eval $(call SetupJavadocGeneration, jdknet, \ - MODULES := jdk.net, \ - PACKAGES := jdk.net, \ - API_ROOT := jre, \ - DEST_DIR := net/socketoptions/spec, \ - TITLE := jdk.net API, \ - FIRST_COPYRIGHT_YEAR := 2014, \ - DISABLED_DOCLINT := missing, \ -)) - -TARGETS += $(jdknet) - -################################################################################ -# Copy JDWP html file + $(foreach m, $(ALL_MODULES), \ + $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ + $(if $(SPECS_$m), \ + $(eval $(call SetupCopyFiles, CONVERT_MARKDOWN_$m, \ + SRC := $(SPECS_$m), \ + FILES := $(filter $(MARKDOWN_SPEC_FILTER), $(call CacheFind, $(SPECS_$m))), \ + DEST := $(JAVADOC_OUTPUTDIR)/specs/, \ + MACRO := markdown-to-html, \ + NAME_MACRO := rename-md-to-html, \ + LOG_ACTION := Converting from markdown, \ + )) \ + $(eval JDK_SPECS_TARGETS += $(CONVERT_MARKDOWN_$m)) \ + ) \ + ) -JDWP_HTML := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html +endif -$(eval $(call SetupCopyFiles, COPY_JDWP_HTML, \ - FILES := $(JDWP_HTML), \ - DEST := $(JAVADOC_OUTPUTDIR)/platform/jpda/jdwp, \ -)) +# Special treatment for generated documentation -COPY_TARGETS += $(COPY_JDWP_HTML) - -################################################################################ -# Copy JVMTI html file +JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html +$(eval $(call SetupCopyFiles, COPY_JDWP_PROTOCOL, \ + FILES := $(JDWP_PROTOCOL), \ + DEST := $(JAVADOC_OUTPUTDIR)/specs/jdwp, \ +)) +JDK_SPECS_TARGETS += $(COPY_JDWP_PROTOCOL) -# Pick jvmti.html from any jvm variant, they are all the same. -JVMTI_HTML := $(firstword \ - $(wildcard $(HOTSPOT_OUTPUTDIR)/variant-*/gensrc/jvmtifiles/jvmti.html)) - +# Get jvmti.html from the main jvm variant (all variants' jvmti.html are identical). +JVMTI_HTML := $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html $(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \ FILES := $(JVMTI_HTML), \ - DEST := $(JAVADOC_OUTPUTDIR)/platform/jvmti, \ + DEST := $(JAVADOC_OUTPUTDIR)/specs, \ )) - -COPY_TARGETS += $(COPY_JVMTI_HTML) +JDK_SPECS_TARGETS += $(COPY_JVMTI_HTML) ################################################################################ # Optional target which bundles all generated javadocs into a zip archive. -JAVADOC_ARCHIVE_NAME := jdk-$(VERSION_STRING)-docs.zip -JAVADOC_ARCHIVE_ASSEMBLY_DIR := $(SUPPORT_OUTPUTDIR)/docs/zip-docs -JAVADOC_ARCHIVE_DIR := $(OUTPUT_ROOT)/bundles -JAVADOC_ARCHIVE := $(JAVADOC_ARCHIVE_DIR)/$(JAVADOC_ARCHIVE_NAME) +JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip +JAVADOC_ZIP_FILE := $(OUTPUT_ROOT)/bundles/$(JAVADOC_ZIP_NAME) -$(JAVADOC_ARCHIVE): $(TARGETS) $(COPY_TARGETS) - $(call LogInfo, Compressing javadoc to single $(JAVADOC_ARCHIVE_NAME)) - $(MKDIR) -p $(JAVADOC_ARCHIVE_DIR) - $(RM) -r $(JAVADOC_ARCHIVE_ASSEMBLY_DIR) - $(MKDIR) -p $(JAVADOC_ARCHIVE_ASSEMBLY_DIR) - all_roots=`$(FIND) $(JAVADOC_OUTPUTDIR) | $(GREP) index.html | grep -v old/doclet`; \ - pushd $(JAVADOC_ARCHIVE_ASSEMBLY_DIR); \ - for index_file in $${all_roots} ; do \ - target_dir=`dirname $${index_file}`; \ - name=`$(ECHO) $${target_dir} | $(SED) "s;/spec;;" | $(SED) "s;.*/;;"`; \ - $(LN) -s $${target_dir} $${name}; \ - done; \ - $(ZIPEXE) -q -r $(JAVADOC_ARCHIVE) * ; \ - popd ; +$(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \ + SRC := $(JAVADOC_OUTPUTDIR), \ + ZIP := $(JAVADOC_ZIP_FILE), \ + EXTRA_DEPS := $(JDK_API_JAVADOC_TARGETS) $(JDK_API_MODULEGRAPH_TARGETS) \ + $(JDK_SPECS_TARGETS), \ +)) -ZIP_TARGETS += $(JAVADOC_ARCHIVE) - -################################################################################ -# generate .dot files for module graphs - -JAVADOC_MODULE_GRAPHS_DIR := $(SUPPORT_OUTPUTDIR)/docs/module-graphs -JAVADOC_MODULE_GRAPHS := $(JAVADOC_MODULE_GRAPHS_DIR)/java.se.dot -JAVADOC_MODULE_GRAPHS_PROPS := $(JDK_TOPDIR)/make/src/classes/build/tools/jigsaw/javadoc-graphs.properties - -$(JAVADOC_MODULE_GRAPHS): $(BUILD_JIGSAW_TOOLS) $(JAVADOC_MODULE_GRAPHS_PROPS) - $(MKDIR) -p $(@D) - $(TOOL_GENGRAPHS) --spec --output $(JAVADOC_MODULE_GRAPHS_DIR) \ - --dot-attributes $(JAVADOC_MODULE_GRAPHS_PROPS) - -MODULE_GRAPH_TARGETS += $(JAVADOC_MODULE_GRAPHS) +ZIP_TARGETS += $(BUILD_JAVADOC_ZIP) ################################################################################ -# Hook to include the corresponding custom file, if present. -$(eval $(call IncludeCustomExtension, , Javadoc.gmk)) +docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) -################################################################################ +docs-jdk-api-modulegraph: $(JDK_API_MODULEGRAPH_TARGETS) -docs-module-graphs: $(MODULE_GRAPH_TARGETS) +docs-javase-api-javadoc: $(JAVASE_API_JAVADOC_TARGETS) -docs-javadoc: $(TARGETS) +docs-javase-api-modulegraph: $(JAVASE_API_MODULEGRAPH_TARGETS) -docs-copy: $(COPY_TARGETS) +docs-jdk-specs: $(JDK_SPECS_TARGETS) docs-zip: $(ZIP_TARGETS) -all: docs-module-graphs docs-javadoc docs-copy docs-zip +all: docs-jdk-api-javadoc docs-jdk-api-modulegraph docs-javase-api-javadoc \ + docs-javase-api-modulegraph docs-jdk-specs docs-zip -.PHONY: default all docs-module-graphs docs-javadoc docs-copy docs-zip +.PHONY: default all docs-jdk-api-javadoc docs-jdk-api-modulegraph \ + docs-javase-api-javadoc docs-javase-api-modulegraph docs-jdk-specs docs-zip
--- a/make/Main.gmk Mon May 08 14:04:27 2017 +0100 +++ b/make/Main.gmk Wed Jul 05 23:21:33 2017 +0200 @@ -272,15 +272,12 @@ $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-jsig hotspot-ide-project ################################################################################ -# Build demos and samples targets +# Build demos targets demos-jdk: +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk) -samples-jdk: - +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk) - -ALL_TARGETS += demos-jdk samples-jdk +ALL_TARGETS += demos-jdk ################################################################################ # Jigsaw specific data and analysis targets. @@ -363,14 +360,22 @@ ################################################################################ # Docs targets -docs-module-graphs: - +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-module-graphs) +# If building full docs, to complete docs-*-api we need both the javadoc and +# modulegraph targets. +docs-jdk-api-javadoc: + +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-jdk-api-javadoc) + +docs-jdk-api-modulegraph: + +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-jdk-api-modulegraph) -docs-javadoc: - +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-javadoc) +docs-javase-api-javadoc: + +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-javase-api-javadoc) -docs-copy: - +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-copy) +docs-javase-api-modulegraph: + +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-javase-api-modulegraph) + +docs-jdk-specs: + +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-jdk-specs) docs-zip: +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs-zip) @@ -378,7 +383,9 @@ update-build-docs: +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f UpdateBuildDocs.gmk) -ALL_TARGETS += docs-module-graphs docs-javadoc docs-copy docs-zip update-build-docs +ALL_TARGETS += docs-jdk-api-javadoc docs-jdk-api-modulegraph \ + docs-javase-api-javadoc docs-javase-api-modulegraph docs-jdk-specs \ + docs-zip update-build-docs ################################################################################ # Cross compilation support @@ -759,7 +766,7 @@ release-file: create-source-revision-tracker - jdk-image: jmods zip-source demos samples release-file + jdk-image: jmods zip-source demos release-file jre-image: jmods release-file symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS) @@ -775,14 +782,18 @@ bootcycle-images: jdk-image - docs-module-graphs: exploded-image buildtools-modules + docs-jdk-api-javadoc: $(GENSRC_TARGETS) rmic - docs-javadoc: $(GENSRC_TARGETS) rmic + docs-javase-api-javadoc: $(GENSRC_TARGETS) rmic + + docs-jdk-api-modulegraph: exploded-image buildtools-modules - # The gensrc step for jdk.jdi creates an html file that is used by docs-copy. - docs-copy: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc + docs-javase-api-modulegraph: exploded-image buildtools-modules - docs-zip: docs-javadoc docs-copy + # The gensrc steps for hotspot and jdk.jdi create html spec files. + docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc + + docs-zip: docs-jdk test: jdk-image test-image @@ -890,8 +901,6 @@ demos: demos-jdk -samples: samples-jdk - # The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk. exploded-image-base: $(ALL_MODULES) exploded-image: exploded-image-base release-file @@ -903,6 +912,22 @@ create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image +docs-jdk-api: docs-jdk-api-javadoc +docs-javase-api: docs-javase-api-javadoc + +# If we're building full docs, we must also generate the module graphs to +# get non-broken api documentation. +ifeq ($(ENABLE_FULL_DOCS), true) + docs-jdk-api: docs-jdk-api-modulegraph + docs-javase-api: docs-javase-api-modulegraph +endif + +docs-jdk: docs-jdk-api docs-jdk-specs +docs-javase: docs-javase-api + +# alias for backwards compatibility +docs-javadoc: docs-jdk-api + mac-bundles: mac-bundles-jdk # The $(BUILD_OUTPUT)/images directory contain the resulting deliverables, @@ -934,7 +959,7 @@ endif # This target builds the documentation image -docs-image: docs-module-graphs docs-javadoc docs-copy +docs-image: docs-jdk # This target builds the test image test-image: prepare-test-image test-image-hotspot-jtreg-native \ @@ -948,9 +973,10 @@ ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \ copy java rmic libs launchers jmods \ - jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples \ + jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \ exploded-image-base exploded-image \ - create-buildjdk mac-bundles product-images \ + create-buildjdk docs-jdk-api docs-javase-api docs-jdk docs-javase \ + docs-javadoc mac-bundles product-images \ profiles profiles-images \ docs-image test-image all-images \ all-bundles
--- a/make/common/MakeBase.gmk Mon May 08 14:04:27 2017 +0100 +++ b/make/common/MakeBase.gmk Wed Jul 05 23:21:33 2017 +0200 @@ -683,9 +683,9 @@ # Param 1 - Dirs to find in # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression. define CacheFind - $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \ - $(shell $(FIND) $1 \( -type f -o -type l \) $2), \ - $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE))) + $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \ + $(if $(wildcard $1), $(shell $(FIND) $1 \( -type f -o -type l \) $2)), \ + $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE))) endef else
--- a/make/common/Modules.gmk Mon May 08 14:04:27 2017 +0100 +++ b/make/common/Modules.gmk Wed Jul 05 23:21:33 2017 +0200 @@ -40,6 +40,7 @@ JRE_TOOL_MODULES := UPGRADEABLE_MODULES := AGGREGATOR_MODULES := +DOCS_MODULES := # Hook to include the corresponding custom file, if present. $(eval $(call IncludeCustomExtension, , common/Modules.gmk)) @@ -58,12 +59,12 @@ java.security.sasl \ java.xml \ jdk.httpserver \ + jdk.internal.vm.ci \ jdk.management \ jdk.management.agent \ jdk.net \ jdk.sctp \ jdk.unsupported \ - jdk.internal.vm.ci \ # # to be deprivileged @@ -78,11 +79,14 @@ java.xml.bind \ java.xml.ws \ java.xml.ws.annotation \ + jdk.internal.vm.compiler \ # # Modules explicitly declared as not being upgradeable even though they require # an upgradeable module. -NON_UPGRADEABLE_MODULES += +NON_UPGRADEABLE_MODULES += \ + jdk.aot \ + # AGGREGATOR_MODULES += \ java.se \ @@ -96,7 +100,6 @@ PLATFORM_MODULES += \ java.compiler \ - jdk.incubator.httpclient \ java.scripting \ java.security.jgss \ java.smartcardio \ @@ -105,32 +108,78 @@ java.xml.crypto \ jdk.accessibility \ jdk.charsets \ + jdk.crypto.cryptoki \ jdk.crypto.ec \ - jdk.crypto.cryptoki \ jdk.dynalink \ + jdk.incubator.httpclient \ jdk.jsobject \ jdk.localedata \ jdk.naming.dns \ jdk.scripting.nashorn \ jdk.security.auth \ jdk.security.jgss \ - jdk.internal.vm.compiler \ jdk.xml.dom \ jdk.zipfs \ # +ifeq ($(OPENJDK_TARGET_OS), windows) + PLATFORM_MODULES += jdk.crypto.mscapi +endif + +ifeq ($(OPENJDK_TARGET_OS), solaris) + PLATFORM_MODULES += jdk.crypto.ucrypto +endif + JRE_TOOL_MODULES += \ jdk.jdwp.agent \ jdk.pack \ jdk.scripting.nashorn.shell \ # -ifeq ($(OPENJDK_TARGET_OS), windows) - PLATFORM_MODULES += jdk.crypto.mscapi -endif -ifeq ($(OPENJDK_TARGET_OS), solaris) - PLATFORM_MODULES += jdk.crypto.ucrypto -endif +################################################################################ + +# DOCS_MODULES defines the root modules for javadoc generation. +# All of their `require transitive` modules directly and indirectly will be included. +DOCS_MODULES += \ + java.se.ee \ + java.smartcardio \ + jdk.accessibility \ + jdk.attach \ + jdk.charsets \ + jdk.compiler \ + jdk.crypto.cryptoki \ + jdk.crypto.ec \ + jdk.dynalink \ + jdk.editpad \ + jdk.httpserver \ + jdk.incubator.httpclient \ + jdk.jartool \ + jdk.javadoc \ + jdk.jcmd \ + jdk.jconsole \ + jdk.jdeps \ + jdk.jdi \ + jdk.jdwp.agent \ + jdk.jlink \ + jdk.jsobject \ + jdk.jshell \ + jdk.jstatd \ + jdk.localedata \ + jdk.management \ + jdk.management.agent \ + jdk.naming.dns \ + jdk.naming.rmi \ + jdk.net \ + jdk.pack \ + jdk.policytool \ + jdk.rmic \ + jdk.scripting.nashorn \ + jdk.sctp \ + jdk.security.auth \ + jdk.security.jgss \ + jdk.xml.dom \ + jdk.zipfs \ + # # These modules are included in the interim image which is used to run profiling # before building the real images. @@ -182,6 +231,8 @@ endif SRC_SUBDIRS += share/classes +SPEC_SUBDIRS += share/specs + # Find all module-info.java files for the current build target platform and # configuration. # Param 1 - Module to find for, set to * for finding all @@ -234,6 +285,12 @@ $(addsuffix /$(strip $1), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \ $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))))) +# Find all specs dirs for a particular module +# $1 - Module to find specs dirs for +FindModuleSpecsDirs = \ + $(strip $(wildcard \ + $(foreach sub, $(SPEC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))))) + # Construct the complete module source path GetModuleSrcPath = \ $(call PathList, \ @@ -255,15 +312,15 @@ ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \ $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\ BEGIN { if (MODULE != "java.base") printf(" java.base"); } \ - /requires/ { sub(/;/, ""); \ - sub(/requires/, ""); \ - sub(/transitive/, ""); \ - sub(/\/\/.*/, ""); \ - sub(/\/\*.*\*\//, ""); \ - gsub(/^ +\*.*/, ""); \ - gsub(/ /, ""); \ - printf(" %s", $$0) } \ - END { printf("\n") }' $m \ + /^ *requires/ { sub(/;/, ""); \ + sub(/requires/, ""); \ + sub(/transitive/, ""); \ + sub(/\/\/.*/, ""); \ + sub(/\/\*.*\*\//, ""); \ + gsub(/^ +\*.*/, ""); \ + gsub(/ /, ""); \ + printf(" %s", $$0) } \ + END { printf("\n") }' $m \ ) >> $@ $(NEWLINE)) -include $(MODULE_DEPS_MAKEFILE) @@ -281,6 +338,11 @@ $(foreach n, $(call FindDepsForModule, $m), \ $(call FindDepsForModule, $n)))) +# Finds transitive dependencies in 3 levels for a set of modules. +# Param 1: List of modules to find transitive deps for +FindTransitiveDepsForModules = \ + $(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m))) + # Upgradeable modules are those that are either defined as upgradeable or that # require an upradeable module. FindAllUpgradeableModules = \ @@ -329,6 +391,7 @@ else ifeq ($$(classloader), ext) PLATFORM_MODULES += $1 endif + DOCS_MODULES += $1 else # Default to include in all JRE_MODULES += $1
--- a/make/common/NativeCompilation.gmk Mon May 08 14:04:27 2017 +0100 +++ b/make/common/NativeCompilation.gmk Wed Jul 05 23:21:33 2017 +0200 @@ -165,6 +165,7 @@ WINDOWS_SHOWINCLUDE_SED_PATTERN := \ -e '/^Note: including file:/!d' \ -e 's|Note: including file: *||' \ + -e 's|\r||g' \ -e 's|\\|/|g' \ -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \ -e '\|$(TOPDIR)|I !d' \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/devkit/createGraphvizBundle.sh Wed Jul 05 23:21:33 2017 +0200 @@ -0,0 +1,63 @@ +#!/bin/bash -e +# +# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# Create a bundle in the current directory, containing what's needed to run +# the 'dot' program from the graphviz suite by the OpenJDK build. + +TMPDIR=`mktemp -d -t graphvizbundle-XXXX` +trap "rm -rf \"$TMPDIR\"" EXIT + +ORIG_DIR=`pwd` +cd "$TMPDIR" +GRAPHVIZ_VERSION=2.38.0-1 +PACKAGE_VERSION=1.1 +TARGET_PLATFORM=linux_x64 +BUNDLE_NAME=graphviz-$TARGET_PLATFORM-$GRAPHVIZ_VERSION+$PACKAGE_VERSION.tar.gz +wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-$GRAPHVIZ_VERSION.el6.x86_64.rpm +wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-libs-$GRAPHVIZ_VERSION.el6.x86_64.rpm +wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-plugins-core-$GRAPHVIZ_VERSION.el6.x86_64.rpm +wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-plugins-x-$GRAPHVIZ_VERSION.el6.x86_64.rpm +wget http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64/getPackage/libtool-ltdl-2.2.6-15.5.el6.x86_64.rpm + +mkdir graphviz +cd graphviz +for rpm in ../*.rpm; do + rpm2cpio $rpm | cpio --extract --make-directories +done + +cat > dot << EOF +#!/bin/bash +# Get an absolute path to this script +this_script_dir=\`dirname \$0\` +this_script_dir=\`cd \$this_script_dir > /dev/null && pwd\` +export LD_LIBRARY_PATH="\$this_script_dir/usr/lib64:\$LD_LIBRARY_PATH" +exec \$this_script_dir/usr/bin/dot "\$@" +EOF +chmod +x dot +export LD_LIBRARY_PATH="$TMPDIR/graphviz/usr/lib64:$LD_LIBRARY_PATH" +# create config file +./dot -c +tar -cvzf ../$BUNDLE_NAME * +cp ../$BUNDLE_NAME "$ORIG_DIR"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/devkit/createPandocBundle.sh Wed Jul 05 23:21:33 2017 +0200 @@ -0,0 +1,73 @@ +#!/bin/bash -e +# +# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# Create a bundle in the current directory, containing what's needed to run +# the 'pandoc' program by the OpenJDK build. + +TMPDIR=`mktemp -d -t pandocbundle-XXXX` +trap "rm -rf \"$TMPDIR\"" EXIT + +ORIG_DIR=`pwd` +cd "$TMPDIR" +PANDOC_VERSION=1.17.2 +FULL_PANDOC_VERSION=1.17.2-1 +PACKAGE_VERSION=1.0 +TARGET_PLATFORM=linux_x64 +BUNDLE_NAME=pandoc-$TARGET_PLATFORM-$PANDOC_VERSION+$PACKAGE_VERSION.tar.gz + +wget https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$FULL_PANDOC_VERSION-amd64.deb + +mkdir pandoc +cd pandoc +ar p ../pandoc-$FULL_PANDOC_VERSION-amd64.deb data.tar.gz | tar xz +cd .. + +# Pandoc depends on libgmp.so.10, which in turn depends on libc. No readily +# available precompiled binaries exists which match the requirement of +# support for older linuxes (glibc 2.12), so we'll compile it ourselves. + +LIBGMP_VERSION=6.1.2 + +wget https://gmplib.org/download/gmp/gmp-$LIBGMP_VERSION.tar.xz +mkdir gmp +cd gmp +tar xf ../gmp-$LIBGMP_VERSION.tar.xz +cd gmp-$LIBGMP_VERSION +./configure --prefix=$TMPDIR/pandoc/usr +make +make install +cd ../.. + +cat > pandoc/pandoc << EOF +#!/bin/bash +# Get an absolute path to this script +this_script_dir=\`dirname \$0\` +this_script_dir=\`cd \$this_script_dir > /dev/null && pwd\` +export LD_LIBRARY_PATH="\$this_script_dir/usr/lib:\$LD_LIBRARY_PATH" +exec \$this_script_dir/usr/bin/pandoc "\$@" +EOF +chmod +x pandoc/pandoc +tar -cvzf ../$BUNDLE_NAME pandoc +cp ../$BUNDLE_NAME "$ORIG_DIR"
--- a/test/lib/jdk/test/lib/InMemoryJavaCompiler.java Mon May 08 14:04:27 2017 +0100 +++ b/test/lib/jdk/test/lib/InMemoryJavaCompiler.java Wed Jul 05 23:21:33 2017 +0200 @@ -28,7 +28,9 @@ import java.io.OutputStream; import java.net.URI; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import javax.tools.ForwardingJavaFileManager; import javax.tools.FileObject; @@ -37,6 +39,7 @@ import javax.tools.JavaFileObject; import javax.tools.JavaFileObject.Kind; import javax.tools.SimpleJavaFileObject; +import javax.tools.StandardLocation; import javax.tools.ToolProvider; /** @@ -104,11 +107,24 @@ } private static class FileManagerWrapper extends ForwardingJavaFileManager { - private MemoryJavaFileObject file; + private static final Location PATCH_LOCATION = new Location() { + @Override + public String getName() { + return "patch module location"; + } - public FileManagerWrapper(MemoryJavaFileObject file) { + @Override + public boolean isOutputLocation() { + return false; + } + }; + private final MemoryJavaFileObject file; + private final String moduleOverride; + + public FileManagerWrapper(MemoryJavaFileObject file, String moduleOverride) { super(getCompiler().getStandardFileManager(null, null, null)); this.file = file; + this.moduleOverride = moduleOverride; } @Override @@ -121,6 +137,28 @@ } return file; } + + @Override + public Location getLocationForModule(Location location, JavaFileObject fo) throws IOException { + if (fo == file && moduleOverride != null) { + return PATCH_LOCATION; + } + return super.getLocationForModule(location, fo); + } + + @Override + public String inferModuleName(Location location) throws IOException { + if (location == PATCH_LOCATION) { + return moduleOverride; + } + return super.inferModuleName(location); + } + + @Override + public boolean hasLocation(Location location) { + return super.hasLocation(location) || location == StandardLocation.PATCH_MODULE_PATH; + } + } /** @@ -148,6 +186,15 @@ } private static CompilationTask getCompilationTask(MemoryJavaFileObject file, String... options) { - return getCompiler().getTask(null, new FileManagerWrapper(file), null, Arrays.asList(options), null, Arrays.asList(file)); + List<String> opts = new ArrayList<>(); + String moduleOverride = null; + for (String opt : options) { + if (opt.startsWith("-Xmodule:")) { + moduleOverride = opt.substring("-Xmodule:".length()); + } else { + opts.add(opt); + } + } + return getCompiler().getTask(null, new FileManagerWrapper(file, moduleOverride), null, opts, null, Arrays.asList(file)); } }